Skip to content

docs(fmp-py): add runnable usage examples with strict type-checking - #412

Merged
benbenbang merged 6 commits into
mainfrom
docs/fmp-py-examples
Oct 4, 2026
Merged

benbenbang merged 6 commits into
mainfrom
docs/fmp-py-examples

Conversation

@benbenbang

@benbenbang benbenbang commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

The fmp-py SDK lacked runnable, discoverable examples demonstrating common client workflows. This change adds a documented examples directory covering the main usage patterns and wires it into both the README and the test suite to keep the scripts accurate over time.

  • Add example scripts covering quickstart, authentication, error handling, timeouts and response-size limits, nullable fields, client lifecycle and threading, bulk CSV, binary/XLSX payloads with dict conversion, and pagination, plus a local server helper.
  • Document the examples with a dedicated README and link them from the crate's main README, and include a pyproject.toml for running them.
  • Add a strict mypy test that type-checks the examples against the shipped stubs.
  • Ignore the generated uv.lock so examples resolve against the latest published release.

Add runnable example scripts demonstrating common fmp-py usage patterns.

* Added `examples/auth.py` showing authentication setup.
* Added `examples/errors.py` illustrating error handling.
* Added `examples/timeouts_and_limits.py` covering timeouts and response-size limits.
* Added `examples/_local_server.py` as a supporting helper for the examples.
Add runnable example scripts demonstrating the main client workflows:

* quickstart: minimal setup and first requests to get started quickly.
* nullable_fields: handling optional and null-valued response fields.
* lifecycle_and_threads: client lifecycle management and thread fan-out
  for concurrent requests.
* bulk: fetching bulk data as CSV.
* binary_and_dicts: working with XLSX binary payloads and converting
  responses via to_dict.
* pagination: iterating through paginated endpoints.
Add an Examples section to the README pointing to the new examples
directory, and include a README and pyproject.toml for the examples so
the runnable scripts cover auth modes, timeouts and bulk limits, error
handling, threads, bulk CSV, binary downloads, and pagination.
Add a new test that runs the `examples/` scripts through `mypy --strict`
against the shipped stubs, alongside the existing static contract check.

**Testing Improvements:**
* Added `test_examples_pass_strict_mypy` in `tests/test_stubs.py` to verify the runnable scripts under `examples/` type-check cleanly in strict mode.
* Introduced an `EXAMPLES` path pointing at the crate's `examples/` directory, resolved relative to the test file.
* Updated the module docstring to note that `mypy` now also checks the `examples/` scripts in strict mode against the same stubs.
@benbenbang
benbenbang enabled auto-merge (rebase) October 3, 2026 14:41
@github-actions github-actions Bot added documentation Improvements or additions to documentation enhancement New feature or request build labels Oct 3, 2026
@benbenbang benbenbang changed the title docs(fmp-py): add runnable examples and type-check them under strict mypy docs(fmp-py): add runnable usage examples with strict type-checking Oct 3, 2026
@benbenbang
benbenbang force-pushed the docs/fmp-py-examples branch from 8cbc985 to cc37650 Compare October 4, 2026 01:08
@github-actions github-actions Bot added the workflows ci/cd, configs relative label Oct 4, 2026
@benbenbang
benbenbang disabled auto-merge October 4, 2026 01:12
Add a .gitignore in crates/fmp-py/examples to exclude the uv.lock file
that `uv run` generates there, keeping it out of version control.
Add negated path filters for example directories to the pull_request
and push triggers, preventing the go-sdk workflow from running when
only example code under crates/fmp-py, sdk/go, or sdk/node changes.
@benbenbang
benbenbang force-pushed the docs/fmp-py-examples branch from 919d058 to a6f8820 Compare October 4, 2026 01:23
@benbenbang
benbenbang enabled auto-merge (rebase) October 4, 2026 01:24
@benbenbang
benbenbang merged commit 297c548 into main Oct 4, 2026
9 checks passed
@benbenbang
benbenbang deleted the docs/fmp-py-examples branch October 4, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build documentation Improvements or additions to documentation enhancement New feature or request workflows ci/cd, configs relative

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant