Skip to content

Commit

Permalink
feat: replace poetry with uv in baked project [#53]
Browse files Browse the repository at this point in the history
  • Loading branch information
nickatnight committed Dec 4, 2024
1 parent 130fd5f commit 7d226f5
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cookiecutter https://github.com/nickatnight/cookiecutter-fastapi-backend.git
```

## Features
* :whale: **Docker & Docker Compose** integration and optimization for [local development](https://docs.docker.com/compose/). Fast bundles using build stages and [Poetry](https://python-poetry.org/)
* :whale: **Docker & Docker Compose** integration and optimization for [local development](https://docs.docker.com/compose/). Fast bundles using build stages and [uv](https://docs.astral.sh/uv/)
* :computer: **Production ready** Python web server using [FastAPI](https://fastapi.tiangolo.com/)
* :pencil2: **SQLModel** [Library](https://sqlmodel.tiangolo.com/) for interacting with SQL databases from Python code, with Python objects. It is designed to be intuitive, easy to use, highly compatible, and robust
* :light_rail: **Alembic** Lightweight database migration tool for usage with the [SQLAlchemy](https://alembic.sqlalchemy.org/en/latest/) Database Toolkit for Python
Expand Down
4 changes: 2 additions & 2 deletions {{ cookiecutter.project_slug }}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ $ make alembic-migrate
### General workflow
See the [Makefile](/Makefile) to view available commands.

By default, the dependencies are managed with [Poetry](https://python-poetry.org/), go there and install it.
By default, the dependencies are managed with [uv](https://docs.astral.sh/uv/getting-started/installation/), go there and install it.

From `./{{ cookiecutter.backend_container_name }}/` you can install all the dependencies with:

```console
$ poetry install
$ uv sync
```

### pre-commit hooks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ ARG env

WORKDIR /tmp

RUN pip install poetry
RUN pip install uv

COPY ./pyproject.toml ./poetry.lock* /tmp/
COPY ./pyproject.toml ./uv.lock* /tmp/

RUN poetry export $(test "${env:-dev}" != "prod" && echo "--with dev") \
RUN uv export $(test "${env:-dev}" != "prod" && echo "--with dev") \
-f requirements.txt \
--output requirements.txt \
--without-hashes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
[tool.poetry]
[project]
authors = [
{name = "nickatnight", email = "nialexanderke@proton.me"},
]
requires-python = "~{{ cookiecutter.py_version }}"
dependencies = [
"alembic==1.13.2",
"sqlalchemy==2.0.34",
"psycopg[binary]==3.1.13",
"fastapi==0.114.0",
"pydantic-settings==2.4.0",
"sqlmodel==0.0.21",
"redis==4.6.0",
"fastapi-cache2[redis]==0.2.2",
"uvicorn[standard]==0.23.2",
"PyYAML==6.0.1",
"httpx==0.25.0",
"gunicorn==23.0.0",
"openai==1.44.0",
{%- if cookiecutter.use_celery == "yes" %}"celery[beat]==5.2.7"{%- endif %}
]
name = "{{ cookiecutter.project_slug }}"
version = "1.0.0"
description = "Base project for building fastapi backends"
authors = ["nickatnight <nickkelly.858@gmail.com>"]

[tool.poetry.dependencies]
python = "~{{ cookiecutter.py_version }}"
alembic = "1.13.2"
sqlalchemy = "2.0.34"
psycopg = {extras = ["binary"], version = "3.1.13"}
fastapi = "0.114.0"
pydantic-settings = "2.4.0"
sqlmodel = "0.0.21"
redis = "4.6.0"
fastapi-cache2 = {extras = ["redis"], version = "0.2.2"}
uvicorn = {extras = ["standard"], version = "0.23.2"}
PyYAML = "6.0.1"
httpx = "0.25.0"
gunicorn = "23.0.0"
openai = "1.44.0"
{%- if cookiecutter.use_celery == "yes" %}celery = {extras = ["beat"], version = "5.2.7"}{%- endif %}

[tool.poetry.dev-dependencies]
black = "24.8.0"
isort = "5.13.2"
pytest = "8.3.3"
pytest-cov = "5.0.0"
pytest-mock = "3.14.0"
mypy = "1.11.2"
ruff = "0.6.4"
requests = "2.32.3"
sqlalchemy-stubs = "0.4"
[tool.uv]
dev-dependencies = [
"black==24.8.0",
"isort==5.13.2",
"pytest==8.3.3",
"pytest-cov==5.0.0",
"pytest-mock==3.14.0",
"mypy==1.11.2",
"ruff==0.6.4",
"requests==2.32.3",
"sqlalchemy-stubs==0.4",
]

[tool.isort]
multi_line_output = 3
Expand Down Expand Up @@ -111,7 +115,3 @@ module = [
"redis.*"
]
ignore_missing_imports = true

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

0 comments on commit 7d226f5

Please sign in to comment.