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.0.tar.gz (103.0 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.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: anniyan-0.1.0.tar.gz
  • Upload date:
  • Size: 103.0 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.0.tar.gz
Algorithm Hash digest
SHA256 3818b852a1a2161ddb0036460f93326a1c80ba8bcc70edd1f706addbf2908a79
MD5 0aa4d96de939ef36b7d7f161c5d0b240
BLAKE2b-256 6313c8d39e2d07902aa20715fd286c0f71782eeeff320acd37a7495d0b21460e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: anniyan-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28cd117869bc3162d55d08094e6f6c423f2f5df287598c5be906ead799ac57c7
MD5 9adc6cada6cda8131c5fd77da81476ed
BLAKE2b-256 8ff0e23e52f575ff310aaf4388f94988331aab36ed78c57eef8f3f9466b2ee8d

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