File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # GUARDRAILS.md — RyanData-Address-Utils
2+ <!-- Version: 1.0.0 | Maintainer: John Eakin -->
3+
4+ ## Always
5+
6+ - Add type hints to all function signatures
7+ - Format with ` ruff format ` before committing
8+ - Write or update tests for every code change
9+ - Use structured logging (` logging ` module) — never ` print() `
10+ - Raise domain errors (` RyanDataAddressError ` , ` RyanDataValidationError ` )
11+
12+ ## Ask First
13+
14+ - Adding a new package dependency
15+ - Changing a Pydantic model field (may break downstream consumers)
16+ - Changing the public API in ` __init__.py `
17+ - Altering shapefile schema or PISD boundary logic
18+
19+ ## Never
20+
21+ - Store secrets, tokens, or credentials in source code
22+ - Use bare ` except: ` without specifying the exception type
23+ - Commit ` .env ` files or production data files
24+ - Use ` print() ` as a substitute for logging
25+ - Access ` src/pisd_shape/data/ ` files outside the ` pisd_shape ` module
26+
27+ ## Data Sensitivity
28+
29+ - Voter file data and shapefiles are ** not** committed to git
30+ - Test fixtures use synthetic or publicly available data only
31+ - Production data paths are configured via environment variables
Original file line number Diff line number Diff line change 1+ # RUNBOOK.md — RyanData-Address-Utils
2+ <!-- Version: 1.0.0 | Maintainer: John Eakin -->
3+
4+ ## Setup
5+
6+ ``` bash
7+ git clone < repo>
8+ cd RyanData-Address-Utils
9+ uv sync
10+ uv run pytest # verify install
11+ ```
12+
13+ ## Common Operations
14+
15+ ### Parse a batch of addresses
16+
17+ ``` python
18+ from ryandata_address_utils import AddressService
19+ service = AddressService()
20+ result = service.parse(" 123 Main St, Plano TX 75023" )
21+ ```
22+
23+ ### Parse a DataFrame column
24+
25+ ``` python
26+ df = service.parse_dataframe(df, address_col = " RES_STREET" , prefix = " addr_" )
27+ ```
28+
29+ ### Run PISD shapefile extraction
30+
31+ ``` bash
32+ cd src/pisd_shape
33+ uv run python -m pisd_shape.main
34+ ```
35+
36+ ## Linting & Formatting
37+
38+ ``` bash
39+ uv run ruff check src tests # lint
40+ uv run ruff format src tests # format
41+ uv run mypy src # type check
42+ ```
43+
44+ ## Dependency Updates
45+
46+ ``` bash
47+ uv lock --upgrade # update lock file
48+ uv sync # reinstall
49+ uv run pytest # verify nothing broke
50+ ```
51+
52+ ## Troubleshooting
53+
54+ | Symptom | Fix |
55+ | ---------| -----|
56+ | ` ModuleNotFoundError ` | Run ` uv sync ` |
57+ | Parser returns ` None ` | Check address format; try ` usaddress ` backend |
58+ | Shapefile import fails | Ensure ` geopandas ` extras installed: ` uv sync --extra geo ` |
Original file line number Diff line number Diff line change 1+ # TESTING.md — RyanData-Address-Utils
2+ <!-- Version: 1.0.0 | Maintainer: John Eakin -->
3+
4+ ## Framework
5+
6+ - ** Runner:** pytest
7+ - ** Property-based:** Hypothesis
8+ - ** Coverage target:** 80%+ (src/)
9+
10+ ## Commands
11+
12+ ``` bash
13+ uv run pytest # all tests
14+ uv run pytest --cov=src # with coverage
15+ uv run pytest -x # stop on first failure
16+ uv run pytest -k " test_parse" # filter by name
17+ uv run pytest tests/unit/ # unit tests only
18+ uv run pytest tests/property/ # Hypothesis tests only
19+ ```
20+
21+ ## Test Layout
22+
23+ ```
24+ tests/
25+ ├── unit/ # Pure unit tests — no I/O, no network
26+ ├── integration/ # Tests that hit the filesystem or pandas
27+ ├── property/ # Hypothesis property-based tests
28+ └── conftest.py # Shared fixtures
29+ ```
30+
31+ ## Test Standards
32+
33+ - Every public function has at least one unit test
34+ - Parsers and validators get Hypothesis ` @given ` tests
35+ - Fixtures live in ` conftest.py ` , not in test files
36+ - No ` print() ` — use ` caplog ` or ` capsys `
37+ - Mock external I/O at the boundary (file reads, HTTP)
38+
39+ ## CI
40+
41+ Tests run automatically on every PR via GitHub Actions.
42+ All checks must pass before merge.
You can’t perform that action at this time.
0 commit comments