--- id: dsnparse version: "0.4.0" license: MIT license_treatment: permissive maintenance: aging --- # dsnparse — parse dsn urls License: permissive · Maintenance: aging · Downloads: 547.5K/mo ## What it is and what it does dsnparse is a lightweight URL parser specialized for DSN (Data Source Name) connection strings. It breaks down a DSN like `scheme://user:pass@host:port/path?query=val#fragment` into its constituent parts—scheme, username, password, host, port, paths, and query parameters—similar to Python's standard `urllib.parse.urlparse` but tailored for database and service connection URLs. The package supports custom result classes, allowing you to extend parsed results with domain-specific properties, and can read DSN values from environment variables. It has no runtime dependencies and requires Python 3.10 or later. The interface is intentionally kept simple and familiar to developers who have used urlparse, making it a drop-in solution for projects that need to parse and extract configuration from connection strings without pulling in heavier frameworks. Use it for: - Extract database credentials and connection details from a DSN string for establishing connections in application startup code. - Read and parse a DSN from an environment variable to configure database or service endpoints in containerized deployments. - Build custom result objects that extend parsed DSN data with application-specific properties or validation logic. - Parse non-standard or custom scheme DSNs (e.g., `prom.interface.postgres.Interface://...`) for plugin-based architectures. - Normalize and validate connection strings across different environments by decomposing them into individual components. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses DSN (Data Source Name) connection URL strings into structured components like scheme, username, password, host, port, and paths. Yes, if you need to parse DSN or connection URL strings. It is lightweight, has no dependencies, and carries a permissive MIT license. The aging maintenance status (305 days since last release) is a minor concern for a stable, narrow-scope utility, but the lack of recent vulnerabilities and active repository suggest it remains reliable for its intended purpose. ## Install pip install dsnparse uv add dsnparse poetry add dsnparse ## Installing dsnparse Before you install: Low install friction with no runtime dependencies. Maintenance status is aging—last release was 305 days ago, though the repository remains active and the package is marked Production/Stable. License in practice: MIT license permits unrestricted use, modification, and distribution with minimal restrictions, making it safe for both open-source and commercial projects. Quickstart: pip install dsnparse import dsnparse dsn = "prom.interface.postgres.Interface://testuser:testpw@localhost:1234/testdb" r = dsnparse.parse(dsn) print(r.scheme, r.username, r.host, r.port, r.paths) Requires Python 3.10 or later. Verify before relying: - Whether the package handles all modern DSN formats and edge cases in real-world deployments - Performance characteristics when parsing very large or complex DSN strings ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 547.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dsn url parser, connection string parser, database url parsing, parse dsn strings, connection url components, database connection parser, dsn configuration parser, url-parsing, configuration, database-urls [View on SkillFed](https://skillfed.io/packages/dsnparse) · [View on PyPI](https://pypi.org/project/dsnparse/)