{"id":3262,"library":"rfc3987","title":"Parsing and validation of URIs (RFC 3986) and IRIs (RFC 3987)","description":"The `rfc3987` Python library provides regular expressions and utilities for parsing and validating Uniform Resource Identifiers (URIs) as per RFC 3986 and Internationalized Resource Identifiers (IRIs) according to RFC 3987. The current version is 1.3.8. Development on the original GitHub repository has ceased, and the project is now archived, with development reportedly moved to Codeberg, implying a largely unmaintained or very slow release cadence on PyPI.","status":"maintenance","version":"1.3.8","language":"en","source_language":"en","source_url":"https://codeberg.org/atufi/rfc3987/","tags":["uri","iri","validation","parsing","rfc3986","rfc3987","internet"],"install":[{"cmd":"pip install rfc3987","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for full support of all ABNF rules; without it, the standard 're' module is used, which has limitations on supported rules for parsing.","package":"regex","optional":true}],"imports":[{"symbol":"match","correct":"from rfc3987 import match"},{"symbol":"parse","correct":"from rfc3987 import parse"},{"symbol":"compose","correct":"from rfc3987 import compose"},{"symbol":"resolve","correct":"from rfc3987 import resolve"}],"quickstart":{"code":"from rfc3987 import parse, match, resolve\n\n# Parse an IRI and get its components\niri_string = 'http://example.com/path?query=value#fragment'\nparsed_iri = parse(iri_string, rule='IRI')\nprint(f\"Parsed Scheme: {parsed_iri.get('scheme')}\")\nprint(f\"Parsed Authority: {parsed_iri.get('authority')}\")\nprint(f\"Parsed Path: {parsed_iri.get('path')}\")\n\n# Check if a string matches a specific rule\nis_pct_encoded = match('%C7', 'pct_encoded')\nprint(f\"Is '%C7' percent-encoded? {bool(is_pct_encoded)}\")\n\n# Resolve a relative URI reference\nbase_uri = 'http://a/b/c/d;p?q'\nrelative_ref = '../../g'\nresolved_uri = resolve(base_uri, relative_ref)\nprint(f\"Resolved URI: {resolved_uri}\")","lang":"python","description":"Demonstrates parsing an IRI, matching a component against a rule, and resolving a relative URI reference. The `parse` function extracts components into a dictionary, `match` checks if a string conforms to a specific ABNF rule, and `resolve` combines a base URI with a relative reference."},"warnings":[{"fix":"Be aware that active development has shifted. For new projects, evaluate if the current 1.3.8 version meets your needs, or consider forks/alternative libraries if active maintenance is critical. The Codeberg repository (https://codeberg.org/atufi/rfc3987/) might contain more up-to-date information or development.","message":"The original GitHub repository for `rfc3987` has been archived by its owner, and development has reportedly moved to a different platform (Codeberg). This indicates that the PyPI package might not receive future updates or active maintenance from the original author, potentially leading to stagnation or unaddressed issues for newer Python versions or RFC amendments.","severity":"breaking","affected_versions":"1.3.8 and potentially future versions on PyPI."},{"fix":"If you need to validate or parse strings against arbitrary or less common RFC 3986/3987 rules, ensure you install the `regex` package: `pip install rfc3987 regex`. Otherwise, restrict rule usage to those explicitly supported by the `re` module fallback.","message":"The `parse` and `match` functions have different capabilities depending on whether the optional `regex` package is installed. If `regex` is available, any RFC 3986/3987 rule can be used. If only Python's built-in `re` module is present, only specific, special-cased rules (like 'IRI_reference', 'IRI', 'absolute_IRI', 'URI_reference', 'URI', etc.) are supported.","severity":"gotcha","affected_versions":"All versions of rfc3987."},{"fix":"Test thoroughly on your target Python 3.x version. While the core regex patterns are stable, be mindful of potential unexpected behavior or lack of optimizations on newer Python runtimes.","message":"The library primarily lists Python 2.x and Python 3.2-3.6 for compatibility testing in its PyPI metadata. While it generally works with newer Python 3 versions, explicit support, testing, and potential edge-case fixes for Python 3.7+ are not officially documented due to the lack of recent updates and archived status of the original repository.","severity":"deprecated","affected_versions":"All versions, particularly when used with Python 3.7+."},{"fix":"Ensure you are using a modern Python 3.x version (preferably 3.7+) which typically supports a 'wide' Unicode build, resolving this limitation. This warning is less relevant for contemporary Python environments.","message":"For older Python versions (<=3.2), characters beyond the Basic Multilingual Plane (BMP) might not be fully supported on 'narrow' Python builds, which can lead to issues when processing internationalized characters in IRIs. This is a Python interpreter limitation, not specific to `rfc3987` itself.","severity":"gotcha","affected_versions":"Python <= 3.2, especially on narrow builds."}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}