PackageURLs.jl
A pure-Julia implementation of the Package URL (PURL) specification (ECMA-427).
Package URLs (PURLs) are a standardized way to identify and locate software packages across different package managers and ecosystems.
Installation
using Pkg
using Pkg
Pkg.add(url="https://github.com/s-celles/PackageURLs.jl") # until unregistered
#Pkg.add("PackageURLs") # when registered to General registryQuick Start
Parsing PURLs
using PackageURLs
# Parse a PURL string
purl = parse(PURL, "pkg:npm/lodash@4.17.21")
# Access components
purl.type # "npm"
purl.name # "lodash"
purl.version # "4.17.21"Using the String Macro
# Compile-time validated PURL literals
purl = purl"pkg:pypi/requests@2.28.0"Constructing PURLs
# Create a PURL programmatically
purl = PURL("npm", "@angular", "core", "15.0.0", nothing, nothing)
# Convert to string
string(purl) # "pkg:npm/%40angular/core@15.0.0"Safe Parsing
# Returns nothing on parse failure instead of throwing
result = tryparse(PURL, "invalid-purl")
result === nothing # truePURL Format
A PURL follows this format:
pkg:type[/namespace]/name[@version][?qualifiers][#subpath]See PURL Components for detailed documentation of each component.
Supported Ecosystems
PackageURLs.jl supports all standard PURL types with type-specific validation:
- Julia - Requires
uuidqualifier for package disambiguation - npm - Supports scoped packages (
@scope/name) - PyPI - Name normalization (lowercase, underscores to hyphens)
- Maven - Namespace as group ID
- Cargo, NuGet, Go, and many more
See Examples for ecosystem-specific usage patterns.
Next Steps
- PURL Components - Detailed component reference
- Examples - Ecosystem-specific examples
- Integration Guide - Using PackageURLs.jl with SecurityAdvisories.jl
- API Reference - Complete API documentation