--- id: repath version: "0.9.0" license: MIT license_treatment: permissive maintenance: abandoned --- # repath — Generate regular expressions form ExpressJS path patterns License: permissive · Maintenance: abandoned · Downloads: 506.6K/mo ## What it is and what it does repath is a Python port of the Node.js path-to-regexp module. It takes Express-style path strings—where parameters are marked with colons like `:name`—and generates regular expression patterns you can compile and use with Python's re module to match and extract values from URL paths. The package handles named parameters, optional segments (suffixed with `?`), zero-or-more matches (`*`), one-or-more matches (`+`), custom regex patterns, and unnamed capture groups. You use it by calling repath.pattern() to generate a regex pattern string, then compiling that pattern with re.compile() and matching against actual URL paths. It also provides a template() function to reverse the process—taking a path template and a dictionary of values to generate a filled-in path string. The package exposes lower-level functions like parse() and tokens_to_pattern() for advanced use cases. Use it for: - Build a web framework or routing layer that needs to match incoming URL paths to handler functions using Express-like syntax. - Parse and validate dynamic URL structures where path segments contain variable data that must be extracted. - Generate URL patterns for testing or documentation that describe what paths your application will accept. - Convert Express route definitions to Python patterns when porting Node.js applications. - Create a URL templating system where you define a pattern once and generate concrete URLs with different parameter values. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts Express-style path strings (like `/user/:name`) into regular expression patterns that can match and extract URL path parameters. Yes, but with caution. The package is stable and has no known vulnerabilities, and it solves a specific problem well if you need Express-style path-to-regex conversion in Python. However, it is abandoned—no updates since 2019—so if you encounter bugs or need features, you will need to fork or patch it yourself. For new projects, verify that the dependency on six and the lack of recent Python version testing do not create compatibility issues in your environment. ## Install pip install repath uv add repath poetry add repath ## Installing repath Before you install: Installation is straightforward with low friction—a pure Python wheel with only six as a runtime dependency. However, the package is abandoned; the last release was in 2019 and no commits have been made since then. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions, making it safe to adopt in most projects. Quickstart: import re import repath pattern = repath.pattern('/user/:name') match = re.match(pattern, '/user/alice') if match: params = match.groupdict() Verify before relying: - Whether the package works correctly with modern Python versions beyond those tested at release time. - Whether six dependency is still necessary or if Python 2 support is still relevant for current use. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 506.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags express path to regex, url path pattern matching, route parameter extraction, path-to-regexp python, dynamic url routing, named path parameters, express-style routes, routing, url-parsing, regex-generation [View on SkillFed](https://skillfed.io/packages/repath) · [View on PyPI](https://pypi.org/project/repath/)