Add pyproject.toml packaging and pytest suite

- pyproject.toml: setuptools build, deps (requests), dev extra (pytest),
  pytest config with opt-in `live` marker
- tests/: 95 offline tests locking every series-ID encoding against
  known-good IDs (regression guard for the JOLTS/OES/ECI/productivity/QCEW
  fixes), plus a live API smoke test behind `-m live`
- README: install-as-package + test instructions; drop the now-resolved
  "no packaging"/"no tests" limitations
- gitignore build/test artifacts

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 09:53:37 -04:00
parent 4fe734381e
commit 881d62cf32
7 changed files with 305 additions and 4 deletions

View File

@ -26,6 +26,8 @@ All 82 zero-argument query helpers are verified against the live API.
```bash
pip install -r requirements.txt # just `requests`
# or install the package itself (editable):
pip install -e .
```
## Configure your API key
@ -48,6 +50,14 @@ python3 examples/basic_pull.py # payrolls, CPI dashboard, DC-region unem
python3 examples/custom_series.py # building custom series IDs
```
## Tests
```bash
pip install -e ".[dev]" # pytest
pytest # offline: 95 tests locking the series-ID encodings
pytest -m live # also hit the live API (needs network + BLS_API_KEY)
```
---
## What's in the box
@ -100,10 +110,6 @@ for the series-ID decode tables.
benefits totals are currently exposed.
- **No caching / rate-limit handling.** Repeated runs spend against the 500/day quota; a
small on-disk cache and a friendly error on `REQUEST_NOT_PROCESSED` (quota hit) would help.
- **No packaging.** Importable in-tree but not `pip install`-able; add a `pyproject.toml`
to ship it as a real package.
- **No automated tests.** A pytest suite asserting builder outputs against known-good IDs
(and a live smoke test behind a marker) would lock the series-ID encodings in place.
---