This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Speasy ("Space Physics made EASY") is a Python library providing a unified API for accessing 70+ space physics missions and 65,000+ data products from multiple web services (AMDA, CDAWeb, CSA, SSCWeb, CDPP 3DView). Built with flit, requires Python >=3.9.
# Install in development mode
python -m pip install -e .
python -m pip install -r requirements_dev.txt
# Run tests
PYTHONPATH=. py.test # all tests
PYTHONPATH=. py.test tests/test_amda.py # single test file
PYTHONPATH=. py.test -k "test_name" # single test by name
# Lint
flake8 speasy tests --count --select=E9,F63,F7,F82 --show-source --statistics
# Doctests
make doctest
# Build
python -m build --sdist --wheelSPEASY_CORE_DISABLED_PROVIDERS— comma-separated list of providers to disable (defaults to "" in conftest.py)SPEASY_AMDA_USERNAME/SPEASY_AMDA_PASSWORD— AMDA credentialsSPEASY_LONG_TESTS— enable long-running testsSPEASY_INVENTORY_TESTS— enable inventory tests
speasy.get_data(product, start, stop) → core/requests_scheduling/request_dispatch.py → appropriate DataProvider subclass → raw data → SpeasyVariable / Catalog / Dataset / TimeTable
core/dataprovider.py—DataProviderbase class withget_data(),update_inventory(),build_inventory()core/requests_scheduling/request_dispatch.py— central dispatch routing products to providersdata_providers/— six provider implementations:amda,cda,csa,ssc,generic_archive,cdpp3dviewproducts/variable.py—SpeasyVariable, the main time-series container (~1000 lines, supports numpy ops, pandas conversion, plotting)products/— also containsCatalog,Event,Dataset,TimeTablecore/cache/— disk caching viadiskcache, request-level and provider-level caches, concurrent request deduplicationcore/codecs/— plugin architecture for format decoders (CDF/ISTP, HAPI CSV)inventories/— hierarchical (data_tree.<provider>.<category>.<product>) and flat inventory treesconfig/— env vars + INI file (~/.config/speasy/config.ini)
@Proxyfiable— marks methods as cacheable via upstream proxy server@Cacheable— local disk caching@ParameterRangeCheck— validates product time ranges
Subclass DataProvider in core/dataprovider.py, implement get_data() and inventory methods. Register in core/requests_scheduling/. See CONTRIBUTING.rst for the full guide including codec creation.
- Tests use
ddt(data-driven tests) for parameterized testing - Version tracked in
VERSIONfile, bumped withbumpversion(updates VERSION, pyproject.toml,__init__.py, docs/conf.py, CITATION.cff) - Flake8 rules: E9, F63, F7, F82 (strict); max-complexity=10, max-line-length=127 (warnings)
- Ruff configured only for
NPY201(numpy 2.0 deprecations)