Skip to main content

msolveio

Strict Python I/O for msolve: canonical input, mode-required output. Gröbner-mode (-g) only in v0.1. Solver-mode bytes are rejected, not interpreted.

msolveio writes .ms files that msolve 0.10.x will parse the way you meant, and reads back only the one output language it can identify with certainty. It is not a CAS and not a Gröbner engine.

Install

pip install msolveio

You also need a system msolve 0.10.x binary on PATH (or pass binary=). msolveio has no runtime dependencies.

Usage

from msolveio import emit_system, parse_groebner, run_groebner, MsolveAmbiguous

source = emit_system(
    ["x^2+y", "x*y-1"],
    variables=["x", "y"],
    characteristic=0,
)

result = run_groebner(source, gb=2, timeout=60)

print(result.output.unit_ideal)  # False
print(result.output.basis)       # ('y^2+x', 'x*y-1', 'x^2+y')
print(result.msolve_version)     # '0.10.1'

emit_system raises MsolveInputError rather than rewriting input: parentheses, post-monomial division (x/2), repeated monomials, unknown identifiers, and coefficients that would overflow msolve's 64-bit read are all refused. Leading rationals (1/2*x) are allowed over Q only.

parse_groebner requires msolve's # comment header. That header is the only thing in the bytes that says which mode produced them, so it is load-bearing. Feeding it solver output raises MsolveAmbiguous instead of returning a basis:

parse_groebner("[-1]:")  # MsolveAmbiguous

This matters because the two languages invert each other. In solver mode [-1]: means no solutions; in Gröbner mode the unit ideal — the same fact — prints as [1]:. A parser that guesses gets the answer exactly backwards.

Not supported in v0.1

  • Solver mode, real-root isolation, and -P parametrization output — these raise, and are never interpreted as a basis.
  • JSON output, Macaulay2 format, or any other msolve serialization.
  • sympy / flint / numpy interop. Basis elements are returned as strings, exactly as msolve printed them. Nothing is eval'd.

A note on characteristic

msolve 0.10.1 labels some unlifted rational Gröbner bases as characteristic 0 regardless of whether a lift to Q actually happened. GroebnerOutput.characteristic reports what msolve printed and nothing more; msolveio does not pretend to know better.

License

MIT © 2026 DC Posch — https://github.com/dcposch/msolveio

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

msolveio-0.1.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

msolveio-0.1.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file msolveio-0.1.0.tar.gz.

File metadata

  • Download URL: msolveio-0.1.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for msolveio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 97213efc0c5837d87f6eda30ce93972ef9dc3f047a78f921a82ae3dddbce8da2
MD5 36cf6d5120d8168dd8868c034c2b825a
BLAKE2b-256 1cdcd8a178cf23ea7f8d2fc891eabe9dbad68ab1a79d1a9836b0e3f225c98286

See more details on using hashes here.

File details

Details for the file msolveio-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: msolveio-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for msolveio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18da919e535671de85ca742b41716ea9a4eda5358cf7f4abd07874645a668b01
MD5 a60b8f3512fcff7355510bbb0de5c246
BLAKE2b-256 6a7a3529b878020684f034fe452a42d129e04fdd322d969d4b29c3be99278288

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.1

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page