Skip to content

Commit

Permalink
Merge pull request #383 from neutrinoceros/mnt/dependency-groups
Browse files Browse the repository at this point in the history
MNT: migrate requirement files to PEP 735 dependency groups
  • Loading branch information
neutrinoceros authored Oct 26, 2024
2 parents 220fa0b + 5fdb307 commit 4b7dc35
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 63 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ jobs:
steps:
- name: Checkout Source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.x
- name: Install build dependencies
run: python -m pip install build wheel
- uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v3.2.0
- name: Build distributions
shell: bash -l {0}
run: python -m build
run: uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3
70 changes: 20 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}

- uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v3.2.0
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
if: ${{ !matrix.free-threading }}
with:
Expand All @@ -50,46 +46,32 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
nogil: true
- name: Setup package
- name: Build
run: |
python -m pip install --upgrade pip
python -m pip install "."
python -m pip install -r requirements/tests.txt
uv venv --python-preference=only-system -p ${{ matrix.python-version }}
uv sync --group test --no-editable
- name: Run tests
run: |
pytest --color=yes
tests_isolated_app:
name: Python ${{ matrix.python-version }} (isolated deps)
strategy:
matrix:
python-version:
- '3.10'
- '3.13'
run: uv run pytest --color=yes

tests_minimal_env:
name: Test minimal requirements
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
- name: Setup package
- uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v3.2.0
- name: Build
run: |
python -m pip install --upgrade pip
python -m pip install ".[isolated]"
python -m pip install -r requirements/tests.txt
uv sync -p 3.10 \
--resolution=lowest-direct --group test --no-editable
- name: Run tests
run: |
pytest --color=yes
run: uv run pytest --color=yes

type-check:

strategy:
matrix:
python-version:
- '3.10'
- '3.12'
- '3.13'

runs-on: ubuntu-latest
name: type check
Expand All @@ -100,20 +82,11 @@ jobs:

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}

- uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v3.2.0
- name: Build
run: |
python -m pip install --upgrade pip
python -m pip install "."
python -m pip install -r requirements/typecheck.txt
run: uv sync -p ${{ matrix.python-version }} --group typecheck --no-editable
- name: Run mypy
run: mypy src/idefix_cli

run: uv run mypy src/idefix_cli

docs:
runs-on: ubuntu-latest
Expand All @@ -125,17 +98,14 @@ jobs:

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.x
- uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v3.2.0
- name: Setup env
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements/docs.txt
uv venv
uv pip install -r docs/requirements.txt
- name: Build
run: |
python -m mkdocs build
uv run mkdocs build
- name: Upload artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ mkdocs:
# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: requirements/docs.txt
- requirements: requirements.txt
2 changes: 1 addition & 1 deletion requirements/docs.in → docs/requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# update concrete env with
# uv pip compile requirements/docs.in > requirements/docs.txt
# uv pip compile requirements.in > requirements.txt

.
mkdocs>=1.5.3
Expand Down
File renamed without changes.
12 changes: 11 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ baballe = "idefix_cli.__main__:alt_main"
[project.urls]
Homepage = "https://github.com/neutrinoceros/idefix_cli"


[dependency-groups]
test = [
"pytest-check>=2.1.2",
"pytest>=7.2.1",
]
typecheck = [
"mypy>=1.11.2",
]

[tool.setuptools]
license-files = [
"LICENSE",
Expand Down Expand Up @@ -78,7 +88,7 @@ show_error_context = true

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--doctest-modules"
addopts = "-ra --doctest-modules"
filterwarnings = [
"error",
]
2 changes: 0 additions & 2 deletions requirements/tests.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements/typecheck.txt

This file was deleted.

0 comments on commit 4b7dc35

Please sign in to comment.