Skip to main content

MIME-type string validator

Project description

Anniyan

A fast, minimal, and IANA-compliant MIME type validator for Python.


✨ Features

  • ✔️ Validates MIME types against official IANA registry
  • ⚡ Zero runtime dependencies
  • 🧠 Handles real-world inputs (; charset=utf-8, casing, etc.)
  • 📦 Lightweight and fast (set-based lookup)
  • 🔁 Deterministic, pre-generated data (no network at runtime)

📦 Installation

Local development

pip install -e /path/to/anniyan

From wheel

pip install dist/anniyan-0.1.0-py3-none-any.whl

🚀 Usage

from anniyan import is_valid_mime

is_valid_mime("application/json")              # True
is_valid_mime("text/html; charset=UTF-8")      # True
is_valid_mime("image/not-real")                # False

🧪 Behavior

  • Case-insensitive
  • Ignores MIME parameters (; charset=...)
  • Requires valid type/subtype structure

🏗️ How It Works

  • MIME types are fetched from the official IANA registry
  • Data is normalized and compiled into Python sets
  • Validation is a constant-time lookup

🔧 Development

Install dev dependencies:

pip install .[dev]

Run tests:

pytest

Regenerate MIME dataset:

python -m anniyan.data_generator

📄 License

MIT

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

anniyan-0.1.1.tar.gz (116.5 kB view details)

Uploaded Source

Built Distribution

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

anniyan-0.1.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file anniyan-0.1.1.tar.gz.

File metadata

  • Download URL: anniyan-0.1.1.tar.gz
  • Upload date:
  • Size: 116.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for anniyan-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0e0c85001a62f9f83ff5d6fa01494949300ce9439a551fd34a1a0c2fd7069640
MD5 9356af24d08b05ae4dadf1f6ae03f483
BLAKE2b-256 90b9bb61a8f9f90eb62558af107c0201be93e271ba5f9a47b5b46315a46806cb

See more details on using hashes here.

File details

Details for the file anniyan-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: anniyan-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for anniyan-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e95bfbbac67bf12c83d0681a6574e27e374b4e2512ab99fcee5e630b7d589043
MD5 739892e9ac01da322e82127aa82800dc
BLAKE2b-256 a181ff6bd04b5677e64daf0672bb9eba205da38b8d902e64e3996695824134b3

See more details on using hashes here.

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