Metadata-Version: 2.1
Name: tag-uri
Version: 0.1.1
Summary: RFC 4151 Tag URI taguri.org parser and generator
Home-page: https://git.sr.ht/~cellofellow/tag_uri
License: MIT
Keywords: rfc4151,uri,parser,taguri.org
Author: Josh Gardner
Author-email: jdg@jgardner.tech
Requires-Python: >=3.11,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Dist: lark (>=1.1.9,<2.0.0)
Project-URL: Repository, https://git.sr.ht/~cellofellow/tag_uri
Description-Content-Type: text/markdown

# Parser and Generator For Tag URIs

Tag URIs are a format of URI with the schema `tag:` and are used for globally namespaced identifiers. These can be more useful than for example naked UUIDs because they have namespacing based on domain names and dates as well as can have URL-like paths and fragments.

See taguri.org for details and [RFC 4151](https://datatracker.ietf.org/doc/html/rfc4151).

## Usage

**Installation** `pip install tag_uri`, and add `pip install tag_uri[cli]` to include dependencies needed for the `tag-uri` command.

### Example

``` python
from datetime import date

from tag_uri import TagURI

parsed = TagURI.parse("tag:example.com,2018-01:example/112233")
assert str(parsed) == "tag:example.com,2018-01:example/112233"

maker = TagURI.maker("josh@example.com")
made = maker("example/5432", "test")
assert str(made) == "tag:josh@example.com,2024-01-19:example/5432#test"
assert made.tagging_entity.authority_name == "josh@example.com"
assert made.tagging_entity.date == date(2024, 1, 19)
```

### Command line use

With `pyyaml` installed, you can parse any number of tag URIs by passing them
either as command line arguments or as lines via stdin. The parsed results will be output to stdout as YAML.

``` sh
tag-uri tag:example.com,2018-01-02:example/223344
echo tag:example.com,2019-02-03:example/334455 | tag-uri
```

