Skip to content

feat(python): publish the chart statistics as the Python package ournotes-sim - #52

Merged
nichinichisou0609 merged 2 commits into
mainfrom
feat/python-package
Oct 13, 2026
Merged

nichinichisou0609 merged 2 commits into
mainfrom
feat/python-package

Conversation

@nichinichisou0609

Copy link
Copy Markdown
Contributor

Adds python/, the Python package ournotes-sim (module ournotes_sim), built with maturin as one abi3 wheel per platform.

API

  • chart_stats(data, seeds=None, workers=None, aptitude=True) -> str: the ournotes-deck.chart-stats/3 document of an nnnotes.deck-data/1 document, charts measured in parallel.
  • chart_stats_cached(..., *, cache_dir) -> (str, dict): the same document with the simulation programs kept in cache_dir, plus the cache counters.
  • info(): name, version, repository, sourceSha256, formats, and the release commit (None for other builds).
  • MASTER_TABLES: the master tables a deck data document holds.
  • Type stubs (_native.pyi) and py.typed.

Build and release

  • python/ is excluded from the workspace and has its own Cargo.lock; the release resolves and checks its version with the workspace version.
  • CI job python: fmt and clippy of the binding crate, then the wheel's tests on CPython 3.11 and 3.14 (scripts/release/smoke-python.py).
  • Release: a wheels job builds the five platform wheels with SOURCE_COMMIT compiled into info()["commit"] and tests each one on its platform; publish now also requires the python check; a pypi job checks the wheels with twine and publishes them through trusted publishing (environment pypi).
  • Wheels only: an sdist build would rewrite the ournotes-sim manifest and change sourceSha256.

Tests
python/tests run against the installed wheel on synthetic deck data documents (info fields, empty chart set with and without the cache, invalid data errors, version and licence consistency with the workspace).

nichinichisou0609 and others added 2 commits October 13, 2026 21:03
…otes-sim

python/ is the Python package ournotes-sim, a package outside the
workspace with its own lockfile. Its extension module
ournotes_sim._native runs the chart statistics of ournotes-sim on a
deck data document held in memory, the charts measured in parallel:

- chart_stats(data, seeds=None, workers=None, aptitude=True) returns
  the ournotes-deck.chart-stats/3 document of an nnnotes.deck-data/1
  document.
- chart_stats_cached(..., cache_dir=...) keeps the simulation programs
  in a directory and returns the cache counters with the same document.
- info() names the model: version, repository, sourceSha256, the
  formats it reads and writes, and the source commit of a release
  build (None for other builds).
- MASTER_TABLES lists the master tables a deck data document holds.

The package ships type stubs and py.typed. Its tests run on synthetic
deck data documents and check that the package version equals the
workspace version and that its licence files equal the repository's.

CI builds the wheel, tests it on CPython 3.11 and 3.14 and checks
formatting and lints of the binding crate. A release builds one abi3
wheel for each of the five release platforms with the release commit
compiled into info()["commit"], tests every wheel on its platform,
requires the new check before publishing the GitHub release, and
then publishes the wheels to PyPI through trusted publishing. The
package is published as wheels only, so every installation reports
the sourceSha256 of the release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…change the package

The wheel matrix moves to the reusable workflow wheels.yml. The release calls it with the release commit, and it also runs on pull requests that change python/, the wheel test script or the workflow itself, with the pull request's commit compiled into info()["commit"].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nichinichisou0609
nichinichisou0609 merged commit 572e16d into main Oct 13, 2026
11 checks passed
@nichinichisou0609
nichinichisou0609 deleted the feat/python-package branch October 19, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant