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.segment)
# analyzer

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 Identifier, IDLike, IDable

Use Identifier when you want the concrete identity type.

Use IDLike when your function only needs the public identity interface.

Use IDable when your object exposes an .identifier property.

The root package also exports the generic building blocks:

from idkit import Identity, IdentityLike, Identifiable, IdentityNamespace
from idkit import IDLike


def register(identifier: IDLike) -> 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.1.tar.gz (13.0 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.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: idkit-1.0.1.tar.gz
  • Upload date:
  • Size: 13.0 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.1.tar.gz
Algorithm Hash digest
SHA256 e8325a308e23804931dd938febe2585a2bcbe1affb61f0bb972b03c0a45ba3cb
MD5 a8e3ca35e2f9ef7f108d856e02183dfc
BLAKE2b-256 91886c5cdb4f781b84b9749a49ac022915b5bd5005730612de5b43a141c8444b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: idkit-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2339d50445a57c7e6ceacc1d77261c059ae52482066a8a0713d5f1b6f0d9a5c2
MD5 0de2f748e91e84af3c9d4e63f1c65862
BLAKE2b-256 a777a1ae1e6c45980cfd0fd7f3169831e87ecae5b5b05c9b4518ce549ac274cb

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