Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gdamjan/uv-getting-started
An example "getting started" python project based on `uv`
https://github.com/gdamjan/uv-getting-started
demo python
Last synced: about 1 month ago
JSON representation
An example "getting started" python project based on `uv`
- Host: GitHub
- URL: https://github.com/gdamjan/uv-getting-started
- Owner: gdamjan
- License: cc0-1.0
- Created: 2024-08-21T17:35:17.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-12-11T16:37:18.000Z (about 1 month ago)
- Last Synced: 2024-12-11T17:35:58.228Z (about 1 month ago)
- Topics: demo, python
- Language: Python
- Homepage:
- Size: 61.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# An example _getting started_ python project based on `uv`
[`uv`](https://docs.astral.sh/uv) - An extremely fast Python package and project manager, written in Rust
- uses [`pyproject.toml`](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/) (and `uv.lock`)
- follows the [`src/`](https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/) directory layout
- example production optimized `Dockerfile`
- github actions ci
- depends on: [httpx](https://www.python-httpx.org/), [granian](https://github.com/emmett-framework/granian) and [polars](https://docs.pola.rs/), just as an example### Quickstart:
```
uv sync
uv run granian --interface asginl demo.web:app
```### Running dev tools:
```
uv run pyright
uv run ruff format
uv run ruff check
```### Build container image:
```
podman build -t uv-demo .
podman run -it --rm -p 8000:8000 uv-demo
```
> [!NOTE]
> Use Podman or Docker - it's the same, podman is rootless on Linux### Running scripts
These scripts will be executed in the context (venv, python) of the project, good for development helper scripts:
```
uv run scripts/h.py
uv run scripts/p.py
uv run scripts/example.py 1 2 3 hello world 4 5
```#### PEP 723
`uv` can also run scripts that have the pep-0723 based metadata,
like dependencies. There's no need to setup venvs or dependencies
in a pyproject.toml file, uv automagically creats an ad-hoc venv
for the script.See:
* `uv` docs: [Running scripts - Creating a Python script](https://docs.astral.sh/uv/guides/scripts/#creating-a-python-script)
* [PEP 723 – Inline script metadata](https://peps.python.org/pep-0723/)```
uv run scripts/pep723.py
```