Skip to content

Commit a207d2a

Browse files
authored
Adding uv and improving docs (M2-9744) (#1941)
* uv started * docker * ruff and mypy fixes * Docker tweaks * More docker tweaks * Build works * compose tweaks * Dockerfile tweak * uv lock * More docker cleanup * Readme work * Separate docs * More docs * Doc cleanup * Document links * removing internal sqlalchemy immutable dict * docker * removing pipenv from github actions * curl in final image * fixed test pipeline * removed test ref * Correct migrate make target * Minor readme changes * Minor readme changes and other tweaks * Version bump to match upstream * Fixing Make commands * Makefile updates
1 parent b46528c commit a207d2a

32 files changed

Lines changed: 3788 additions & 4917 deletions

.dockerignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,12 @@ allure-results
1212
.github
1313
Jenkinsfile.groovy
1414
Makefile
15-
buildspec.yaml
15+
buildspec.yaml
16+
.venv
17+
.env.default
18+
copilot
19+
.idea
20+
docs
21+
22+
htmlcov
23+
.coverage

.github/dependabot.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
version: 2
22
updates:
3-
- package-ecosystem: "pip"
3+
- package-ecosystem: "uv"
44
directory: "/"
55
schedule:
66
interval: "weekly"
77
allow:
88
- dependency-type: "all"
9-
ignore:
10-
- dependency-name: "pipenv"
119
commit-message:
1210
prefix: "[pip] Dependabot:"
1311
prefix-development: "[pip-dev] Dependabot:"

.github/workflows/code_quality.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
run: git secrets --register-aws
2121
- name: Scan aws secrets
2222
run: git secrets --scan
23-
- name: Install pipenv
24-
run: python -m pip install --upgrade pip && pip install pipenv
25-
- name: Install deps
26-
run: pipenv sync --system --dev
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v6
25+
- name: Install dependencies
26+
run: uv sync --locked
2727
- name: Check formatting
28-
run: ruff check . && ruff format --check .
28+
run: uv run ruff check . && uv run ruff format --check .
2929
- name: Check types
30-
run: mypy ./
30+
run: uv run mypy ./

.github/workflows/tests.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,23 @@ jobs:
1414
- uses: KengoTODA/actions-setup-docker-compose@v1
1515
with:
1616
version: '2.23.3'
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.13' # or your preferred version
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v6
24+
25+
- name: Install dependencies
26+
run: |
27+
uv sync --locked
28+
1729
- name: "Running tests"
1830
run: |
1931
cp .env.default .env
2032
echo -e "\nRABBITMQ__USE_SSL=False" >> .env
21-
docker compose up -d postgres rabbitmq redis
33+
docker compose up -d rabbitmq postgres redis mailhog
2234
make test
2335
2436
- name: Collect artifacts

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ __pycache__/
2323
# Unit test / coverage reports
2424
.coverage
2525
.coverage.*
26+
htmlcov
2627

2728
# Hypothesis
2829
.hypothesis/
@@ -41,13 +42,10 @@ data/
4142
## Logs
4243
*.log
4344

44-
45-
4645
## Docker stuff
4746
docker-compose.local.yaml
4847

4948

50-
5149
## Project configurations
5250
*.env
5351

Makefile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
PORT = 8000
22
HOST = localhost
33

4-
TEST_COMMAND = pytest -s -vv --alluredir=allure-results
4+
TEST_COMMAND = PYTHONPATH=src uv run pytest -s -vv --alluredir=allure-results
55
COVERAGE_COMMAND = coverage run --branch --concurrency=thread,gevent -m pytest
66
REPORT_COVERAGE_COMMAND = coverage html --show-contexts --title "Coverage for ${SHA}"
77

88
EXPORT_COMMAND = python src/export_spec.py
99

10-
RUFF_COMMAND = ruff
11-
MYPY_COMMAND = mypy
10+
RUFF_COMMAND = uv run ruff
11+
MYPY_COMMAND = uv run mypy
1212

1313
DOCKER_COMPOSE_EXISTS := $(shell command -v docker-compose 2> /dev/null)
1414

@@ -28,7 +28,7 @@ COVERAGE_DOCKER_EXEC = ${DOCKER_COMPOSE_CMD} run --rm -u root app
2828
# NOTE: Make sure that Redis server is running
2929
.PHONY: run
3030
run:
31-
uvicorn src.main:app --proxy-headers --host ${HOST} --port ${PORT} --reload
31+
PYTHONPATH=src uv run uvicorn src.main:app --proxy-headers --host ${HOST} --port ${PORT} --reload
3232

3333
.PHONY: run_local
3434
run_local:
@@ -40,11 +40,7 @@ test:
4040

4141
.PHONY: migrate
4242
migrate:
43-
./compose/fastapi/migrate
44-
45-
.PHONY: migrate-arbitrary
46-
migrate-arbitrary:
47-
./compose/fastapi/migrate arbitrary
43+
uv run alembic upgrade head
4844

4945
# NOTE: cq == "Code quality"
5046
.PHONY: cq

Pipfile

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

0 commit comments

Comments
 (0)