diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dad7d5a58..4993cb535 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,28 +26,32 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4 - with: - fetch-depth: 2 - name: Create environment with Micromamba uses: mamba-org/setup-micromamba@v1 with: - cache-downloads: true cache-environment: true create-args: python=${{ matrix.python-version }} - environment-file: environments/tests/env-ci.yml + environment-file: ./environments/tests/env-ci.yml post-cleanup: none - name: Install OSMnx run: | uv pip install -e . conda list - conda info --all + + - name: Cache pre-commit + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit/ + key: pre-commit-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }} - name: Run pre-commit checks - run: SKIP=no-commit-to-branch pre-commit run --all-files + run: pre-commit run --all-files + env: + SKIP: no-commit-to-branch - - name: Test docs + - name: Test docs build run: make -C ./docs html SPHINXOPTS="-E -W --keep-going" - name: Test code and coverage diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 25047c2e5..068ff7e5c 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -22,15 +22,18 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - name: Pip install requirements + - name: Setup Python uses: actions/setup-python@v5 with: python-version: "3.12" cache: "pip" - - run: pip install -r environments/tests/requirements-test-build.txt - - name: Build package and twine check + - name: Install requirements + run: python -m pip install -r ./environments/tests/requirements-test-build.txt + + - name: Build and validate package run: | + validate-pyproject ./pyproject.toml hatch build --clean twine check --strict ./dist/* diff --git a/.github/workflows/test-minimal.yml b/.github/workflows/test-minimal.yml index 83da98fb9..a18993ab2 100644 --- a/.github/workflows/test-minimal.yml +++ b/.github/workflows/test-minimal.yml @@ -21,28 +21,19 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4 - with: - fetch-depth: 2 - name: Create environment with Micromamba uses: mamba-org/setup-micromamba@v1 with: - cache-downloads: true cache-environment: true - environment-file: environments/tests/env-test-minimal.yml + environment-file: ./environments/tests/env-test-minimal.yml post-cleanup: none - name: Install OSMnx run: | uv pip install -e . micromamba list - micromamba info - - - name: Run pre-commit checks - run: SKIP=no-commit-to-branch pre-commit run --all-files - - - name: Test docs - run: make -C ./docs html SPHINXOPTS="-E -W --keep-going" + uv pip show --verbose osmnx - name: Test code - run: pytest --verbose --maxfail=1 --typeguard-packages=osmnx + run: pytest --verbose --maxfail=1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ecd2e270d..ea87f6035 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,11 +34,6 @@ repos: - id: markdownlint args: [--disable=MD013] - - repo: https://github.com/abravalheri/validate-pyproject - rev: "v0.16" - hooks: - - id: validate-pyproject - - repo: https://github.com/astral-sh/ruff-pre-commit rev: "v0.4.2" hooks: diff --git a/environments/docker/requirements.txt b/environments/docker/requirements.txt index 11d20a870..5620b1f22 100644 --- a/environments/docker/requirements.txt +++ b/environments/docker/requirements.txt @@ -24,6 +24,7 @@ conda-smithy hatch twine uv +validate-pyproject # typing mypy diff --git a/environments/tests/env-ci.yml b/environments/tests/env-ci.yml index 7a3cb97d6..b7d55e788 100644 --- a/environments/tests/env-ci.yml +++ b/environments/tests/env-ci.yml @@ -4,12 +4,13 @@ channels: - conda-forge dependencies: - # required + - uv + + # requirements - geopandas - networkx - numpy - pandas - - python - requests - shapely @@ -20,13 +21,12 @@ dependencies: - scikit-learn - scipy - # testing + # linting/testing - lxml - pre-commit - pytest - pytest-cov - typeguard - - uv # docs - furo diff --git a/environments/tests/env-test-minimal.yml b/environments/tests/env-test-minimal.yml index 6a5ae590c..f349a5233 100644 --- a/environments/tests/env-test-minimal.yml +++ b/environments/tests/env-test-minimal.yml @@ -7,7 +7,9 @@ channels: - conda-forge dependencies: - # required (pinned to min versions from /pyproject.toml) + - uv + + # requirements (pinned to min versions from /pyproject.toml) - geopandas=0.12 - networkx=2.5 - numpy=1.21 @@ -25,13 +27,5 @@ dependencies: # testing - lxml - - pre-commit - pytest - - pytest-cov - typeguard - - uv - - # docs (sphinx pinned to version from /docs/requirements.txt) - - furo - - sphinx=7 - - sphinx-autodoc-typehints diff --git a/environments/tests/requirements-test-build.txt b/environments/tests/requirements-test-build.txt index b80d3ea37..73e39d310 100644 --- a/environments/tests/requirements-test-build.txt +++ b/environments/tests/requirements-test-build.txt @@ -3,3 +3,4 @@ hatch sphinx == 7.* sphinx-autodoc-typehints twine +validate-pyproject[all] diff --git a/tests/release.sh b/tests/release.sh index 2b19df042..c879a864a 100755 --- a/tests/release.sh +++ b/tests/release.sh @@ -11,7 +11,7 @@ fi # update necessary python packaging packages eval "$(conda shell.bash hook)" -conda deactivate +conda activate base conda activate ox mamba update conda-smithy --yes --no-banner @@ -21,13 +21,14 @@ make -C ./docs html SPHINXOPTS="-E -W --keep-going" python -m sphinx -E -W --keep-going -b linkcheck ./docs/source ./docs/build/linkcheck rm -rf ./docs/build -# get the current package version number -VERSION=$(hatch version) - -# build and validate the distribution then get its SHA256 +# build and validate the distribution rm -rf ./dist +validate-pyproject ./pyproject.toml hatch build --clean twine check --strict ./dist/* + +# get the current package version number and its SHA256 +VERSION=$(hatch version) SHA=$(openssl dgst -sha256 -r "./dist/$PACKAGE-$VERSION.tar.gz" | awk '{print $1}') # rerender the conda-forge feedstock