Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ subspecifications that the Lean Ethereum protocol relies on.

### Running Tests
```bash
# Sync all dependencies and install packages
uv sync --all-extras
# Install and sync project and dev dependencies
uv sync

# Run all tests
uv run pytest
Expand All @@ -42,10 +42,10 @@ uv run ruff check --fix src tests
uv run mypy src tests

# Run all quality checks (lint, typecheck, spellcheck)
uv run tox -e all-checks
uvx tox -e all-checks

# Run everything (all checks + tests + docs)
uv run tox
uvx tox
```

### Common Tasks
Expand Down Expand Up @@ -81,18 +81,18 @@ uv run tox

## Common Commands Reference

| Task | Command |
|----------------------------------------|-------------------------------------|
| Install dependencies | `uv sync --all-extras` |
| Run tests | `uv run pytest` |
| Format code | `uv run ruff format src tests` |
| Lint code | `uv run ruff check src tests` |
| Fix lint errors | `uv run ruff check --fix src tests` |
| Type check | `uv run mypy src tests` |
| Build docs | `uv run mkdocs build` |
| Serve docs | `uv run mkdocs serve` |
| Run all quality checks (no tests/docs) | `uv run tox -e all-checks` |
| Run everything (checks + tests + docs) | `uv run tox` |
| Task | Command |
|-----------------------------------------------|----------------------------------|
| Install and sync project and dev dependencies | `uv sync` |
| Run tests | `uv run pytest` |
| Format code | `uv run ruff format src tests` |
| Lint code | `uv run ruff check src tests` |
| Fix lint errors | `uv run ruff check --fix src tests` |
| Type check | `uv run mypy src tests` |
| Build docs | `uv run mkdocs build` |
| Serve docs | `uv run mkdocs serve` |
| Run all quality checks (no tests/docs) | `uvx tox -e all-checks` |
| Run everything (checks + tests + docs) | `uvx tox` |

## Important Notes

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
## Quick Start

1. Fork and clone the repository
2. Install dependencies: `uv sync --all-extras`
2. Install dependencies: `uv sync`
3. Make your changes
4. Run checks: `uv run tox -e all-checks`
4. Run checks: `uvx tox -e all-checks`
5. Run tests: `uv run pytest`
6. Submit a pull request

Expand All @@ -22,7 +22,7 @@
- **Type hints**: Required for all functions and methods
- **Docstrings**: Use Google style for public APIs
- **Line length**: 79 characters (enforced by ruff)
- **Formatting**: Run `uv run tox -e fix` to auto-format
- **Formatting**: Run `uvx tox -e fix` to auto-format

## Adding New Subspecifications

Expand Down
73 changes: 24 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ uv python install 3.12
git clone https://github.com/leanEthereum/leanSpec leanSpec
cd leanSpec

# Install dependencies
uv sync --all-extras
# Install and sync project and dev dependencies, using `uv.lock` versions
uv sync

# Run tests to verify setup
uv run pytest
Expand Down Expand Up @@ -61,11 +61,8 @@ uv run pytest
### Workspace Commands

```bash
# Install package and required dependencies or re-sync workspace
# Install package and dev dependencies or re-sync workspace
uv sync

# Install package along with all dependencies, including optional / extras
uv sync --all-extras
```

## Development Workflow
Expand Down Expand Up @@ -104,30 +101,17 @@ uv run mypy src tests

### Using Tox for Comprehensive Checks

After running `uv sync --all-extras`, you can use tox with `uv run`:

```bash
# Run all quality checks (lint, typecheck, spellcheck)
uv run tox -e all-checks

# Run all tox environments (all checks + tests + docs)
uv run tox

# Run specific environment
uv run tox -e lint
```

**Alternative: Using uvx (no setup required)**

If you haven't run `uv sync --all-extras` or want to use tox in isolation,
you can use `uvx`, which:

* Creates a temporary environment just for tox
You can use `tox` with `uvx`, which:
* Creates a temporary environment just for `tox`
* Doesn't require `uv sync` first
* Uses tox-uv for faster dependency installation
* Uses `tox-uv` for faster dependency installation

```bash
# Run specific environment, like "all quality checks" (lint, typecheck, spellcheck)
uvx tox -e all-checks

# Run all tox environments (all checks + tests + docs)
uvx tox
```

### Documentation
Expand Down Expand Up @@ -186,33 +170,24 @@ def test_withdrawal_amount_above_uint64_max():
- **uv**: Fast Python package manager - like npm/yarn but for Python
- **ruff**: Linter and formatter
- **mypy**: Type checker that works with Pydantic models
- **tox**: Automation tool for running tests across multiple environments
- **tox**: Automation tool for running tests across multiple environments (used via `uvx`)
- **mkdocs**: Documentation generator - write docs in Markdown, serve them locally

## Common Commands Reference

| Task | Command |
|----------------------------------------|-------------------------------------|
| Install dependencies | `uv sync --all-extras` |
| Run tests | `uv run pytest` |
| Format code | `uv run ruff format src tests` |
| Lint code | `uv run ruff check src tests` |
| Fix lint errors | `uv run ruff check --fix src tests` |
| Type check | `uv run mypy src tests` |
| Build docs | `uv run mkdocs build` |
| Serve docs | `uv run mkdocs serve` |
| Run all quality checks (no tests/docs) | `uv run tox -e all-checks` |
| Run everything (checks + tests + docs) | `uv run tox` |
| Run specific tox environment | `uv run tox -e lint` |

If you have not run `uv sync --all-extras` or want to use `tox` in isolation,
you can use `uvx`:

| Task | Command |
|-----------------------------------------|---------------------------------------|
| Run all quality checks (no tests/docs) | `uvx tox -e all-checks` |
| Run everything (checks + tests + docs) | `uvx tox` |
| Run specific tox environment | `uvx tox -e lint` |
| Task | Command |
|-----------------------------------------------|------------------------------------|
| Install and sync project and dev dependencies | `uv sync` |
| Run tests | `uv run pytest` |
| Format code | `uv run ruff format src tests` |
| Lint code | `uv run ruff check src tests` |
| Fix lint errors | `uv run ruff check --fix src tests` |
| Type check | `uv run mypy src tests` |
| Build docs | `uv run mkdocs build` |
| Serve docs | `uv run mkdocs serve` |
| Run all quality checks (no tests/docs) | `uvx tox -e all-checks` |
| Run everything (checks + tests + docs) | `uvx tox` |
| Run specific tox environment | `uvx tox -e lint` |


## Contributing
Expand Down
41 changes: 21 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,6 @@ dependencies = ["pydantic>=2.12.0,<3", "typing-extensions>=4.4"]
[project.license]
file = "LICENSE"

[project.optional-dependencies]
test = ["pytest>=8.3.3,<9", "pytest-cov>=6.0.0,<7", "pytest-xdist>=3.6.1,<4", "hypothesis>=6.138.14"]
lint = ["ruff>=0.11.8,<1"]
typecheck = ["mypy>=1.15.0,<1.16"]
docs = [
"mkdocs>=1.6.1,<2",
"mkdocs-material>=9.5.45,<10",
"mkdocstrings[python]>=0.27.0,<1",
"codespell>=2.4.1,<3",
"pyspelling>=2.8.2,<3",
]
dev = ["lean-spec[test,lint,typecheck,docs]", "tox>=4.23.0,<5", "tox-uv>=1.29.0"]
mdformat = [
"mdformat-gfm-alerts==2.0.0",
"mdformat-gfm==0.4.1",
"mdformat-ruff==0.1.3",
"mdformat-toc==0.3.0",
"mdformat==0.7.22",
]

[project.urls]
Homepage = "https://github.com/leanEthereum/lean-spec"
Source = "https://github.com/leanEthereum/lean-spec"
Expand Down Expand Up @@ -122,9 +102,30 @@ wrap = 80

[dependency-groups]
dev = [
# debugging / convenience
"ipython>=8.31.0,<9",
"ipdb>=0.13",
"tomli-w>=1.0.0",
# packaging
"build>=1.2.0,<2",
"twine>=5.1.0,<6",
# test dependencies
"pytest>=8.3.3,<9",
"pytest-cov>=6.0.0,<7",
"pytest-xdist>=3.6.1,<4",
"hypothesis>=6.138.14",
# docs
"mkdocs>=1.6.1,<2",
"mkdocs-material>=9.5.45,<10",
"mkdocstrings[python]>=0.27.0,<1",
"pyspelling>=2.8.2,<3",
"mdformat-gfm-alerts==2.0.0",
"mdformat-gfm==0.4.1",
"mdformat-ruff==0.1.3",
"mdformat-toc==0.3.0",
"mdformat==0.7.22",
# dev
"ruff>=0.11.8,<1",
"mypy>=1.15.0,<1.16",
"codespell>=2.4.1,<3",
]
19 changes: 2 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tox]
min_version = 4.0
requires =
tox >=4.23.0,<5
tox-uv >=1.29
env_list =
all-checks
Expand All @@ -12,15 +13,10 @@ runner = uv-venv-lock-runner
[testenv]
basepython = python3.14
uv_python = >=3.12
dependency_groups = dev

[testenv:all-checks]
description = Run all quality checks (lint, typecheck, spellcheck, mdformat)
extras =
lint
typecheck
test
docs
mdformat
commands =
{[testenv:lint]commands}
{[testenv:typecheck]commands}
Expand All @@ -29,52 +25,41 @@ commands =

[testenv:lint]
description = Lint and code formatting checks (ruff)
extras = lint
commands =
ruff check --no-fix --show-fixes src tests
ruff format --check src tests

[testenv:fix]
description = Auto-fix linting and formatting issues (ruff)
extras = lint
commands =
ruff check --fix src tests
ruff format src tests

[testenv:typecheck]
description = Run type checking (mypy)
extras =
typecheck
test
commands = mypy src tests

[testenv:spellcheck]
description = Run spell checking (codespell)
extras = docs
commands = codespell src tests docs README.md CLAUDE.md --skip="*.lock,*.svg,.git,__pycache__,.mypy_cache,.pytest_cache" --ignore-words=.codespell-ignore-words.txt

[testenv:mdformat]
description = Check markdown formatting for docs (mdformat)
extras = mdformat
commands = mdformat docs/

[testenv:pytest]
description = Run tests (pytest)
extras = test
# parallelize with `auto` but keep max processes reasonable for CI
commands = pytest {posargs} tests -n auto --maxprocesses=10 --durations=10 --dist=worksteal

[testenv:pytest-cov]
description = Run tests with coverage (pytest)
extras = test
commands = pytest --cov --cov-report=html --cov-report=term {posargs}

[testenv:docs]
description = Serve documentation locally (mkdocs)
extras = docs
commands = mkdocs serve {posargs}

[testenv:docs-build]
description = Build documentation (mkdocs)
extras = docs
commands = mkdocs build {posargs}
Loading
Loading