Validate OEIS draft entries against the internal format specification and style sheet
Project description
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.
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
%Kagainst 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),uniquevsdistinct,itsvsit'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 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oeis_validator-0.1.1.tar.gz.
File metadata
- Download URL: oeis_validator-0.1.1.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3aa14aa462645037d7e38dbbdef0f347ac05f39173b00dffb330f3c49237f65
|
|
| MD5 |
66b63ccb16b054f7446d59797b6295a9
|
|
| BLAKE2b-256 |
5995cfaa2ad3eb104db479185182d76b2e6bda979dc6c22a9bbf589401201b8e
|
Provenance
The following attestation bundles were made for oeis_validator-0.1.1.tar.gz:
Publisher:
pypi-publish.yml on daedalus/oeis_validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oeis_validator-0.1.1.tar.gz -
Subject digest:
b3aa14aa462645037d7e38dbbdef0f347ac05f39173b00dffb330f3c49237f65 - Sigstore transparency entry: 1508714414
- Sigstore integration time:
-
Permalink:
daedalus/oeis_validator@fd437cb1857ecd7a5627de1650c5a2b417ae9ce6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@fd437cb1857ecd7a5627de1650c5a2b417ae9ce6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file oeis_validator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: oeis_validator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b920082645a94dade701b6a7488af6fe3a1f5d0ebd19816bbcd2e8e4e890d5f
|
|
| MD5 |
63b021a44ae32bd29a5b67154860725a
|
|
| BLAKE2b-256 |
ae4c84b7fddacc0955e92414912d81d1abad67538b2b10dcffc2e4a1e99a92c0
|
Provenance
The following attestation bundles were made for oeis_validator-0.1.1-py3-none-any.whl:
Publisher:
pypi-publish.yml on daedalus/oeis_validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oeis_validator-0.1.1-py3-none-any.whl -
Subject digest:
8b920082645a94dade701b6a7488af6fe3a1f5d0ebd19816bbcd2e8e4e890d5f - Sigstore transparency entry: 1508715013
- Sigstore integration time:
-
Permalink:
daedalus/oeis_validator@fd437cb1857ecd7a5627de1650c5a2b417ae9ce6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@fd437cb1857ecd7a5627de1650c5a2b417ae9ce6 -
Trigger Event:
release
-
Statement type: