Skip to main content

A typed, dot-notation identifier system for Python 3.12+.

Project description

IDKit

A small typed identifier system for Python 3.12+.

It lets you build structured identifiers using dot notation:

from idkit import ID

identifier = ID.system.runtime.agent.analyzer

print(identifier)
# system::runtime-agent+analyzer

print(identifier.namespace)
# system::runtime-agent

print(identifier.path)
# system/runtime/agent/analyzer

print(identifier.slug)
# system-runtime-agent-analyzer

Format

Group::Source[-Component][+Role]

Examples:

system::runtime
system::runtime-agent
system::runtime-agent+analyzer
service::data-resource+ingester
manage::workflow-pipeline+runner

Type aliases

from idkit import IDKitIdentifier, IDKitIdentifierLike, IDKitIdentifiable

Use IDKitIdentifier when you want the concrete implementation.

Use IDKitIdentifierLike when your function only needs the public identifier interface.

Use IDKitIdentifiable when your object exposes an .identifier property.

Compatibility aliases are also exported:

from idkit import AppIdentifier, AppIdentifierLike, AppIdentifiable
def register(identifier: IDKitIdentifierLike) -> None:
    identifier.require_complete()
    print(identifier.value)

Installation

pip install idkit

Parsing

parsed = ID.parse("system::runtime-agent+analyzer")

assert parsed == ID.system.runtime.agent.analyzer

Matching

identifier = ID.system.runtime.agent.analyzer

identifier.matches(ID.system)
# True

identifier.matches(ID.system.runtime)
# True

identifier.matches(ID.system.runtime.agent)
# True

identifier.matches(ID.service)
# False

Parent traversal

identifier = ID.system.runtime.agent.analyzer

identifier.parent
# Identifier('system::runtime-agent')

identifier.parent.parent
# Identifier('system::runtime')

identifier.parent.parent.parent
# Identifier('system')

Development

Run tests:

python3 -m pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

idkit-1.0.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

idkit-1.0.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file idkit-1.0.0.tar.gz.

File metadata

  • Download URL: idkit-1.0.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for idkit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9147fccbccc0280ca0251360bfe620b49329955c8e041d219facc3ac42e8decc
MD5 465d38430a817e246d1ce9826c4b89ff
BLAKE2b-256 16f6fc8389c5945efa4cb8c03d3b664c6d757a7a0eb4a0443a7f62a11ebdbbf8

See more details on using hashes here.

File details

Details for the file idkit-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: idkit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for idkit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 daa7272c6b861d262a687fcf5c9685e4efbdc8e3e539fd48ebbc69cce35dc9da
MD5 63d40dcbb0c0097e8037c2a3416190de
BLAKE2b-256 0b92ef99cf77332993f11d33f8b6e952fa1ade7b252b9cc0135f732a815d027a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page