Skip to content

Commit 933f573

Browse files
authored
Merge pull request #3 from softinio/softinio-push-ylmqxmrqltlt
Package updates and move to poetry and replace ruff
2 parents 4a684b0 + fde72e4 commit 933f573

10 files changed

Lines changed: 2391 additions & 1130 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
github_access_token: ${{ secrets.GITHUB_TOKEN }}
2121

2222
- name: Install dependencies
23-
run: nix develop --command uv sync
23+
run: nix develop --command poetry install
2424

2525
- name: Run linting
2626
run: nix develop --command runLint

.pre-commit-config.yaml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,24 @@ repos:
33
rev: main
44
hooks:
55
- id: pyrefly-typecheck
6-
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
rev: v0.9.9
8-
hooks:
9-
- id: ruff
10-
types_or: [python, pyi, jupyter]
11-
args: [ --fix ]
12-
- id: ruff-format
13-
types_or: [python, pyi, jupyter]
6+
- repo: https://github.com/psf/black
7+
rev: 25.1.0
8+
hooks:
9+
- id: black
10+
types_or: [python, pyi]
11+
- repo: https://github.com/PyCQA/isort
12+
rev: 5.13.2
13+
hooks:
14+
- id: isort
15+
types_or: [python, pyi]
16+
- repo: https://github.com/PyCQA/flake8
17+
rev: 7.2.0
18+
hooks:
19+
- id: flake8
20+
types_or: [python, pyi]
21+
additional_dependencies:
22+
- flake8-bugbear
23+
- flake8-unused-arguments
24+
- flake8-print
25+
- flake8-type-checking
26+
- flake8-pyproject

CLAUDE.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Development Commands
66

7-
This project uses `uv` (a fast Python package manager) and Nix for development. Here are the essential commands:
7+
This project uses `poetry` for package management and Nix for development. Here are the essential commands:
88

9-
**Note**: Always run `uv sync` first to ensure dependencies are installed.
9+
**Note**: Always run `poetry install` first to ensure dependencies are installed.
1010

1111
### Running the Application
1212
```bash
13-
uv run pai
13+
poetry run pai
1414
```
1515

1616
### Testing
1717
```bash
1818
# Run all tests with coverage
1919
runTests # (Nix command)
2020
# or
21-
uv run pytest --cov=pai --cov-report=term-missing --cov-report=html
21+
poetry run pytest --cov=pai --cov-report=term-missing --cov-report=html
2222

2323
# Run a specific test
24-
uv run pytest tests/pai/test_main.py::test_specific_function
24+
poetry run pytest tests/pai/test_main.py::test_specific_function
2525
```
2626

2727
### Linting and Formatting
@@ -30,18 +30,20 @@ uv run pytest tests/pai/test_main.py::test_specific_function
3030
runLint
3131

3232
# Or individually:
33-
uv run ruff format src # Format code
34-
uv run ruff check --fix src # Lint and auto-fix
35-
pyrefly check # Type checking
33+
poetry run black src # Format code
34+
poetry run isort src # Sort imports
35+
poetry run flake8 src # Lint
36+
poetry run pyrefly check # Type checking
3637

3738
# Run pre-commit hooks
38-
pre-commit run --all-files
39+
poetry run pre-commit run --all-files
3940
```
4041

4142
### Dependency Management
4243
```bash
43-
uv sync # Install all dependencies
44-
uv pip install -e . # Install package in editable mode
44+
poetry install # Install all dependencies
45+
poetry add <package> # Add a production dependency
46+
poetry add --group dev <package> # Add a development dependency
4547
```
4648

4749
### CI/CD
@@ -56,12 +58,12 @@ The project includes GitHub Actions workflow that automatically:
5658
This is an AI-centric Python application with a clean, modular structure:
5759

5860
1. **Main Package**: `src/pai/` - The core application package ("Python AI")
59-
- Entry point: `src/pai/main.py:main` (accessed via `uv run pai`)
61+
- Entry point: `src/pai/main.py:main` (accessed via `poetry run pai`)
6062
- The main function logs initialization and returns a boolean status
6163

6264
2. **Configuration**: Modern Python project using:
6365
- `pyproject.toml` for all project metadata and dependencies
64-
- `uv.lock` for reproducible dependency management
66+
- `poetry.lock` for reproducible dependency management
6567
- Nix flakes for development environment consistency
6668

6769
3. **Key Architectural Patterns**:
@@ -85,13 +87,13 @@ nix develop
8587

8688
The environment includes:
8789
- Python 3.13
88-
- All development tools (ruff, pytest, pyrefly, etc.)
90+
- All development tools (black, isort, flake8, pytest, pyrefly, etc.)
8991
- Pre-configured pre-commit hooks
9092
- Environment file support (`.env`, `.test.env`, `.deploy.env`)
9193

9294
## Code Quality Standards
9395

94-
- **Line Length**: 120 characters (Ruff configuration)
95-
- **Type Checking**: Both Basedpyright and Pyrefly must pass
96+
- **Line Length**: 120 characters (black/flake8 configuration)
97+
- **Type Checking**: Pyrefly must pass
9698
- **Test Coverage**: Maintain test coverage with parallel structure in `tests/`
9799
- **Pre-commit**: All hooks must pass before commits

README.md

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ A modern GitHub template for starting AI-centric Python projects with batteries
99
This template provides a complete development environment for AI/ML applications with:
1010

1111
- **AI/ML SDKs**: Pre-configured with Anthropic, OpenAI, Hugging Face, and MCP (Model Context Protocol) SDKs
12-
- **Modern Python tooling**: Uses `uv` for blazing-fast package management
12+
- **Modern Python tooling**: Uses `poetry` for package management
1313
- **Type safety**: Pyrefly for type checking
14-
- **Code quality**: Ruff for linting and formatting
14+
- **Code quality**: Black, isort, and Flake8 for formatting and linting
1515
- **HTTP client**: httpx for async HTTP operations
1616
- **Development environment**: Optional Nix flakes for reproducible environments
1717
- **Python 3.13**: Latest Python version support
@@ -21,7 +21,7 @@ This template provides a complete development environment for AI/ML applications
2121
### Prerequisites
2222

2323
- Python 3.13+
24-
- [uv](https://github.com/astral-sh/uv) (Python package manager)
24+
- [Poetry](https://python-poetry.org/) (Python package manager)
2525
- [Nix](https://nixos.org/download.html) (optional, for development environment)
2626
- [direnv](https://direnv.net/) (optional, for automatic environment activation)
2727

@@ -42,61 +42,50 @@ This template provides a complete development environment for AI/ML applications
4242

4343
3. The Nix environment will automatically provide:
4444
- Python 3.13
45-
- All development tools (uv, ruff, pyrefly, etc.)
45+
- All development tools (poetry, black, isort, flake8, pyrefly, etc.)
4646
- Pre-commit hooks
4747

4848
#### Option 2: Without Nix (You already have Python)
4949

5050
1. Ensure Python 3.13+ is installed
51-
2. Install uv:
51+
2. Install Poetry:
5252
```bash
53-
pip install uv
53+
pip install poetry
5454
```
5555
3. Install dependencies:
5656
```bash
57-
uv sync
58-
```
59-
60-
#### Option 3: Using uv
61-
62-
1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
63-
2. Install Python using uv:
64-
```bash
65-
uv python install 3.13
66-
```
67-
3. Install dependencies:
68-
```bash
69-
uv sync
57+
poetry install
7058
```
7159

7260
### Development Commands
7361

7462
#### Running the Application
7563
```bash
76-
uv run pai
64+
poetry run pai
7765
```
7866

7967
#### Testing
8068
```bash
8169
# Using Nix command
8270
runTests
8371

84-
# Or directly with uv
85-
uv run pytest --cov=pai --cov-report=term-missing --cov-report=html
72+
# Or directly with poetry
73+
poetry run pytest --cov=pai --cov-report=term-missing --cov-report=html
8674

8775
# Run specific tests
88-
uv run pytest tests/pai/test_main.py::test_specific_function
76+
poetry run pytest tests/pai/test_main.py::test_specific_function
8977
```
9078

9179
#### Linting and Formatting
9280
```bash
9381
# Using Nix command
9482
runLint
9583

96-
# Or individually with uv
97-
uv run ruff format src # Format code
98-
uv run ruff check --fix src # Lint and auto-fix
99-
pyrefly check # Type checking
84+
# Or individually with poetry
85+
poetry run black src # Format code
86+
poetry run isort src # Sort imports
87+
poetry run flake8 src # Lint
88+
poetry run pyrefly check # Type checking
10089
```
10190

10291
#### Pre-commit Hooks
@@ -129,18 +118,18 @@ Core dependencies included:
129118

130119
1. **Make changes** to code in `src/pai/`
131120
2. **Write tests** in `tests/` mirroring the source structure
132-
3. **Run linting** with `runLint` or `uv run ruff check src`
133-
4. **Run tests** with `runTests` or `uv run pytest`
121+
3. **Run linting** with `runLint` or `poetry run flake8 src`
122+
4. **Run tests** with `runTests` or `poetry run pytest`
134123
5. **Commit** - pre-commit hooks will run automatically
135124

136125
## Adding Dependencies
137126

138127
```bash
139128
# Add a production dependency
140-
uv add <package-name>
129+
poetry add <package-name>
141130

142131
# Add a development dependency
143-
uv add --dev <package-name>
132+
poetry add --group dev <package-name>
144133
```
145134

146135
## Type Checking

devshell.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,21 @@ package = "python313"
55

66
[devshell]
77
packages = [
8-
"pyrefly",
9-
"uv"
8+
"poetry"
109
]
1110

1211
[[commands]]
1312
name = "runLint"
1413
category = "development"
1514
help = "Run the linter and formatter"
1615
command = """\
17-
uv run ruff format src && uv run ruff check --fix src && pyrefly check
16+
poetry run black src && poetry run isort src && poetry run flake8 src && poetry run pyrefly check
1817
"""
1918

2019
[[commands]]
2120
name = "runTests"
2221
category = "development"
2322
help = "Run the tests"
2423
command = """\
25-
uv run pytest --cov=pai --cov-report=term-missing --cov-report=html
24+
poetry run pytest --cov=pai --cov-report=term-missing --cov-report=html
2625
"""

flake.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)