Skip to content

About

PyPI-ready elliptic-curve databases for SageMath

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

sagemath-data-elliptic-curves

sagemath-data-elliptic-curves packages two small, read-only elliptic-curve databases historically distributed as SageMath's elliptic_curves package:

  • John Cremona's elliptic curves of conductor below 10,000, represented as a compact SQLite database; and
  • William Stein's collection of interesting elliptic curves, combined with the Cremona records and grouped into text files by rank.

The package has no dependency on SageMath. It exposes the data through importlib.resources, so consumers do not need to know where the wheel was installed.

Important

The legacy Sage distribution labels these datasets only as None (database) in COPYING.txt; the source archive does not contain a data-specific license. The exact license and redistribution terms must be confirmed with SageMath upstream and the named data authors before the first public PyPI release. See DATA_LICENSES.md.

Install

python -m pip install sagemath-data-elliptic-curves

The Python import name is sage_data_elliptic_curves.

Use

from sage_data_elliptic_curves import (
    available_ranks,
    cremona_mini_connection,
    iter_rank,
)

print(available_ranks())

record = next(iter_rank(3))
print(record.label, record.ainvs)

with cremona_mini_connection() as connection:
    row = connection.execute(
        "SELECT curve, eqn FROM t_curve WHERE curve = ?", ("11a1",)
    ).fetchone()
    print(row)

cremona_mini_resource() and rank_resource(rank) return standard importlib.resources traversables. For APIs that require filesystem paths, use the cremona_mini_path() and rank_path(rank) context managers; their paths are valid only while the corresponding context is active.

Regenerate the packaged data

The unmodified legacy inputs are retained under sources/. Regenerate all derived resources with:

python generate.py

Check that the committed resources are logically identical to a fresh generation without modifying them:

python generate.py --check

The SQLite comparison is logical rather than byte-for-byte because SQLite file layout can vary across SQLite releases.

Develop

python -m pip install -e '.[test]'
python generate.py --check
python -m pytest
python -m build

After the data terms are confirmed, publishing is performed only by the Release GitHub Actions workflow when a GitHub Release is published. The workflow checks the generated databases, builds and validates both distributions, smoke-tests the wheel in a clean environment, attaches the artifacts to that Release, and uses PyPI Trusted Publishing through the protected pypi environment. The Release tag must be 0.8.2 or v0.8.2. Configure the repository, release.yml workflow, and pypi environment as a PyPI Trusted Publisher before publishing the first Release.

For the new PyPI project, configure a pending Trusted Publisher with project sagemath-data-elliptic-curves, GitHub owner sagemath, repository data-elliptic-curves, workflow filename release.yml, and environment pypi.

About

PyPI-ready elliptic-curve databases for SageMath

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages