-
Notifications
You must be signed in to change notification settings - Fork 146
[DEV-12320] - Update dependency management #4416
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
base: qat
Are you sure you want to change the base?
Conversation
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.
We will need to update the README.md, especially regarding running tests not in a container. I think we should include instructions for settings up a venv with the python version using uv to run tests locally, e.g. uv venv --python 3.10.12 usaspending-api. I have not tested this yet.
I updated the readme to include install python with uv and running tests locally.
| @printf "\n==== Environment Variables ====\n\n" | ||
| @printenv | ||
|
|
||
| .python-version: ## Attempt to setup python using pyenv |
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.
Let the docker container handle setting the python version. Added a note about installing the python version with uv if running locally to the readme.
| fi; \ | ||
| fi; | ||
|
|
||
| .venv: ## Ensure a virtual environment is established at .venv |
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.
No need for a venv since we are already in a container or if running locally uv will handle the environment.
| image: usaspending-testing # when an image by this name is not found in the local repo, and it is forced to build, it will use this as the tag | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.testing |
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.
The Dockerfile filename should be .Dockerfile by convention:
Some projects may need distinct Dockerfiles for specific purposes. A common convention is to name these
<something>.Dockerfile.
https://docs.docker.com/build/concepts/dockerfile/#filename
This will enable IDEs and github to highlight the syntax.
| dependencies = [ | ||
| "asyncpg==0.29.*", | ||
| "attrs==23.2.*", | ||
| "boto3>=1.34,<1.36", |
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.
boto3 was set to 1.34.* I loosened this a bit because it was conflicting with the ansible and/or awscli requirements. In the Dockerfile these are pip installed as a subsequent step, so it was likely installing a different version of boto3 into the image during that step.
…dates to dockerfiles, makefile, and docker-compose to support uv
sethstoudenmier
left a comment
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.
Small change for the duplicate reference to Django, but mostly questions for OPS around if some of the files are referenced directly
|
|
||
| FROM python:3.10.12-slim-bullseye | ||
|
|
||
| COPY --from=ghcr.io/astral-sh/uv:0.7.19 /uv /uvx /bin/ |
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.
Need to follow up with OPS to make sure that pulling from GitHub container registry is alright with some of the planned changes.
| local-dev-setup: uv-sync check-dependencies .ivy2 ## Setup virtual environment and pip dependencies, then check version info | ||
|
|
||
| .PHONY: check-dependencies | ||
| check-dependencies: ## Prints out the versions of dependencies in use |
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 I am following correctly, uv will be managing the virtual environment and remove the need for us doing it ourself?
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.
Need to work with OPS to see where this file is used
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.
The fact that it calls out the requirements-server.txt makes me wonder if it was used directly
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.
Similar to the caching requirements above, we need to double check if this is used directly anywhere
…requirements-dev.txt
Description:
This is a draft PR for discussion around adding uv as a dependency manager.This PR updated the project to use
uvas the python project/package manager.Dockerfileis updated to installuvand to sync the project dependencies.pyproject.toml(including extra dependency groups for dev, server, ansible, etc.)uv runfor tests and to allow uv to manage the environment.uv.lockfile is added to the repo to ensure reproducibility of the environment.Jira: DEV-12320