Skip to content

Commit

Permalink
Drop setuptools, use flit (#519)
Browse files Browse the repository at this point in the history
### What kind of change does this PR introduce?

* Drops `setuptools` build backend for `flit`.
* Moves the `requirements_upstream.txt` file to CI folder.
* Removes the obsolete `Manifest.in`.

### Does this PR introduce a breaking change?

Yes. `setuptools` is no longer used to build the package. Build
requirements are much simpler.

### Other information:

[`flit`](https://flit.pypa.io/en/stable/) is the backend used by the
cookiecutter and most Ouranos projects. It is much simpler in its
configuration and design. We don't compile `xscen` nor do we manage
dependencies using lock files (like `poetry` does).
  • Loading branch information
Zeitsperre authored Feb 6, 2025
2 parents fc049a2 + c9f9f36 commit e5223b6
Show file tree
Hide file tree
Showing 43 changed files with 408 additions and 400 deletions.
4 changes: 2 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/Ouranosinc/cookiecutter-pypackage",
"commit": "36ea29394390254407194bd37315d9e3e9238585",
"commit": "2b31b0f76a180ad93e5a49fe5744306fefb48c9c",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -24,7 +24,7 @@
"generated_with_cruft": "y",
"__gh_slug": "https://github.com/Ouranosinc/xscen",
"_template": "https://github.com/Ouranosinc/cookiecutter-pypackage",
"_commit": "36ea29394390254407194bd37315d9e3e9238585"
"_commit": "2b31b0f76a180ad93e5a49fe5744306fefb48c9c"
}
},
"directory": null
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
actions: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: block
Expand All @@ -68,7 +68,7 @@ jobs:
token: ${{ steps.token_generator.outputs.token }}
persist-credentials: false
- name: Set up Python3
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: "3.x"
- name: Import GPG Key
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cache-cleaner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
actions: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: block
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: audit
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: block
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/first-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
pull-requests: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: block
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
pull-requests: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: block
Expand Down
23 changes: 15 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- "3.x"
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: block
Expand All @@ -43,13 +43,19 @@ jobs:
with:
persist-credentials: false
- name: Setup Python${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install CI libraries
run: |
python -m pip install --require-hashes -r CI/requirements_ci.txt
- name: Environment Caching
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: |
.tox
key: ${{ hashFiles('pyproject.toml', 'tox.ini') }}-lint
- name: Run linting suite
run: |
python -m tox -e lint
Expand All @@ -72,7 +78,7 @@ jobs:
shell: bash -l {0}
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- name: Checkout Repository
Expand All @@ -83,12 +89,13 @@ jobs:
uses: mamba-org/setup-micromamba@0dea6379afdaffa5d528b3d1dabc45da37f443fc # v2.0.4
with:
cache-downloads: true
cache-environment: true
environment-name: xscen-pypi
create-args: >-
esmf=${{ env.esmf-version }}
python=${{ matrix.python-version }}
tox>=4.17.1
tox-gh>=1.3.2
tox>=4.24.1
tox-gh>=1.5.0
- name: Environment Caching
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
Expand Down Expand Up @@ -141,7 +148,7 @@ jobs:
shell: bash -l {0}
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- name: Checkout Repository
Expand All @@ -152,7 +159,7 @@ jobs:
uses: mamba-org/setup-micromamba@0dea6379afdaffa5d528b3d1dabc45da37f443fc # v2.0.4
with:
cache-downloads: true
cache-environment: false # FIXME: No environment caching until issues with micromamba 2.0.0 are resolved.
cache-environment: true
environment-file: environment-dev.yml
create-args: >-
python=${{ matrix.python-version }}
Expand Down Expand Up @@ -183,7 +190,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: audit
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: block
Expand All @@ -34,7 +34,7 @@ jobs:
with:
persist-credentials: false
- name: Set up Python3
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: "3.x"
- name: Install CI libraries
Expand All @@ -44,4 +44,4 @@ jobs:
run: |
python -m build --sdist --wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: block
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tag-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
contents: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: block
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: audit
Expand All @@ -64,7 +64,7 @@ jobs:
with:
persist-credentials: false
- name: Set up Python3
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: "3.x"
- name: Install CI libraries
Expand All @@ -74,7 +74,7 @@ jobs:
run: |
python -m build --sdist --wheel
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
2 changes: 1 addition & 1 deletion .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
shell: bash -l {0}
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- name: Checkout Repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/workflow-warning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
pull-requests: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: block
Expand Down
39 changes: 24 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,39 @@ repos:
- id: check-toml
- id: check-yaml
args: [ '--allow-multiple-documents' ]
- repo: https://github.com/pappasam/toml-sort
rev: v0.24.2
hooks:
- id: toml-sort-fix
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
args: [ '--config-file=.yamllint.yaml' ]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-eval
exclude: biasadjust.py
- id: python-no-log-warn
- id: python-use-type-annotations
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pappasam/toml-sort
rev: v0.24.2
hooks:
- id: toml-sort-fix
- id: text-unicode-replacement-char
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.10.0
rev: 25.1.0
hooks:
- id: black
exclude: ^docs/
- repo: https://github.com/pycqa/isort
rev: 5.13.2
rev: 6.0.0
hooks:
- id: isort
exclude: ^docs/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.9.0
hooks:
- id: ruff
args: [ '--fix', '--show-fixes' ]
Expand All @@ -68,14 +76,15 @@ repos:
rev: v0.3.9
hooks:
- id: blackdoc
additional_dependencies: [ 'black==24.10.0' ]
additional_dependencies: [ 'black==25.1.0' ]
exclude: config.py
- id: blackdoc-autoupdate-black
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: yamllint
args: [ '--config-file=.yamllint.yaml' ]
- id: codespell
additional_dependencies: [ 'tomli' ]
args: [ '--toml=pyproject.toml' ]
# - repo: https://github.com/numpy/numpydoc
# rev: v1.8.0
# hooks:
Expand All @@ -86,12 +95,12 @@ repos:
hooks:
- id: nbqa-pyupgrade
args: [ '--py310-plus' ]
additional_dependencies: [ 'pyupgrade==3.17.0' ]
additional_dependencies: [ 'pyupgrade==3.19.1' ]
- id: nbqa-black
args: [ '--target-version=py310' ]
additional_dependencies: [ 'black==24.10.0' ]
additional_dependencies: [ 'black==25.1.0' ]
- id: nbqa-isort
additional_dependencies: [ 'isort==5.13.2' ]
additional_dependencies: [ 'isort==6.0.0' ]
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ sphinx:
fail_on_warning: true

build:
os: ubuntu-22.04
os: "ubuntu-24.04"
tools:
python: "mambaforge-22.9"
python: "mambaforge-23.11"
jobs:
post_create_environment:
- make translate
Expand Down
23 changes: 21 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@
Changelog
=========

v0.12.0 (unreleased)
--------------------
Contributors to this version: Trevor James Smith (:user:`Zeitsperre`).

Breaking changes
^^^^^^^^^^^^^^^^
* `xscen` now uses `flit` as its build-engine and no longer uses `setuptools`, `setuptools-scm`, or `wheel`. (:pull:`519`).

Bug fixes
^^^^^^^^^
* Docstrings and documentation have been updated to remove several small grammatical errors. (:pull:`527`).

Internal changes
^^^^^^^^^^^^^^^^
* Updated the cookiecutter template to the latest commit. (:pull:`527`):
* Updated versions of many GitHub Actions and Python dependencies.
* Removed `coveralls` from the CI dependencies.
* Added `pre-commit` hooks for `vulture` (dead code) and `codespell` (typos).

v0.11.0 (2025-01-23)
--------------------
Contributors to this version: Gabriel Rondeau-Genesse (:user:`RondeauG`), Juliette Lavoie (:user:`juliettelavoie`), Trevor James Smith (:user:`Zeitsperre`).
Expand Down Expand Up @@ -433,7 +452,7 @@ New features and enhancements
* New 'cos-lat' averaging in `spatial_mean`. (:issue:`94`, :pull:`125`).
* Support for computing anomalies in `compute_deltas`. (:pull:`165`).
* Add function `diagnostics.measures_improvement_2d`. (:pull:`167`).
* Add function ``regrid.create_bounds_rotated_pole`` and automatic use in ``regrid_dataset`` and ``spatial_mean``. This is temporary, while we wait for a functionning method in ``cf_xarray``. (:pull:`174`, :issue:`96`).
* Add function ``regrid.create_bounds_rotated_pole`` and automatic use in ``regrid_dataset`` and ``spatial_mean``. This is temporary, while we wait for a functioning method in ``cf_xarray``. (:pull:`174`, :issue:`96`).
* Add ``spatial`` submodule with functions ``creep_weights`` and ``creep_fill`` for filling NaNs using neighbours. (:pull:`174`).
* Allow passing ``GeoDataFrame`` instances in ``spatial_mean``'s ``region`` argument, not only geospatial file paths. (:pull:`174`).
* Allow searching for periods in `catalog.search`. (:issue:`123`, :pull:`170`).
Expand Down Expand Up @@ -549,7 +568,7 @@ New features and enhancements
* In extract_dataset, add option ``ensure_correct_time`` to ensure the time coordinate matches the expected freq. Ex: monthly values given on the 15th day are moved to the 1st, as expected when asking for "MS". (:issue: `53`).
* In regrid_dataset: (:pull:`68`).
* Allow passing skipna to the regridder kwargs.
* Do not fail for any grid mapping problem, includin if a grid_mapping attribute mentions a variable that doesn't exist.
* Do not fail for any grid mapping problem, including if a grid_mapping attribute mentions a variable that doesn't exist.
* Default email sent to the local user. (:pull:`68`).
* Special accelerated pathway for parsing catalogs with all dates within the datetime64[ns] range. (:pull:`75`).
* New functions ``reduce_ensemble`` and ``build_reduction_data`` to support kkz and kmeans clustering. (:issue:`4`, :pull:`63`).
Expand Down
Loading

0 comments on commit e5223b6

Please sign in to comment.