Skip to main content

Small MongoDB helper with optional collection wrappers.

Project description

d4rkdb

d4rkdb is a small MongoDB helper that wraps pymongo with a simple connection object and optional collection wrapper loading.

Install

Install from PyPI:

pip install d4rkdb

pip will also install d4rklogger and pymongo automatically.

Project page: https://pypi.org/project/d4rkdb/

Usage

Basic connection:

from d4rkdb import Database

database = Database()
database.connect("MyApp", database_url="mongodb://localhost:27017")

users = database.get_collection("users")

Collection wrapper example:

from d4rkdb import Database


class Users:
    collection_name = "users"

    def __init__(self, collection):
        self.collection = collection


database = Database()
database.connect(
    "MyApp",
    collections=[Users],
    database_url="mongodb://localhost:27017",
)

database.Users.collection.find_one({"username": "d4rk"})

You can also rely on the DATABASE_URL environment variable instead of passing database_url explicitly.

d4rkdb uses d4rklogger for logger setup when available.

Legacy imports still work:

from db import Database

Release

The release workflow uses PYPI_API_TOKEN. Never hardcode or commit the token.

PowerShell:

$env:PYPI_API_TOKEN = "pypi-..."
python scripts/release.py

Command Prompt:

set PYPI_API_TOKEN=pypi-...
python scripts/release.py

Useful options:

python scripts/release.py --dry-run
python scripts/release.py --version 0.1.4
python scripts/release.py --part minor

The script will:

  • bump the version in pyproject.toml
  • build source and wheel artifacts
  • run twine check
  • upload with PYPI_API_TOKEN unless --dry-run is set

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

d4rkdb-0.1.4.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

d4rkdb-0.1.4-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file d4rkdb-0.1.4.tar.gz.

File metadata

  • Download URL: d4rkdb-0.1.4.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for d4rkdb-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a0cb966387e3c78516d7f14e6f3a70ea93b1f4a45bd8fb94d912cc46d2f9cfc5
MD5 fd48a647f4aebcea6370381517b990f0
BLAKE2b-256 20164c8f5696294c4f7ef4174dabe5286c67f6e40b892ab15ef08fd9879495f3

See more details on using hashes here.

File details

Details for the file d4rkdb-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: d4rkdb-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for d4rkdb-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a66e5bd6a8fe0625f0afb301a819c9e7714414bc45e78e64f9c111818914461b
MD5 6eedb39a91a57e73a36d17a52e8f83e5
BLAKE2b-256 b9ceec707912829625aad5d590e8574753805dbf86494b84493403e089f7e5aa

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