Skip to content

Commit 424061c

Browse files
committed
Use UV package manager
Context: - Far more modern, easier environment management - I have tested all makefile commands work
1 parent 46295d6 commit 424061c

8 files changed

Lines changed: 434 additions & 30 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
git submodule update --remote
1414
- run:
1515
name: Install deps
16-
command: make dev-install
16+
command: make install
1717
- run:
1818
name: Linting
1919
command: make format-check

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.14

Makefile

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,44 @@ docker_config = --settings=config.docker-compose
44
gql_compose_config = -f docker-compose.yml -f Resources/compose/docker-compose-prod-graphql.yml
55
gqlv1beta_compose_config = -f docker-compose.yml -f Resources/compose/docker-compose-prod-graphql.yml -f Resources/compose/docker-compose-prod-graphql-v1beta.yml
66

7-
# Auto-detect Python and pip commands
8-
PYTHON := $(shell which python3 2>/dev/null || which python 2>/dev/null || echo python3)
9-
PIP := $(shell which pip3 2>/dev/null || which pip 2>/dev/null || echo pip3)
10-
117
.PHONY: help
128
.SILENT:
139

1410
help:
1511
@grep -E '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?# "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
1612

1713
install: # Install base requirements to run project
18-
$(PIP) install -r requirements.txt
19-
20-
dev-install: # Install developer requirements + base requirements
21-
$(PIP) install -r test-requirements.txt
14+
uv sync
2215

2316
setup: # Set up the project database
24-
$(PYTHON) manage.py migrate ${local_config}
17+
uv run manage.py migrate ${local_config}
2518

2619
build-db: # Build database
27-
echo "from data.v2.build import build_all; build_all()" | $(PYTHON) manage.py shell ${local_config}
20+
echo "from data.v2.build import build_all; build_all()" | uv run manage.py shell ${local_config}
2821

2922
wipe-sqlite-db: # Delete's the project database
3023
rm -rf db.sqlite3
3124

3225
serve: # Run the project locally
33-
$(PYTHON) manage.py runserver ${local_config}
26+
uv run manage.py runserver ${local_config}
3427

3528
test: # Run tests
36-
$(PYTHON) manage.py test ${local_config}
29+
uv run manage.py test ${local_config}
3730

3831
clean: # Remove any pyc files
3932
find . -type f -name '*.pyc' -delete
4033

4134
migrate: # Run any outstanding migrations
42-
$(PYTHON) manage.py migrate ${local_config}
35+
uv run manage.py migrate ${local_config}
4336

4437
make-migrations: # Create migrations files if schema has changed
45-
$(PYTHON) manage.py makemigrations ${local_config}
38+
uv run manage.py makemigrations ${local_config}
4639

4740
shell: # Load a shell
48-
$(PYTHON) manage.py shell ${local_config}
41+
uv run manage.py shell ${local_config}
4942

5043
openapi-generate:
51-
$(PYTHON) manage.py spectacular --color --file openapi.yml ${local_config}
44+
uv run manage.py spectacular --color --file openapi.yml ${local_config}
5245

5346
docker-up: # (Docker) Create services/volumes/networks
5447
docker compose up -d

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ A RESTful API for Pokémon - [pokeapi.co](https://pokeapi.co)
3737

3838
- Download this source code into a working directory, be sure to use the flag `--recurse-submodules` to clone also our submodules.
3939

40-
- Install the requirements using pip:
40+
- Install [uv](https://docs.astral.sh/uv/getting-started/installation/) for Python environment management.
41+
42+
- Install the requirements using the Makefile commands:
4143

4244
```sh
4345
make install

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[project]
2+
name = "pokeapi"
3+
version = "0.1.0"
4+
description = "The Pokemon API"
5+
readme = "README.md"
6+
requires-python = ">=3.14"
7+
dependencies = [
8+
"coverage==7.13.1",
9+
"django==5.2.10",
10+
"django-cachalot==2.8.0",
11+
"django-cors-headers==4.9.0",
12+
"django-redis==6.0.0",
13+
"djangorestframework==3.16.1",
14+
"drf-spectacular==0.29.0",
15+
"gunicorn==23.0.0",
16+
"psycopg==3.3.2",
17+
"ruff>=0.14.14",
18+
"ty>=0.0.14",
19+
]

requirements.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

test-requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

uv.lock

Lines changed: 401 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)