Registry / aws / arnparse

arnparse

JSON →
library0.0.2pypypi✓ verified 22d ago

arnparse is a Python library designed to parse Amazon Resource Names (ARNs) into their constituent components like partition, service, region, account ID, and resource. As of version 0.0.2, it provides a straightforward API for extracting information from common ARN formats. The project is in an early stage with a relatively slow release cadence.

pip install arnparse
INSTALL
IMPORT
SIG · ARNPARSE
A
arnparse
awspythonv0.0.2
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

arnparse
from arnparse import arnparse

This example demonstrates how to parse an AWS SNS Topic ARN string and access its individual components using the `arnparse` function.

from arnparse import arnparse # Example: Parsing an SNS Topic ARN arn_string = 'arn:aws:sns:us-east-1:123456789012:my_corporate_topic' arn = arnparse(arn_string) print(f"Original ARN: {arn_string}") print(f"Partition: {arn.partition}") print(f"Service: {arn.service}") print(f"Region: {arn.region}") print(f"Account ID: {arn.account_id}") print(f"Resource: {arn.resource}") # Accessing components directly assert arn.partition == 'aws' assert arn.service == 'sns' assert arn.region == 'us-east-1' assert arn.account_id == '123456789012' assert arn.resource == 'my_corporate_topic'
Debug
Known issues
gotchaThe library is currently at version 0.0.2, indicating an early stage of development. While functional, future major versions may introduce breaking API changes or new behaviors without extensive backward compatibility considerations.
fix
Stay updated with releases and carefully review release notes for any API changes.
affects: 0.0.1, 0.0.2
gotchaWhile it handles common ARN patterns (e.g., S3, SNS, EC2 VPC), `arnparse` may not comprehensively support all existing and future AWS ARN formats, especially complex or service-specific variations, potentially leading to incomplete or incorrect parsing for certain ARNs.
fix
Thoroughly test with the specific ARN formats your application uses. Consider contributing to the project for unsupported ARN types.
affects: 0.0.1, 0.0.2
gotchaThe project's low version number and infrequent updates (last release 0.0.2 in 2019, though GitHub files show a more recent update date of May 2023 for the same version) suggest limited active development and maintenance. This might impact bug fixes, feature requests, or compatibility with newer Python versions or AWS ARN specifications.
fix
Assess the project's activity and be prepared to fork or contribute if specific needs arise that aren't addressed by the maintainers.
affects: 0.0.1, 0.0.2
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'arnparse'
The 'arnparse' module is not installed in the Python environment.
fix
Install the module using pip: 'pip install arnparse'.
ImportError: cannot import name 'arnparse'
Incorrect import statement; 'arnparse' is a function within the 'arnparse' module.
fix
Use the correct import statement: 'from arnparse import arnparse'.
TypeError: 'module' object is not callable
Attempting to call the 'arnparse' module as a function instead of using the 'arnparse' function within it.
fix
Import the function correctly: 'from arnparse import arnparse', then call it as 'arnparse(arn_string)'.
ValueError: Invalid ARN format: <your_invalid_arn_string>
The input string provided to the `arnparse()` function does not conform to a recognized Amazon Resource Name (ARN) structure.
fix
Ensure the ARN string follows the standard format: `arn:partition:service:region:account-id:resource` and that all components are valid for the expected service.
AttributeError: 'ARN' object has no attribute 'some_typo_or_non_existent_component'
You are attempting to access an attribute (ARN component) on the parsed ARN object that either does not exist, is misspelled, or is not a standard component parsed by the `arnparse` library.
fix
Check the available attributes of the `ARN` object (e.g., `partition`, `service`, `region`, `account_id`, `resource_type`, `resource`) and verify the spelling. You can print the `ARN` object or its `__dict__` to inspect its properties.
Upgrade
Version history
0.0.2latest on PyPI · released Mar 12, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
20
Resources
arnparse — pip install arnparse · libregistry