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

Use uv for testing #946

Merged
merged 2 commits into from
Mar 13, 2025
Merged
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
42 changes: 23 additions & 19 deletions .github/workflows/Conda-app.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Conda package
name: Continuous integration tests

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
ci:
@@ -35,39 +35,43 @@ jobs:
- name: Install opencv dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1 and libglx-mesa0
sudo apt-get install -y libgl1 and libglx-mesa0
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
- name: Install ipynb dependencies (pandoc)
run: |
sudo apt-get update
sudo apt-get install -y pandoc
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
environment-name: DeepForest
environment-file: environment.yml
create-args: "python=${{ matrix.python-version }}"
cache-environment: true
cache-downloads: true
python-version: ${{ matrix.python-version }}

- name: Set up Python
run: uv python install

- name: Install package
run: pip install . -U
run: uv sync --all-extras --dev

- name: Run pytest
run: pytest -v
run: uv run pytest -v

- name: Check style
run: yapf -d --recursive src/deepforest/ --style=.style.yapf
run: uv run yapf -d --recursive src/deepforest/ --style=.style.yapf

- name: Check notebook style
run: nbqa yapf --in-place docs/user_guide/examples/*.ipynb --style=.style.yapf
run: uv run nbqa yapf --in-place docs/user_guide/examples/*.ipynb --style=.style.yapf

- name: Check notebook build
run: pytest --nbmake docs/**/*_test.ipynb
run: uv run pytest --nbmake docs/**/*_test.ipynb

- name: Run docformatter
run: docformatter --check --recursive src/deepforest/
run: uv run docformatter --check --recursive src/deepforest/

- name: Test Docs
run: |
cd docs && make clean && make html SPHINXOPTS="-W"
cd docs && uv run make clean && uv run make html SPHINXOPTS="-W"
- name: Test and check build artifacts
run: |
pip install build && python -m build && twine check dist/*
uv pip install build && uv run python -m build && uv run twine check dist/*
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -72,5 +72,26 @@ dependencies = [
"xmltodict",
]

[project.optional-dependencies]
dev = [
"black",
"bump-my-version",
"docformatter",
"flake8",
"mypy",
"nbmake",
"nbsphinx",
"nbqa",
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-xdist",
"sphinx_design",
"sphinx_markdown_tables",
"sphinx_rtd_theme",
"twine",
"yapf",
]

[tool.setuptools.packages.find]
where = ["src"]