Skip to content

Commit 3721ef4

Browse files
Copilotmasci
andcommitted
chore: migrate project config from Hatch envs to UV
Co-authored-by: masci <7241+masci@users.noreply.github.com>
1 parent d5bcf02 commit 3721ef4

4 files changed

Lines changed: 56 additions & 73 deletions

File tree

AGENTS.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,39 @@ Banks is a Python prompt programming language and templating system for LLM appl
1010

1111
```bash
1212
# Most common commands
13-
hatch run test # Run unit tests
14-
hatch run lint:all # Run all linting checks
15-
hatch run lint:fmt # Auto-format code
16-
hatch run test tests/test_foo.py # Run specific test file
13+
uv run pytest tests # Run unit tests
14+
uv run ruff format --check && uv run ruff check . && uv run mypy --install-types --non-interactive src/banks && uv run pylint src/banks # Run all linting checks
15+
uv run ruff format # Auto-format code
16+
uv run pytest tests/test_foo.py # Run specific test file
1717
```
1818

1919
## Development Commands
2020

21+
### Setup
22+
- Install dev dependencies: `uv sync --extra dev`
23+
2124
### Testing
22-
- Run tests: `hatch run test`
23-
- Run tests with coverage: `hatch run test-cov`
24-
- Generate coverage report: `hatch run cov`
25-
- Run specific test file: `hatch run test tests/test_foo.py`
26-
- Run e2e tests: `hatch run test tests/e2e/` (requires API keys)
25+
- Run tests: `uv run pytest tests`
26+
- Run tests with coverage: `uv run pytest --cov --cov-report=xml tests`
27+
- Generate coverage report: `uv run pytest --cov --cov-report=xml tests && coverage combine && coverage report -m`
28+
- Run specific test file: `uv run pytest tests/test_foo.py`
29+
- Run e2e tests: `uv run pytest tests/e2e/` (requires API keys)
2730

2831
### Linting and Type Checking
29-
- Format code: `hatch run lint:fmt`
30-
- Auto-fix lint issues: `hatch run lint:fix`
31-
- Check formatting: `hatch run lint:check`
32-
- Run type checking: `hatch run lint:typing`
33-
- Run pylint: `hatch run lint:lint`
34-
- Run all lint checks: `hatch run lint:all`
32+
- Format code: `uv run ruff format`
33+
- Auto-fix lint issues: `uv run ruff check --fix`
34+
- Check formatting: `uv run ruff format --check && uv run ruff check .`
35+
- Run type checking: `uv run mypy --install-types --non-interactive src/banks`
36+
- Run pylint: `uv run pylint src/banks`
37+
- Run all lint checks: `uv run ruff format --check && uv run ruff check . && uv run mypy --install-types --non-interactive src/banks && uv run pylint src/banks`
3538

3639
### Documentation
37-
- Build docs: `hatch run docs build`
38-
- Serve docs locally: `hatch run docs serve` (available at http://127.0.0.1:8000/)
40+
- Build docs: `uv run mkdocs build`
41+
- Serve docs locally: `uv run mkdocs serve` (available at http://127.0.0.1:8000/)
3942

4043
### Environment Management
41-
- All commands use Hatch environments with automatic dependency management
42-
- Uses `uv` as the installer for faster dependency resolution
44+
- Uses `uv` for dependency management and running tools
45+
- Install all dev dependencies: `uv sync --extra dev`
4346
- Python 3.9+ supported (tested on 3.10-3.14)
4447

4548
## Architecture Overview
@@ -157,9 +160,9 @@ hatch run test tests/test_foo.py # Run specific test file
157160

158161
### Running Specific Tests
159162
```bash
160-
hatch run test tests/test_image.py # Single file
161-
hatch run test tests/test_image.py::test_name # Single test
162-
hatch run test -k "image" # Tests matching pattern
163+
uv run pytest tests/test_image.py # Single file
164+
uv run pytest tests/test_image.py::test_name # Single test
165+
uv run pytest -k "image" # Tests matching pattern
163166
```
164167

165168
## Code Style

CONTRIBUTING.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,32 @@ be very happy about:
1111
- Refer this project in your project's readme
1212
- Mention the project at local meetups and tell your friends/colleagues
1313

14-
## Install Hatch
14+
## Setup
1515

16-
Assuming you already have Python installed and it's at least on version 3.10, the first step is to install
17-
[Hatch](https://hatch.pypa.io/1.9/). We'll use Hatch to manage the virtual environments that are needed to build the
18-
project, the documentation and to run the tests. Depending on your operating system, there are different ways to
19-
install Hatch:
16+
Assuming you already have Python installed (version 3.10 or later), the recommended way to work on this project is
17+
with [uv](https://docs.astral.sh/uv/). Install `uv` following the
18+
[official instructions](https://docs.astral.sh/uv/getting-started/installation/), then install all development
19+
dependencies with:
2020

21-
- `brew install hatch` on Mac
22-
- The [GUI installer](https://hatch.pypa.io/1.9/install/#gui-installer_1) on Windows
23-
- Or just `pip install hatch`
24-
25-
The [official documentation for Hatch](https://hatch.pypa.io/1.9/install/) contains a thorough description of all the
26-
available installation methods.
21+
```sh
22+
$ uv sync --extra dev
23+
```
2724

2825
## Run the tests
2926

30-
With Hatch installed, from the root of the repository running the tests is as simple as:
27+
With `uv` installed, from the root of the repository running the tests is as simple as:
3128

3229
```sh
33-
$ hatch run test
30+
$ uv run pytest tests
3431
```
3532

36-
This command will activate the proper virtual environment, sync the required dependencies and invoke
33+
This command will use the virtual environment managed by `uv`, sync the required dependencies and invoke
3734
[pytest](https://docs.pytest.org/en/stable/index.html).
3835

3936
To see a recap of the test coverage and specifically which are the lines that are currently not tested, you can run:
4037

4138
```sh
42-
$ hatch run cov
39+
$ uv run pytest --cov --cov-report=xml tests && coverage combine && coverage report -m
4340
```
4441

4542
## Lint the code
@@ -51,7 +48,13 @@ and used consistently across the codebase.
5148
To perform a comprehensive lint check just run:
5249

5350
```sh
54-
$ hatch run lint:all
51+
$ uv run ruff format --check && uv run ruff check . && uv run mypy --install-types --non-interactive src/banks && uv run pylint src/banks
52+
```
53+
54+
To auto-format the code:
55+
56+
```sh
57+
$ uv run ruff format
5558
```
5659

5760
> [!IMPORTANT]
@@ -64,7 +67,7 @@ Any contribution to the documentation is very welcome, whether it's a fix for a
6467
new recipe in the cookbook. To preview the documentation locally, you can run:
6568

6669
```sh
67-
$ hatch run docs serve
70+
$ uv run mkdocs serve
6871
```
6972

7073
and open the browser at the URL `http://127.0.0.1:8000/`. The documentation is built with

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
[![test](https://github.com/masci/banks/actions/workflows/test.yml/badge.svg)](https://github.com/masci/banks/actions/workflows/test.yml)
99
[![docs](https://github.com/masci/banks/actions/workflows/docs.yml/badge.svg)](https://github.com/masci/banks/actions/workflows/docs.yml)
1010

11-
[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
1211
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
1312
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
1413
[![License - MIT](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://spdx.org/licenses/)

pyproject.toml

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,7 @@ dependencies = [
3535

3636
[project.optional-dependencies]
3737
all = ["litellm", "redis"]
38-
39-
[project.urls]
40-
Documentation = "https://github.com/masci/banks#readme"
41-
Issues = "https://github.com/masci/banks/issues"
42-
Source = "https://github.com/masci/banks"
43-
44-
[tool.hatch.version]
45-
path = "src/banks/__about__.py"
46-
47-
[tool.hatch.envs.default]
48-
installer = "uv"
49-
dependencies = [
38+
dev = [
5039
"coverage[toml]>=6.5",
5140
"pytest",
5241
"pytest-cov",
@@ -57,29 +46,18 @@ dependencies = [
5746
"eval-type-backport;python_version<'3.10'",
5847
"redis",
5948
"litellm",
49+
"mypy>=1.0.0",
50+
"ruff>=0.0.243",
51+
"pylint",
6052
]
6153

62-
[tool.hatch.envs.default.scripts]
63-
test = "pytest {args:tests}"
64-
test-cov = "pytest --cov --cov-report=xml {args:tests}"
65-
cov-report = ["- coverage combine", "coverage report -m"]
66-
cov = ["test-cov", "cov-report"]
67-
docs = "mkdocs {args:build}"
68-
69-
[[tool.hatch.envs.all.matrix]]
70-
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]
71-
72-
[tool.hatch.envs.lint]
73-
detached = false # Normally the linting env can be detached, but mypy doesn't install all the stubs we need
74-
dependencies = ["mypy>=1.0.0", "ruff>=0.0.243", "pylint", "redis", "litellm"]
75-
76-
[tool.hatch.envs.lint.scripts]
77-
check = ["ruff format --check {args}", "ruff check {args:.}"]
78-
lint = "pylint {args:src/banks}"
79-
typing = "mypy --install-types --non-interactive {args:src/banks}"
80-
all = ["check", "typing", "lint"]
81-
fmt = "ruff format {args}"
82-
fix = "ruff check --fix {args}"
54+
[project.urls]
55+
Documentation = "https://github.com/masci/banks#readme"
56+
Issues = "https://github.com/masci/banks/issues"
57+
Source = "https://github.com/masci/banks"
58+
59+
[tool.hatch.version]
60+
path = "src/banks/__about__.py"
8361

8462
[tool.hatch.build.targets.wheel]
8563
only-include = ["src/banks", "src/templates"]

0 commit comments

Comments
 (0)