Skip to content

Commit

Permalink
clean: fix uv
Browse files Browse the repository at this point in the history
  • Loading branch information
bolinocroustibat committed Sep 22, 2024
1 parent ffda965 commit 37f60e6
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2 # Ruff version
rev: v0.6.7 # Ruff version
hooks:
# Run the linter
- id: ruff
Expand Down
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ This branch is using Django, Django Ninja and PostgreSQL. There is also a deprec

Python API with a PostgreSQL database using Django framework.

- Python 3.11
- A PostgreSQL 15 database (should also work with other PostgreSQL versions)
- Python >= 3.10
- A PostgreSQL 15 database (not tested with other PostgreSQL versions)
- A YouTube API v3 key
- A modern Python package manager like [Rye](https://rye-up.com/) or [PDM](https://pdm.fming.dev/)
- A modern Python package manager like [uv](https://docs.astral.sh/uv/)
- [Django](https://www.djangoproject.com/)
- [Django-Ninja](https://django-ninja.rest-framework.com/)

## Install

Create a virtual environnement and install the dependencies in it with [Rye](https://rye-up.com/) single command:
Create a virtual environnement and install the dependencies in it with [uv](https://docs.astral.sh/uv/) single command:
```bash
rye sync
uv sync
```


## Run
## Run

Run a PostgreSQL database instance with a `vj-api` database and a user.
For example, with Docker:
Expand All @@ -50,34 +50,29 @@ YOUTUBE_API_KEY="MY_API_KEY"

Migrate the database:
```bash
rye run ./manage.py migrate
uv run ./manage.py migrate
```

Create a superuser:
```bash
rye run ./manage.py createsuperuser
uv run ./manage.py createsuperuser
```

Collect the static files:
```bash
rye run ./manage.py collectstatic
uv run ./manage.py collectstatic
```

Finally, launch the Django web server:
```bash
rye run ./manage.py runserver
uv run ./manage.py runserver
```

## Lint and format the code

Lint with:
Lintand format code with:
```bash
rye lint
```

Format with:
```bash
rye fmt
uv run ruff check --fix && ruff format
```

## Endpoints
Expand Down
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ homepage = "https://vj-api.adriencarpentier.com"
line-length = 100
lint = { extend-select = ["I"] }

[tool.ruff]
line-length = 100
lint = { extend-select = ["I"] }

[tool.uv]
dev-dependencies = ["ruff>=0.6.2"]
dev-dependencies = [
"ruff>=0.6.7",
]
40 changes: 20 additions & 20 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 37f60e6

Please sign in to comment.