API migration matrix#
This page is the cumulative migration matrix for the structural reform tracked in Issue #165 and the concise publication API tracked in Issue #183. It maps the historical 0.3 API, the pre-concise 0.4 baseline, and the currently implemented concise contract that is intended to stabilize through 1.x. The runtime, generated API index, and inventory command remain the authority for merged behavior; unmerged roadmap work is not described as available.
Compatibility policy#
The canonical API is available from
import gsplot as gs.The reform targets the 0.4.x compatibility line and the 1.x stabilization line. Legacy root calls and documented legacy module imports remain forwarding-only adapters throughout those lines.
Candidate removal of legacy adapters is a separate decision for a future major release, no earlier than 2.0, after downstream usage has been audited.
The primary concise surface is additive during 1.x. Existing advanced canonical functions, types, exceptions, legacy root forms, and documented compatibility modules remain importable through that line.
The old
gsplot.base.*implementation namespace is not a supported public compatibility surface unless it was part of the pre-cutover API reference.A compatibility adapter may normalize old arguments, but canonical modules must never import the compatibility layer or contain duplicate algorithms.
A documented historical module’s declared functions resolve to the same reviewed adapters as the root names. Compatibility-only implementation classes may remain reachable from their historical modules, but they are not canonical exports and cannot replace the root adapter for a documented function.
Effective default-value matrix#
Signature compatibility alone is not sufficient for plotting APIs. The following matrix records the effective defaults during the compatibility window.
Surface |
Historical 0.3 |
Pre-concise 0.4 baseline |
Current 0.4 / 1.x contract |
|---|---|---|---|
Figure size |
5 x 5 in |
Matplotlib default unless explicit |
|
Layout |
tight |
none unless explicit |
constrained for a new Figure; preserve a reused Figure |
Reused-Figure clearing |
true |
false |
false |
Style ownership |
process-global import/config effects |
ambient or explicit target helpers |
target-local |
Line defaults |
marker |
preserved by the root helper |
preserved by concise |
Scatter defaults |
marker |
preserved by the root helper |
preserved by concise |
Option-free color |
historical shared viridis sequence |
compatibility-dependent root sequence |
target Axes cycle; pure |
Labels |
minor ticks, 5 pt pad, incidental relayout |
concise |
minor ticks and 5 pt pad, no Figure relayout |
Panel indexes |
lowercase labels positioned from rendered bounds |
concise |
lowercase bijective labels; outside aligns to the y-label left edge with a 6-point top gap |
Legend |
ambient/config placement ( |
explicit options with conservative replacement |
explicit |
Inset zoom |
two explicit connector corner pairs |
advanced placement only |
automatic or exact two-pair connectors; indicator defaults 0.01 below child z-order 5 |
Text read |
comma delimiter, unpacked columns |
explicit options mapping; structured unpack was coerced |
comma delimiter and unpack true; native structured field arrays preserved |
Save |
PNG+PDF, 600 DPI, tight crop, show, overwrite |
conservative |
transactional |
Display |
coupled to historical save/store flow |
|
explicit Figure/same-Figure Axes, no-op on non-interactive backend |
Config |
implicit legacy JSON/singleton |
explicit immutable schema 1 |
explicit immutable schema 2; schema 1 translates through 1.x |
Import |
changed |
side-effect-light |
side-effect-light |
The historical shared color counter has been removed from ordinary root and
canonical line and scatter calls; they use the corresponding property
cycle of each target Axes unless an explicit color, Config color, or
deterministic series=0..9 identity is supplied. Axes returned by the
deprecated gs.axes() adapter alone retain the shared five-color sequence in
weak compatibility state. The compatibility store flag remains isolated at
the root adapter boundary. Removing import-time Matplotlib rcParams mutation
is also intentional; ambient Matplotlib defaults apply unless an application
configures them explicitly.
Implemented concise root migration#
The implemented primary concise surface is:
subplots inset line scatter colors label index square
legend paper save show read
Current 0.4 surface |
Concise target |
1.x classification and contract |
|---|---|---|
|
|
additive shape, auto-size, layout, style, and schema-2 support; native return retained |
|
|
concise tuple/ |
|
same names |
additive direct finite options, multi-target preflight, and deterministic |
|
|
concise inclusive sampler with midpoint for one color; advanced value normalization API retained |
|
|
new concise records/shared-value operation; typed advanced API retained |
|
|
concise finite-aspect spelling; advanced helper retained |
|
|
concise lowercase labels with DPI-aware inside clearance and y-label-aligned outside placement; advanced helper retained |
|
|
additive direct finite paper defaults and multi-target semantics |
|
unchanged advanced APIs |
retained through 1.x |
|
|
|
|
unchanged advanced APIs |
retained; concise |
|
|
concise transactional historical workflow added; conservative advanced API retained |
|
|
display-only ownership retained and generalized to same-Figure Axes targets |
|
|
CSV and unpack defaults plus finite common NumPy options; native ndarray-or-field-list result and options-mapping API retained |
|
|
explicit loading retained; schema 2 becomes canonical |
|
unchanged advanced APIs |
retained through 1.x |
|
unchanged advanced APIs |
retained through 1.x |
Public boundary inventory#
The compatibility audit freezes the following finite surfaces. Counts are acceptance checks, not a substitute for reviewing the names in the JSON inventory.
Boundary |
Count |
Source and enforcement |
|---|---|---|
Canonical root |
67 |
Must equal the lazy canonical manifest, static canonical exports, and canonical autosummary index. |
Historical v0.3 root |
41 |
Frozen from tag |
Historical direct root attributes outside |
5 |
|
Lazy legacy manifest |
44 |
The 41 historical discoverable names plus shadowed |
Direct metadata attributes |
2 |
|
Documented historical modules |
20 |
Frozen module paths and each module’s ordered |
Every canonical function has a finite annotated runtime signature, an
annotated return, no visible omission sentinel, and no **kwargs in the
primary introspection view. The overlapping line, scatter, label,
legend, title, and show adapters also have finite implementation binders;
their concise signatures cannot conceal a generic compatibility keyword bag.
Type aliases are inventoried as type aliases rather than misleading callable
signatures. The generated root API pages are the detailed signature and return
reference; the tables on this page classify every changed or retained surface.
Line and scatter advanced option table#
The primary introspection and API reference show only the concise parameters.
The following finite long spellings remain directly accepted through 1.x; the
same fields may be supplied through props, but one field cannot be supplied
both directly and through props. The short/long pairs c/color,
ms/markersize, mew/markeredgewidth, mec/markeredgecolor,
mfc/markerfacecolor, ls/linestyle, lw/linewidth, and s/size
are aliases and cannot be combined in one call.
Operation |
Retained finite direct options beyond the concise view |
|---|---|
|
|
|
|
For line, alpha is materialized independently into the line and marker-edge
RGBA colors. Marker-face RGBA uses alpha * alpha_mfc; the Artist-level
Line2D.alpha remains unset so Matplotlib cannot override that independent
face transparency during rendering. This matches the 0.3 visual contract.
For multiple targets, one x/y pair broadcasts. Per-target x/y always uses an
exact-key mapping. Numeric and text style sequences may follow target order;
colors and other sequence-valued scalar styles use exact-key mappings to avoid
shape guessing. A retained Matplotlib scatter c value array remains a single
dataset-level advanced value rather than a per-target style sequence.
The public values Config, AxisSpec, Theme, InsetSpec,
MetadataSnapshot, BuildInfo, LegendEntries, MosaicSpec,
NormalizeSpec, and ColorSpec; all typed public exceptions; __version__;
and __commit__ remain governed by the compatibility policy. New shared type
aliases AxesTarget, PerTarget, LineStyle, Marker, Unit, SizePreset,
SizeSpec, LayoutMode, StyleMode, and ZoomCorners are additive and remain
valid on Python 3.10.
Configuration schema migration#
Canonical JSON loading remains explicit. Schema 1 is translated into a fresh immutable schema-2 value and emits one caller-facing migration warning; input files are never rewritten.
Schema-1 field |
Schema-2 field/value |
Translation and compatibility |
|---|---|---|
|
|
accepted through 1.x with one migration warning |
|
|
exact finite positive tuple in |
|
|
preserves the ambient Matplotlib size contract |
|
|
unchanged; schema 2 permits non-inch units only for tuple size |
|
|
unchanged boolean |
|
|
deterministic translation |
constrained true, |
|
deterministic translation |
both layout flags false or omitted |
|
deterministic translation |
both layout flags true |
no value |
remains |
|
same field |
unchanged; |
|
same field |
unchanged non-empty colormap name |
|
same field |
unchanged reviewed policy |
Config() changes from schema-1 Figure defaults (figsize=None, inch unit,
no layout) to schema-2 concise defaults (size="auto", inch unit,
squeeze=True, layout="auto"). Deprecated Config.figure.figsize,
tight_layout, and constrained_layout, plus equivalent Config.get()
lookups, remain through 1.x. The figsize view returns a tuple only for tuple
size and returns None for named presets or null; layout views report equality
with their named mode. Each deprecated read warns and never mutates Config.
Schema 2 adds no keys for paper style, line/scatter options, output paths, overwrite, display/close policy, series identity, arbitrary labels, metadata, backend selection, logging, or open Matplotlib property dictionaries.
Root export migration#
The classification uses these terms:
canonical: the spelling and ownership used by new code;
adapter: the old spelling remains callable and forwards to the canonical implementation;
breaking: new code must use a different name, ownership model, return contract, or configuration contract;
docs-only: retained as an explanatory example rather than as a supported runtime API.
0.3.x root name |
Reform target |
Classification |
Migration contract |
|---|---|---|---|
|
|
adapter + breaking return contract |
New code receives |
|
|
adapter + explicit ownership |
The parent |
|
|
adapter |
Advanced width/height placement uses |
|
|
adapter |
New code uses the Matplotlib figure directly; a compatibility helper may preserve the old convenience call. |
|
|
adapter + breaking behavior |
|
|
|
adapter + breaking signature |
Count sampling uses concise |
|
|
canonical name retained |
One or more explicit same-Figure Axes return a native |
|
|
adapter + breaking name |
The compatibility adapter preserves its one-item list return; canonical |
|
|
adapter + breaking name |
The compatibility adapter preserves its legacy list return; canonical |
|
|
canonical name retained |
One or more explicit same-Figure Axes return a native |
|
|
adapter + breaking name |
The target validates color data and returns a |
|
|
adapter + breaking name |
Aspect application is explicit and does not inspect a caller frame or global axes store. |
|
|
adapter |
The target accepts an explicit |
|
|
adapter + breaking name |
Theme application is explicit and does not mutate global |
|
|
adapter |
The target takes a |
|
|
adapter + breaking name |
Transparency is a named theme value rather than an implicit current-figure operation. |
|
|
adapter |
The target takes an explicit target. |
|
|
adapter + breaking name |
Figure ownership is explicit. |
|
|
adapter + explicit ownership |
An Axes target selects concise labels; historical record-only calls retain current-Figure behavior behind one warning. |
|
|
adapter + breaking ownership |
Panel targets and placement are explicit; the concise helper returns native |
|
|
adapter + breaking ownership |
The canonical call targets an explicit |
|
|
adapter |
The old explicit-Axes spelling forwards to the canonical explicit target form. |
|
|
canonical rename retained |
Handles, labels, handler maps, replacement, and properties are explicit. |
|
|
adapter + breaking name |
The target returns all legends on an explicit target. |
|
|
adapter |
Handler maps become local call arguments and are never global mutable state. |
|
|
adapter |
Reversal is an explicit |
|
|
adapter + breaking name |
The target returns a typed |
|
|
adapter + breaking name |
Colormap legend construction uses explicit handles, labels, and color mapping. |
|
|
adapter + breaking name |
The target has one explicit |
|
|
adapter + breaking name |
The target has one explicit |
|
|
adapter |
The target accepts explicit axes and an axis selector. |
|
|
adapter + breaking name |
Concise CSV loading has finite direct options; advanced options remain explicit and neither path changes the working directory. |
|
|
adapter |
The loader choice is explicit rather than encoded in a second public function. |
|
|
adapter + breaking name |
Loading is explicit and returns an immutable |
|
|
adapter + breaking ownership |
Configuration is a typed immutable value, not a mutable process-wide dictionary. |
|
|
adapter |
Accessors validate the schema and do not expose mutable global state. |
|
|
rejecting adapter + breaking ownership |
It warns and raises |
|
no canonical replacement |
compatibility-only |
New code uses |
|
no canonical replacement |
compatibility-only |
New code uses |
|
no canonical replacement |
compatibility-only |
New code owns its path explicitly. |
|
no canonical replacement |
deprecated adapter |
The compatibility call warns and is a no-op; the reform does not mutate the working directory. |
|
documentation example |
docs-only adapter |
The retained call warns and is a no-op; it is not part of the canonical scientific plotting API. |
|
|
canonical compatibility attribute |
The value comes from installed distribution metadata with a safe source-tree fallback. |
|
|
deprecating adapter |
The canonical build value is typed metadata; |
Lazy-only compatibility entries#
The lazy manifest also contains entries that are not part of root __all__
or normal interactive discovery:
Name |
Classification |
Contract |
|---|---|---|
|
shadowed legacy fallback |
Canonical resolution wins; the legacy target remains inventoried so a boundary rewrite cannot silently change precedence. |
|
rejecting deprecation adapter |
Warns and directs callers to explicit |
|
side-effect-free no-op adapter |
The root and historical module call warn and return |
Current canonical root manifest#
The implemented 0.4 root exports the following functions:
subplots inset inset_axes line scatter cmap_line cmap_dash cmap_scatter
colors sample_cmap label square index style_axes title suptitle minor_ticks
box_aspect panel_labels fig_facecolor legend legends legend_entries
cmap_legend set_theme save savefig show load_config read read_array write_meta
build_info use_backend
It also exports the following typed values and errors:
Config AxisSpec Theme InsetSpec MetadataSnapshot BuildInfo
LegendEntries GsplotError ConfigError DataError LayoutError PlotError
OutputError MetadataError
The stable aliases and protocols are MosaicSpec, NormalizeSpec,
ColorSpec, AxesTarget, PerTarget, LineStyle, Marker, Unit,
SizePreset, SizeSpec, LayoutMode, StyleMode, ZoomCorners, Limit,
Scale, TickSpec, LabelRecord, and LabelRecords. The canonical package
advertises py.typed and uses NumPy-style docstrings for every public function
and class.
Historical module migration#
The following module and symbol pages were part of the pre-cutover API reference. During the compatibility window their declared functions are forwarding-only shims to the same reviewed root adapters. Their old signatures may be accepted only at that adapter boundary; compatibility-only classes may remain available as fallback attributes, and new implementation code must not import either form.
Historical path |
Target area |
|---|---|
|
documentation example |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
path compatibility helpers only |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Check the complete reviewed contract with:
poetry run python tools/maintenance/check_public_api_contract.py
The command compares the runtime with the complete reviewed fixture in
tests/fixtures/reform/public-api-v1.json. After an intentional API review,
regenerate that fixture with the same command plus --update and inspect the
JSON diff before committing it. For ad hoc inspection,
tools/maintenance/collect_public_api.py remains read-only and prints the
same current inventory to standard output. The inventory separates root
__all__, lazy canonical targets, lazy legacy targets, type-checker exports,
API-index exports, typed kinds and signatures, direct metadata attributes,
structured parameter/default/annotation contracts, docstring summaries and
fingerprints, the frozen v0.3 baseline, and the actual exports of every
compatibility path parsed from this page. This makes hidden lazy names such as
save_metadata and logger reviewable without promoting them into the
concise API.
Warning and exception migration#
Valid canonical calls emit no compatibility warning. Importing a historical
module emits DeprecationWarning; a documented function from that module then
uses the same finite adapter as its root spelling. A legacy call form emits a
caller-facing DeprecationWarning, while ambiguous or mixed canonical/legacy
forms fail before current-Figure or compatibility state is consulted.
Type/binding ambiguity raises TypeError or OptionError; validated domain
failures use ConfigError, DataError, LayoutError, PlotError,
OutputError, or MetadataError as documented by the canonical operation.
The special save_metadata adapter warns and raises MetadataError; logger,
hello_world, and pwd_move warn and return without their removed side
effects.