Skip to main content

Tools and utilities for working with OEIS integer sequences

Project description

oeis-tools

Tests PyPI version License: MIT

oeis-tools is a Python package for working with the Online Encyclopedia of Integer Sequences (OEIS).

It provides:

  • OEIS ID validation
  • URL and b-file helpers
  • A Sequence class for OEIS JSON entries
  • A BFile class for b-file numeric data

Installation

From PyPI:

pip install oeis-tools

From source:

git clone https://github.com/oeistools/oeis-tools.git
cd oeis-tools
pip install -e .

Development dependencies (tests):

pip install -e ".[dev]"

Quick Start

import oeis_tools

# Utilities
print(oeis_tools.check_id("A000001"))              # True
print(oeis_tools.oeis_bfile("A000001"))            # b000001.txt
print(oeis_tools.oeis_url("A000001", fmt="json"))  # https://oeis.org/search?q=id:A000001&fmt=json

# Sequence API
seq = oeis_tools.Sequence("A000045")
print(seq.name)        # Fibonacci numbers
print(seq.data)        # comma-separated terms
print(seq.author)      # list[str]
print(seq.json["id"])  # raw JSON field access

# B-file API
bfile = oeis_tools.BFile("A000045")
print(bfile.get_filename())      # b000045.txt
print(bfile.get_url())           # https://oeis.org/A000045/b000045.txt
print(bfile.get_bfile_data()[:5])

API Overview

  • check_id(oeis_id: str) -> bool
  • oeis_bfile(oeis_id: str) -> str
  • oeis_url(oeis_id: str, fmt: str | None = None) -> str
  • Sequence(oeis_id: str)
    • Key attributes: id, json, name, data, author, link, bfile
  • BFile(oeis_id: str)
    • Methods: get_filename(), get_url(), get_bfile_data()

Running Tests

pytest -q

License

MIT. See LICENSE.

Author

Enrique Pérez Herrero - energycode.org@gmail.com

Project details


Download files

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

Source Distribution

oeis_tools-0.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

oeis_tools-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oeis_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for oeis_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 09e1fb36587b1d14acfe1bbb1cc78f65b5c34e6ca25b90ec72cc682ae332e782
MD5 2d5da4d2217cad6248a572f9ab0accb2
BLAKE2b-256 e0e333df6561ba89fc6495e42d12dfddba3cfb7002294168647344ce9e92e845

See more details on using hashes here.

Provenance

The following attestation bundles were made for oeis_tools-0.1.0.tar.gz:

Publisher: publish.yml on oeistools/oeis-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: oeis_tools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for oeis_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 768d4308b461a13170b3e1aa9c11c4dcfac6a233efa1c6d5b383cab7db4d7645
MD5 f402d8e10a4427b18ba41590db312de6
BLAKE2b-256 d2864ac0d6946792e643cc42f94bd182c66f0551a3efdbaf43a8c9e83cbf9c73

See more details on using hashes here.

Provenance

The following attestation bundles were made for oeis_tools-0.1.0-py3-none-any.whl:

Publisher: publish.yml on oeistools/oeis-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page