Skip to main content

oeis-validator

Validate OEIS entries against the internal format specification and style sheet. Parses .txt files in OEIS internal format and checks all 19 field tags for compliance, consistency, and style adherence.

PyPI Python Coverage Ruff Tests

Features

  • All 19 field tags — %I, %S, %N, %C, %D, %F, %H, %I, %K, %L, %M, %N, %O, %P, %R, %S, %T, %U, %Y
  • 30 keyword checks — validates %K against the official keyword list
  • 14 style patterns — catches common OEIS style-sheet violations: counts the number of, greater or equal, less or equal, couples of, respectfully, triplets of, amount of, fulfills, allows to, except (missing for), unique vs distinct, its vs it's, p(n) ambiguity, be integer (missing article)
  • Non-ASCII detection — rejects stray Unicode in data/keyword fields
  • Reference cross-checks — URLs in %D, duplicate A-numbers in %Y, b-file ordering in %H, a_n/a[n] notation in %F
  • Program validation — missing language labels in %o, unsigned programs
  • CLI modes — file input, stdin, --demo, --coverage
  • Adversarial resilience — null bytes, BOM, mixed line endings, RTL overrides, shell injection attempts, binary input, 50-entry bulk parsing
  • Zero dependencies — pure Python stdlib

Install

pip install oeis-validator

Usage

# Validate a file
oeis-validator entry.txt

# Validate from stdin
echo '%I A000001 %S A000001 1,1,2,3,5' | oeis-validator

# Run built-in demos (good entry, bad entry, multi-entry)
oeis-validator --demo

# Show rule coverage table
oeis-validator --coverage

API

from oeis_validator import parse_entry, validate, report

entry = parse_entry(text)
issues = validate(entry)
exit_code = report(entry, issues)

Real-world validation

The data/ directory contains 10 real OEIS sequences fetched from the OEIS server. The validator produces 0 ERROR-level issues on all of them. Each warning is cross-checked against the official style sheet (.oeis_style_sheet.txt):

Sequence Warnings Fields warned
A000005 (divisors) 24 %o
A000010 (totient) 12 %o, %H
A000040 (primes) 28 %o, %D, %H, %Y
A000041 (partitions) 50 %o, %H
A000045 (Fibonacci) 49 %o, %H, %Y
A000108 (Catalan) 30 %o, %H, %F
A000203 (sigma) 16 %o, %H, %Y
A000217 (triangular) 16 %o, %Y
A000290 (squares) 4 %o, %Y
A001222 (Omega) 14 %o

Development

git clone https://github.com/daedalus/oeis_validator.git
cd oeis_validator
pip install -e ".[test]"

# run tests (218+ passing)
pytest -v

# format
ruff format src/ tests/

# lint + type check
prospector --with-tool ruff --with-tool mypy src/
semgrep --config=auto --severity=ERROR src/

# find unused code
vulture --min-confidence 90 src/

Threat model (adversarial tests)

The test suite (tests/test_adversarial.py) validates the parser, rules, and CLI against 82 adversarial scenarios across six categories:

Category Tests Examples
Parser 28 Null bytes, BOM, mixed \r\n/\n, RTL overrides, HTML/shell injection, 100-term sequences, negative zero, 50 repeated %S lines, zero-width chars, Unicode normalization, deeply nested parens (5000), 10K-char fields, ASCII art in comments, case-varying tags, invalid tag chars, EOF mid-tag, backslash continuation, whitespace-only fields
Rules 23 Mixed valid/invalid keywords, contradictory keyword pairs, offset > sequence length, 100/500 cross-references with/without duplicates, fake language labels, URL-free refs, all 19 tags stress test, signed programs (no false positive), cons/frac/tabl advisories, bref edge case, self-cross-ref
CLI 15 Binary input, empty/large stdin, directory as file, BOM file, Latin-1 file, empty file, symlinks, unicode filenames, -- separator, unknown flags
Style 9 Case-variant pattern matching (AllOwS tO), false-positive avoidance for except for, its, p(n) in formulas, multiple patterns in one field, patterns in comments
Multi-entry 3 50-entry bulk parse, mixed keyword sets, blank-line separators
Integration 4 Parse→validate→report pipeline, mixed valid/invalid entries, all 10 data files, 1000-term sequence no-crash

Metadata

Release files for oeis-validator 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oeis-validator 0.1.1
File Size Uploaded
oeis_validator-0.1.1.tar.gz 16.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oeis-validator 0.1.1
File Interpreter ABI Platform
oeis_validator-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.8 kB

Release files / oeis_validator-0.1.1.tar.gz

Download URL oeis_validator-0.1.1.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b3aa14aa462645037d7e38dbbdef0f347ac05f39173b00dffb330f3c49237f65
BLAKE2b-256 checksum
How to use checksums
5995cfaa2ad3eb104db479185182d76b2e6bda979dc6c22a9bbf589401201b8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 11, 2026.

Transparency log

Release files / oeis_validator-0.1.1-py3-none-any.whl

Download URL oeis_validator-0.1.1-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b920082645a94dade701b6a7488af6fe3a1f5d0ebd19816bbcd2e8e4e890d5f
BLAKE2b-256 checksum
How to use checksums
ae4c84b7fddacc0955e92414912d81d1abad67538b2b10dcffc2e4a1e99a92c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release 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