Skip to main content

dj3nk

English | 简体中文

dj3nk is an ID generation algorithm, the principle of which is from nightteam.

1. Introduction

  • You can use NaturalKeyGenerator to generate auto-incrementing IDs.
  • When using Django ORM, you can inherit the NKModel class to automatically generate auto-incrementing IDs.

2. Usage

Install

pip install dj3nk

Examples

  • Use directly.
from dj3nk.natural_key_generator import NaturalKeyGenerator

# Optional. Reconfigure.
CONFIG = {
    "increment_main_key": "dj3nk",
    "random_bit_length": 16,
    "puzzle_count": 1000000,
    "rdb_conf_name": "default"
}

g = NaturalKeyGenerator(config=CONFIG)
g.generate_nk()
  • 在Django ORM中使用
# Optional. Configure `settings.py`.
DJ3NK = {
    "increment_main_key": "dj3nk",
    "random_bit_length": 16,
    "puzzle_count": 1000000,
    "rdb_conf_name": "default"
}

# models
from dj3nk.nk_model import NKModel


class XXX(NKModel):
    ...

Metadata

Release files for dj3nk 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dj3nk 0.3.0
File Size Uploaded Provenance Actions
dj3nk-0.3.0.tar.gz 3.9 kB Without provenance Details for dj3nk-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dj3nk 0.3.0
File Interpreter ABI Platform Actions
dj3nk-0.3.0-py3-none-any.whl Python 3 none any Details for dj3nk-0.3.0-py3-none-any.whl

Total release size: 8.1 kB

Release files / dj3nk-0.3.0.tar.gz

Download URL dj3nk-0.3.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e2722085a1fe6e873b696d88aa63b9a172d2c25f7b7dcddbd3e69e84c5c7bebc
BLAKE2b-256 checksum
How to use checksums
c69c5e189a9e672e2e16674b1efa656c9a21c40c2ceb3f938a48c321c3b455af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Release files / dj3nk-0.3.0-py3-none-any.whl

Download URL dj3nk-0.3.0-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df17788d9a560b4377379cfec0cf6b89577fa735dd9f42b77082fe0a7f973a52
BLAKE2b-256 checksum
How to use checksums
f025b022edc7ce6265f0626eede47cbdec48a02ee3f8f8a92672f73c72a2f303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Security for dj3nk 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page