{"id":15348417,"url":"https://github.com/stain/arcp-py","last_synced_at":"2025-07-13T17:39:59.613Z","repository":{"id":60721950,"uuid":"119304253","full_name":"stain/arcp-py","owner":"stain","description":"Create/parse arcp (Archive and Package) URIs","archived":false,"fork":false,"pushed_at":"2020-02-12T12:05:46.000Z","size":114,"stargazers_count":1,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-07T10:05:05.733Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://arcp.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stain.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-28T22:37:16.000Z","updated_at":"2020-02-12T12:05:49.000Z","dependencies_parsed_at":"2022-10-03T20:31:16.876Z","dependency_job_id":null,"html_url":"https://github.com/stain/arcp-py","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/stain/arcp-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stain%2Farcp-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stain%2Farcp-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stain%2Farcp-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stain%2Farcp-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stain","download_url":"https://codeload.github.com/stain/arcp-py/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stain%2Farcp-py/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265180536,"owners_count":23723706,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T11:47:52.441Z","updated_at":"2025-07-13T17:39:59.577Z","avatar_url":"https://github.com/stain.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"arcp-py\n=======\n\nCreate/parse arcp_ (Archive and Package) URIs.\n\n.. image:: https://readthedocs.org/projects/arcp/badge/?version=latest\n  :target: https://arcp.readthedocs.io/en/latest/?badge=latest\n  :alt: Documentation Status\n.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.1162749.svg\n  :target: https://doi.org/10.5281/zenodo.1162749\n.. image:: https://travis-ci.org/stain/arcp-py.svg?branch=master\n  :target: https://travis-ci.org/stain/arcp-py\n.. image:: https://img.shields.io/pypi/v/arcp.svg?maxAge=86400\n  :target: https://pypi.org/project/arcp/\n.. image:: https://coveralls.io/repos/github/stain/arcp-py/badge.svg?branch=master\n  :target: https://coveralls.io/github/stain/arcp-py?branch=master\n.. image:: https://codecov.io/gh/stain/arcp-py/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/stain/arcp-py\n\n\n\n\nIntroduction\n------------\n\n``arcp`` provides functions for creating arcp_ URIs, \nwhich can be used for identifying or parsing hypermedia \nfiles packaged in an archive or package, like a ZIP file.\n\narcp URIs can be used to consume or reference hypermedia resources \nbundled inside a file archive or an application package, as well as \nto resolve URIs for archive resources within a programmatic framework.\n\nThis URI scheme provides mechanisms to generate a unique base URI \nto represent the root of the archive, so that relative URI references \nin a bundled resource can be resolved within the archive without having to extract the archive content on the local file system.\n\nAn arcp URI can be used for purposes of isolation (e.g. when consuming \nmultiple archives), security constraints (avoiding “climb out” from the\narchive), or for externally identiyfing sub-resources referenced by\nhypermedia formats.\n\nExamples:\n - ``arcp://uuid,32a423d6-52ab-47e3-a9cd-54f418a48571/doc.html``\n - ``arcp://uuid,b7749d0b-0e47-5fc4-999d-f154abe68065/pics/``\n - ``arcp://ni,sha-256;F-34D4TUeOfG0selz7REKRDo4XePkewPeQYtjL3vQs0/``\n - ``arcp://name,gallery.example.org/``\n\nThe different forms of URI authority_ in arcp URIs can be used depending\non which uniqueness constraints to apply when addressing an archive.\nSee the arcp_ specification (*draft-soilandreyes-arcp*) for details.\n\nNote that this library only provides mechanisms to \n*generate* and *parse* arcp URIs, and do *not* integrate with any \nparticular archive or URL handling modules like \n``zipfile`` or ``urllib.request``.\n\n\nLicense\n-------\n\n© 2018-2020 Stian Soiland-Reyes \u003chttps://orcid.org/0000-0001-9842-9718\u003e, The University of Manchester, UK\n\nLicensed under the \nApache License, version 2.0 \u003chttps://www.apache.org/licenses/LICENSE-2.0\u003e, \nsee the file LICENSE.txt for details.\n\nContribute\n----------\n\nSource code: \u003chttps://github.com/stain/arcp-py\u003e\n\nFeel free to raise a pull request at \u003chttps://github.com/stain/arcp-py/pulls\u003e\nor an issue at \u003chttps://github.com/stain/arcp-py/issues\u003e.\n\nSubmitted contributions are assumed to be covered by section 5 of the Apache License 2.0.\n\nInstalling\n----------\n\nYou will need Python 2.7, Python 3.4 or later (Recommended: 3.6).\n\nIf you have pip_, then the easiest is normally to install from \u003chttps://pypi.org/project/arcp/\u003e using::\n\n    pip install arcp\n\nIf you want to install manually from this code base, then try::\n\n    python setup.py install\n\nUsage\n------\n\nFor full documentation, see \u003chttps://arcp.readthedocs.io/\u003e or use ``help(arcp)``\n\nThis module provides functions for creating arcp_ URIs, \nwhich can be used for identifying or parsing hypermedia \nfiles packaged in an archive or package, like a ZIP file:: python\n\n    \u003e\u003e\u003e from arcp import *\n\n    \u003e\u003e\u003e arcp_random()\n    'arcp://uuid,dcd6b1e8-b3a2-43c9-930b-0119cf0dc538/'\n\n    \u003e\u003e\u003e arcp_random(\"/foaf.ttl\", fragment=\"me\")\n    'arcp://uuid,dcd6b1e8-b3a2-43c9-930b-0119cf0dc538/foaf.ttl#me'\n\n    \u003e\u003e\u003e arcp_hash(b\"Hello World!\", \"/folder/\")\n    'arcp://ni,sha-256;f4OxZX_x_FO5LcGBSKHWXfwtSx-j1ncoSt3SABJtkGk/folder/'\n\n    \u003e\u003e\u003e arcp_location(\"http://example.com/data.zip\", \"/file.txt\")\n    'arcp://uuid,b7749d0b-0e47-5fc4-999d-f154abe68065/file.txt'\n\narcp URLs can be used with ``urllib.parse``, \nfor instance using ``urljoin`` to resolve relative references::\n\n    \u003e\u003e\u003e css = arcp.arcp_name(\"app.example.com\", \"css/style.css\")\n    \u003e\u003e\u003e urllib.parse.urljoin(css, \"../fonts/foo.woff\")\n    'arcp://name,app.example.com/fonts/foo.woff'\n\n\nIn addition this module provides functions that can be used\nto parse arcp URIs into its constituent fields:: python\n\n    \u003e\u003e\u003e is_arcp_uri(\"arcp://uuid,b7749d0b-0e47-5fc4-999d-f154abe68065/file.txt\")\n    True\n\n    \u003e\u003e\u003e is_arcp_uri(\"http://example.com/t\")\n    False\n\n    \u003e\u003e\u003e u = parse_arcp(\"arcp://uuid,b7749d0b-0e47-5fc4-999d-f154abe68065/file.txt\")\n    ARCPSplitResult(scheme='arcp',prefix='uuid',name='b7749d0b-0e47-5fc4-999d-f154abe68065',\n      uuid='b7749d0b-0e47-5fc4-999d-f154abe68065',path='/file.txt',query='',fragment='')\n\n    \u003e\u003e\u003e u.path\n    '/file.txt'\n    \u003e\u003e\u003e u.prefix\n    'uuid'\n    \u003e\u003e\u003e u.uuid\n    UUID('b7749d0b-0e47-5fc4-999d-f154abe68065')\n    \u003e\u003e\u003e u.uuid.version\n    5\n\n    \u003e\u003e\u003e parse_arcp(\"arcp://ni,sha-256;f4OxZX_x_FO5LcGBSKHWXfwtSx-j1ncoSt3SABJtkGk/folder/\").hash\n    ('sha-256', '7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069')\n\nThe object returned from ``parse_arcp`` is similar to \n``ParseResult`` from ``urlparse``, but contains additional properties \n``prefix``, ``uuid``, ``ni``, ``hash`` and ``name``, \nsome of which will be ``None`` depending on the arcp prefix.\n\nThe function ``arcp.parse.urlparse`` can be imported as an alternative \nto ``urllib.parse.urlparse``. If the scheme is ``arcp`` then the extra \narcp fields like `prefix`, `uuid`, `hash` and `name` are available\nas from `parse_arcp`, otherwise the output is the same as from \nregular `urlparse`:: python\n\n    \u003e\u003e\u003e from arcp.parse import urlparse\n    \u003e\u003e\u003e urlparse(\"arcp://ni,sha-256;f4OxZX_x_FO5LcGBSKHWXfwtSx-j1ncoSt3SABJtkGk/folder/soup;sads\")\n    ARCPParseResult(scheme='arcp',prefix='ni',\n       name='sha-256;f4OxZX_x_FO5LcGBSKHWXfwtSx-j1ncoSt3SABJtkGk',\n       ni='sha-256;f4OxZX_x_FO5LcGBSKHWXfwtSx-j1ncoSt3SABJtkGk',\n       hash=('sha-256', '7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069',\n       path='/folder/soup;sads',query='',fragment='')\n    \u003e\u003e\u003e urlparse(\"http://example.com/help?q=a\")\n    ParseResult(scheme='http', netloc='example.com', path='/help', params='', \n      query='q=a', fragment='')\n\n\n\n.. _arcp: https://tools.ietf.org/html/draft-soilandreyes-arcp-03\n.. _pip: https://docs.python.org/3/installing/\n.. _authority: https://tools.ietf.org/id/draft-soilandreyes-arcp-03.html#rfc.section.4.1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstain%2Farcp-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstain%2Farcp-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstain%2Farcp-py/lists"}