A template repo for AI Engineering projects (using python
) and uv
. This
template is like our original AI Engineering template,
however, unlike how that template uses poetry, this one uses uv for dependency
management (as well as packaging and publishing).
The development environment can be set up using uv. Hence, make sure it is installed and then run:
uv sync
source .venv/bin/activate
In order to install dependencies for testing (codestyle, unit tests, integration tests), run:
uv sync --dev
source .venv/bin/activate
If you're coming from poetry
then you'll notice that the virtual environment
is actually stored in the project root folder and is by default named as .venv
.
The other important note is that while poetry
uses a "flat" layout of the project,
uv
opts for the the "src" layout. (For more info, see here)
The table below provides the uv
equivalent counterparts for some of the more
common poetry
commands.
Poetry | UV |
---|---|
poetry new <project-name> # creates new project |
uv init <project-name> |
poetry install # installs existing project |
uv sync |
poetry install --with docs,test |
uv sync --group docs --group test |
poetry add numpy |
uv add numpy |
poetry add pytest pytest-asyncio --groups dev |
uv add pytest pytest-asyncio --groups dev |
poetry remove numpy |
uv remove numpy |
poetry lock |
uv lock |
poetry run <cmd> # runs cmd with the project venv |
uv run <cmd> |
poetry build |
uv build |
poetry publish |
uv publish |
poetry cache clear pypi --all |
uv cache clean |
For the full list of uv
commands, you can visit the official docs.
If you're curious about what "uv" stands for, it appears to have been more or less chosen randomly.