Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use dependency-groups #2064

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi

$PYTHON --version
$PYTHON -m venv venv
venv/bin/python -m pip install -U pip
venv/bin/python -m pip install -e ".[dev]"
venv/bin/python -m pip install -U pip dependency-groups
venv/bin/python -m dependency_groups test | xargs venv/bin/python -m pip install -e.
venv/bin/python -m pip freeze
venv/bin/python --version
3 changes: 2 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ only_if: changesInclude('.cirrus.yml') || ($CIRRUS_BRANCH == "main" && !changesI

run_tests: &RUN_TESTS
install_cibuildwheel_script:
- python -m pip install -e ".[dev]" pytest-custom-exit-code
- python -m pip install dependency-groups
- python -m dependency_groups dev | xargs python -m pip install -e. pytest-custom-exit-code
run_cibuildwheel_tests_script:
- python ./bin/run_tests.py

Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ jobs:

- name: Install dependencies
run: |
uv pip install --system ".[test]"
uv sync --no-dev --group test

- name: Generate a sample project
run: |
python -m test.test_projects test.test_0_basic.basic_project sample_proj
uv run -m test.test_projects test.test_0_basic.basic_project sample_proj

- name: Run a sample build (GitHub Action)
uses: ./
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:

- name: Test cibuildwheel
run: |
python ./bin/run_tests.py --run-podman
uv run bin/run_tests.py --run-podman

emulated-archs:
name: Get qemu emulated architectures
Expand All @@ -137,12 +137,13 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: astral-sh/setup-uv@v3
- name: Install dependencies
run: python -m pip install ".[test]"
run: uv sync --no-dev --group test
- name: Get qemu emulated architectures
id: archs
run: |
OUTPUT=$(python -c "from json import dumps; from test.utils import EMULATED_ARCHS; print(dumps(EMULATED_ARCHS))")
OUTPUT=$(uv run python -c "from json import dumps; from test.utils import EMULATED_ARCHS; print(dumps(EMULATED_ARCHS))")
echo "${OUTPUT}"
echo "archs=${OUTPUT}" >> "$GITHUB_OUTPUT"

Expand All @@ -159,14 +160,15 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: astral-sh/setup-uv@v3
- name: Install dependencies
run: python -m pip install ".[test,uv]"
run: uv sync --no-dev --group test

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Run the emulation tests
run: pytest --run-emulation ${{ matrix.arch }} test/test_emulation.py
run: uv run pytest --run-emulation ${{ matrix.arch }} test/test_emulation.py

test-pyodide:
name: Test cibuildwheel building pyodide wheels
Expand All @@ -179,14 +181,14 @@ jobs:
name: Install Python 3.12
with:
python-version: '3.12'
- uses: astral-sh/setup-uv@v3

- name: Install dependencies
run: |
python -m pip install ".[test]"
run: uv sync --no-dev --group test

- name: Generate a sample project
run: |
python -m test.test_projects test.test_0_basic.basic_project sample_proj
uv run -m test.test_projects test.test_0_basic.basic_project sample_proj

- name: Run a sample build (GitHub Action)
uses: ./
Expand All @@ -198,6 +200,6 @@ jobs:

- name: Run tests with 'CIBW_PLATFORM' set to 'pyodide'
run: |
python ./bin/run_tests.py
uv run ./bin/run_tests.py
env:
CIBW_PLATFORM: pyodide
4 changes: 1 addition & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ build:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- uv venv
- uv pip install -e.[docs]
- NO_COLOR=1 .venv/bin/mkdocs build --strict --site-dir $READTHEDOCS_OUTPUT/html
- NO_COLOR=1 uv run --no-dev --group docs mkdocs build --strict --site-dir $READTHEDOCS_OUTPUT/html
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:

install:
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all; fi
- $PYTHON -m pip install -U pip
- $PYTHON -m pip install -e ".[test]" pytest-custom-exit-code
- $PYTHON -m pip install -U pip dependency-groups
- $PYTHON -m dependency_groups test | xargs $PYTHON -m pip install -e. pytest-custom-exit-code

script: |
# travis_wait disable the output while waiting
Expand Down
9 changes: 6 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
versionSpec: '3.8'
- bash: |
docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
python -m pip install -e ".[dev]"
python -m pip install dependency-groups
python -m dependency_groups dev | xargs python -m pip install -e.
python ./bin/run_tests.py

- job: macos_38
Expand All @@ -24,7 +25,8 @@ jobs:
inputs:
versionSpec: '3.8'
- bash: |
python -m pip install -e ".[dev]"
python -m pip install dependency-groups
python -m dependency_groups dev | xargs python -m pip install -e.
python ./bin/run_tests.py --num-processes 2

- job: windows_38
Expand All @@ -35,5 +37,6 @@ jobs:
inputs:
versionSpec: '3.8'
- bash: |
python -m pip install -e ".[dev]"
python -m pip install dependency-groups
python -m dependency_groups dev | xargs python -m pip install -e.
python ./bin/run_tests.py
10 changes: 7 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ def install_and_run(session: nox.Session, script: str, *args: str, **kwargs: Any
return session.run("python", script, *args, **kwargs)


def dep_group(group: str) -> list[str]:
return nox.project.load_toml("pyproject.toml")["dependency-groups"][group] # type: ignore[no-any-return]


@nox.session
def tests(session: nox.Session) -> None:
"""
Run the unit and regular tests.
"""
session.install("-e.[test]")
session.install("-e.", *dep_group("test"))
if session.posargs:
session.run("pytest", *session.posargs)
else:
Expand Down Expand Up @@ -123,7 +127,7 @@ def update_pins(session: nox.Session) -> None:
"""
Update the python, docker and virtualenv pins version inplace.
"""
session.install("-e.[bin]")
session.install("-e.", *dep_group("bin"))
session.run("python", "bin/update_pythons.py", "--force")
session.run("python", "bin/update_docker.py")
session.run("python", "bin/update_virtualenv.py", "--force")
Expand Down Expand Up @@ -166,7 +170,7 @@ def docs(session: nox.Session) -> None:
"""
Build the docs. Will serve unless --non-interactive
"""
session.install("-e.[docs]")
session.install("-e.", *dep_group("docs"))
session.run("mkdocs", "serve" if session.interactive else "build", "--strict", *session.posargs)


Expand Down
33 changes: 19 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ dependencies = [
]

[project.optional-dependencies]
uv = ["uv"]

[project.scripts]
cibuildwheel = "cibuildwheel.__main__:main"

[project.entry-points."validate_pyproject.tool_schema"]
cibuildwheel = "cibuildwheel.schema:get_schema"

[project.urls]
Changelog = "https://github.com/pypa/cibuildwheel#changelog"
Documentation = "https://cibuildwheel.pypa.io"
Homepage = "https://github.com/pypa/cibuildwheel"

[dependency-groups]
bin = [
"click",
"packaging>=21.0",
Expand All @@ -61,9 +75,6 @@ bin = [
"requests",
"rich>=9.6",
]
dev = [
"cibuildwheel[test,bin]",
]
docs = [
"jinja2>=3.1.2",
"mkdocs-include-markdown-plugin==6.2.2",
Expand All @@ -81,18 +92,12 @@ test = [
"tomli_w",
"validate-pyproject",
]
uv = ["uv"]

[project.scripts]
cibuildwheel = "cibuildwheel.__main__:main"

[project.entry-points."validate_pyproject.tool_schema"]
cibuildwheel = "cibuildwheel.schema:get_schema"
dev = [
{include-group = "bin"},
{include-group = "docs"},
{include-group = "test"},
]

[project.urls]
Changelog = "https://github.com/pypa/cibuildwheel#changelog"
Documentation = "https://cibuildwheel.pypa.io"
Homepage = "https://github.com/pypa/cibuildwheel"

[tool.pytest.ini_options]
minversion = "6.0"
Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt

This file was deleted.

Loading