Skip to content

Stability and deprecation

What is public

The public API is what a program or a config file can rely on from one release to the next:

  • The Python names on the API reference page: those exported by trading itself, and the classes, functions and modules listed there.
  • The command line: the trading command, its subcommands, options and exit codes, and the JSON its --json options print.
  • The config file format: every key in the configuration reference, with its meaning and default.
  • The study file format read by trading study.

Everything else is internal and may change in any release: modules and names not on the API reference page, names that start with an underscore, the text of log lines and reports (parse --json instead), and the SQLite schema. Databases written by older versions stay readable: the schema is versioned and migrated in place.

Versions

Releases follow semantic versioning from 1.0.0:

Release May contain
Patch (1.0.1) Fixes only. A fix that changes results, such as an accounting correction, is called out in the changelog
Minor (1.1.0) New features, and deprecations. Code and configs that worked keep working
Major (2.0.0) Removals of deprecated API, and other incompatible changes, each listed in the changelog

Before 1.0.0, minor releases (0.3 to 0.4) could change the API, with every change listed in the changelog.

Backtest results are part of the contract too: the same config, data and version give the same numbers. A release that changes the numbers for an unchanged config, by fixing a bug or modelling costs differently, says so in the changelog.

Deprecation policy

Nothing public is removed without warning:

  1. Announce. The deprecated name, option or config key keeps working and emits a warning that names its replacement: a DeprecationWarning from Python, a warning on stderr from the command line or when a config file is read. The changelog lists it under Deprecated, and the API reference marks it.
  2. Wait. It stays for at least one minor release and at least six months, whichever is longer.
  3. Remove it in the next major release, listed under Removed in the changelog.

A security fix may skip the wait when keeping the old behaviour would be unsafe; its changelog entry says so.

Running your tests with warnings as errors (python -W error::DeprecationWarning, or filterwarnings = ["error"] in pytest) turns a deprecation into a failing test the day you upgrade, long before the removal.

Supported Python versions

Each release supports the Python versions that CI tests it on, currently 3.11 to 3.14. A Python version is dropped no sooner than its end of life, and only in a minor or major release.