Skip to content

Commit 66acc11

Browse files
committed
Switch to uv for package management.
1 parent 1dd6c23 commit 66acc11

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

Makefile

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
venv:
2-
python3 -m venv venv
3-
source venv/bin/activate ; pip install --upgrade pip ; python3 -m pip install -r requirements-dev.txt
4-
source venv/bin/activate ; pip freeze > requirements_freeze.txt
2+
# Install uv on macOS and Linux:
3+
# $ curl -LsSf https://astral.sh/uv/install.sh | sh
4+
uv venv
5+
uv pip install -r requirements-dev.txt
6+
7+
# venv:
8+
# python3 -m venv .venv
9+
# source .venv/bin/activate ; pip install --upgrade pip ; python3 -m pip install -r requirements-dev.txt
10+
# source .venv/bin/activate ; pip freeze > requirements_freeze.txt
511

612
clean:
7-
rm -rf venv
13+
rm -rf .venv
814

915
run:
10-
source venv/bin/activate ; PYTHONPATH='./src' python -m app reqarg1
16+
# source .venv/bin/activate ; PYTHONPATH='./src' python -m app reqarg1
17+
uv run src/app.py reqarg1
1118

1219
jupyter:
13-
source venv/bin/activate; PYTHONPATH='./src' jupyter lab
20+
source .venv/bin/activate; PYTHONPATH='./src' jupyter lab
1421

1522
black-check:
16-
source venv/bin/activate ; black src --check --verbose --line-length 120
23+
source .venv/bin/activate ; black src --check --verbose --line-length 120
1724

1825
black:
19-
source venv/bin/activate ; black src --line-length 120
26+
source .venv/bin/activate ; black src --line-length 120
2027

2128
ruff-check:
22-
source venv/bin/activate ; ruff check .
29+
source .venv/bin/activate ; ruff check .
2330

2431
ruff:
25-
source venv/bin/activate ; ruff check . --fix
32+
source .venv/bin/activate ; ruff check . --fix
2633

2734
test:
28-
source venv/bin/activate ; PYTHONPATH='./src' pytest -vv --capture=no tests
35+
source .venv/bin/activate ; PYTHONPATH='./src' pytest -vv --capture=no tests
2936

3037
.DEFAULT_GOAL := help
3138
.PHONY: help

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# minimal-python-project-template
22

3-
A minimal quick-start Python project template.
3+
A minimal quick-start Python project template, using [uv](https://github.com/astral-sh/uv) package manager.
44

5-
Uses the following 3rd party libraries:
5+
Uses the following 3rd party libraries:
66

77
- APP - https://github.com/tiangolo/typer - For building CLI applications
88
- APP - https://github.com/Delgan/loguru - Python logging made (stupidly) simple
99
- APP - https://github.com/theskumar/python-dotenv - Reads key-value pairs from a .env file and can set them as environment variables.
10+
- DEV - https://github.com/astral-sh/uv - An extremely fast Python package and project manager
1011
- DEV - https://github.com/psf/black - The uncompromising Python code formatter
1112
- DEV - https://github.com/pytest-dev/pytest - makes it easy to write small tests, yet scales to support complex functional testing
1213

src/app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
def main(required_arg: str, optional_arg: str = None):
11-
token = os.getenv("EXAMPLE_TOKEN")
11+
# token = os.getenv("EXAMPLE_TOKEN")
1212
logger.debug(f"Hello! required_arg = {required_arg}, optional_arg = {optional_arg}")
1313
logger.debug(f"PYTHONPATH = {os.getenv('PYTHONPATH', 'Not set')}")
1414
logger.info(f"LOG_STDERR_LEVEL = {os.getenv('LOG_STDERR_LEVEL', 'Not set. Copy `.env_template` to `.env`')}")

0 commit comments

Comments
 (0)