-
Notifications
You must be signed in to change notification settings - Fork 2
Migrate dependency management from Poetry to uv #68
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
Open
Copilot
wants to merge
5
commits into
main
Choose a base branch
from
copilot/migrate-poetry-to-uv
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,186
−65
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
93cab14
Initial plan
Copilot ef5e263
Migrate from Poetry to uv: Convert pyproject.toml to PEP 621 format a…
Copilot 8b741f5
Co-authored-by: mihow <158175+mihow@users.noreply.github.com>
Copilot 76e46e3
Add GitHub Actions CI workflow for uv-based testing
Copilot f43ff1c
Update Python requirement to >=3.10, simplify CI to test only Python …
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python 3.12 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install uv | ||
| run: | | ||
| curl -LsSf https://astral.sh/uv/install.sh | sh | ||
| echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
|
|
||
| - name: Verify uv installation | ||
| run: uv --version | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| uv sync --extra dev --extra research | ||
|
|
||
| - name: Test CLI commands | ||
| run: | | ||
| uv run ami-dataset --help | ||
| uv run ami-classification --help | ||
|
|
||
| - name: Run test suite | ||
| run: | | ||
| # Placeholder for running the full test suite | ||
| # TODO: Add proper test command once test infrastructure is ready | ||
| uv run pytest tests/ -v || echo "Tests not yet configured" | ||
|
|
||
| - name: Verify imports | ||
| run: | | ||
| uv run python -c "import torch; import numpy; import pandas; print('Core dependencies imported successfully')" | ||
|
|
||
| - name: Verify optional dependencies (research) | ||
| run: | | ||
| uv run python -c "import awscli; import absl; print('Research dependencies imported successfully')" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,67 +1,68 @@ | ||
| [tool.poetry] | ||
| [build-system] | ||
| requires = ["hatchling"] | ||
| build-backend = "hatchling.build" | ||
|
|
||
| [project] | ||
| name = "ami-ml" | ||
| version = "0.1.0" | ||
| description = "Software & research related to the automated monitoring of insects" | ||
| readme = "README.md" | ||
| license = {text = "MIT"} | ||
| requires-python = ">=3.10" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd cap it at <3.15 probably. Too new a version can cause problems with some dependencies |
||
| authors = [ | ||
| "Aditya Jain <aditya.jain@mila.quebec>", | ||
| "Michael Bunsen <michael.bunsen@mila.quebec>", | ||
| "Fagner Cunha <fagner.cunha@icomp.ufam.edu.br>", | ||
| "Léonard Pasi <leonardpasi@gmail.com>", | ||
| {name = "Aditya Jain", email = "aditya.jain@mila.quebec"}, | ||
| {name = "Michael Bunsen", email = "michael.bunsen@mila.quebec"}, | ||
| {name = "Fagner Cunha", email = "fagner.cunha@icomp.ufam.edu.br"}, | ||
| {name = "Léonard Pasi", email = "leonardpasi@gmail.com"}, | ||
| ] | ||
| license = "MIT" | ||
| readme = "README.md" | ||
| packages = [{ include = "src" }] | ||
|
|
||
| [tool.poetry.dependencies] | ||
| python = "^3.9" | ||
| click = "^8.1.6" | ||
| numpy = "^1.25.1" | ||
| torch = "^2.0,!=2.0.1" | ||
| tqdm = "^4.65.0" | ||
| segment-anything = "^1.0" | ||
| torchvision = "^0.15.1,!=0.15.2" | ||
| torchmetrics = "^0.11.4" | ||
| pillow = "^10.0.0" | ||
| matplotlib = "^3.7.2" | ||
| python-dwca-reader = "^0.15.1" | ||
| pandas = "^2.1.0" | ||
| scikit-learn = "^1.3.0" | ||
| webdataset = "^0.2.48" | ||
| timm = "^0.9.8" | ||
| typer = "^0.12.3" | ||
| python-dotenv = "^1.0.1" | ||
| wandb = "^0.17.5" | ||
| pygbif = "^0.6.5" | ||
| opencv-python = "^4.11.0.86" | ||
|
|
||
| [tool.poetry.group.research] | ||
| optional = true | ||
|
|
||
| [tool.poetry.group.research.dependencies] | ||
| awscli = "^1.33.44" | ||
| awscli-plugin-endpoint = "^0.4" | ||
| absl-py = "^2.1.0" | ||
| dependencies = [ | ||
| "click>=8.1.6", | ||
| "numpy>=1.25.1", | ||
| "torch>=2.0,!=2.0.1", | ||
| "tqdm>=4.65.0", | ||
| "segment-anything>=1.0", | ||
| "torchvision>=0.15.1,!=0.15.2", | ||
| "torchmetrics>=0.11.4", | ||
| "pillow>=10.0.0", | ||
| "matplotlib>=3.7.2", | ||
| "python-dwca-reader>=0.15.1", | ||
| "pandas>=2.1.0", | ||
| "scikit-learn>=1.3.0", | ||
| "webdataset>=0.2.48", | ||
| "timm>=0.9.8", | ||
| "typer>=0.12.3", | ||
| "python-dotenv>=1.0.1", | ||
| "wandb>=0.17.5", | ||
| "pygbif>=0.6.5", | ||
| "opencv-python>=4.11.0.86", | ||
| ] | ||
|
|
||
| [tool.poetry.group.dev.dependencies] | ||
| pre-commit = "^3.3.3" | ||
| black = "^23.7.0" | ||
| flake8 = "^6.0.0" | ||
| Flake8-pyproject = "^1.2.3" | ||
| isort = "^5.12.0" | ||
| mypy = "^1.4.1" | ||
| ipdb = "^0.13.13" | ||
| python-devtools = "^2" | ||
| ipykernel = "^6.29.4" | ||
| pytest = "^8.1.1" | ||
| [project.optional-dependencies] | ||
| research = [ | ||
| "awscli>=1.33.44", | ||
| "awscli-plugin-endpoint>=0.4", | ||
| "absl-py>=2.1.0", | ||
| ] | ||
| dev = [ | ||
| "pre-commit>=3.3.3", | ||
| "black>=23.7.0", | ||
| "flake8>=6.0.0", | ||
| "Flake8-pyproject>=1.2.3", | ||
| "isort>=5.12.0", | ||
| "mypy>=1.4.1", | ||
| "ipdb>=0.13.13", | ||
| "python-devtools>=2", | ||
| "ipykernel>=6.29.4", | ||
| "pytest>=8.1.1", | ||
| ] | ||
|
|
||
| [tool.poetry.scripts] | ||
| [project.scripts] | ||
| ami-dataset = "src.dataset_tools.cli:cli" | ||
| ami-classification = "src.classification.cli:cli" | ||
|
|
||
|
|
||
| [build-system] | ||
| requires = ["poetry-core"] | ||
| build-backend = "poetry.core.masonry.api" | ||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["src"] | ||
|
|
||
| [tool.flake8] | ||
| max-line-length = 88 | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't create a virtual environment first without specifying the version, uv usually goes for the max python version available. Maybe allow a range in the pyproject.toml, but aim for fixed version internally? Like say,
uv venv -p 3.13so we don't always end up messing the uv.lock if we each have different venv python version?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, thanks!