semvec/pypi-packages huggingface dataset:
tag-uri 0.1.1
RFC 4151 Tag URI taguri.org parser and generator
License: MIT
Requires Python: <4.0,>=3.11
Keywords: rfc4151, uri, parser, taguri.org

# 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
```