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 db import Database

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

users = database.get_collection("users")

Collection wrapper example:

from db 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.

Import the shared instance directly:

from db import db

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.6
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.6.tar.gz (4.4 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.6-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: d4rkdb-0.1.6.tar.gz
  • Upload date:
  • Size: 4.4 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.6.tar.gz
Algorithm Hash digest
SHA256 aa73258f3986ef5c5fd6c4c03eb47d2c353fac06b36f28e6423f2e884d61e372
MD5 825411788559c4ef81dd7e4dc9cda674
BLAKE2b-256 72d07dc0cc11fb6bb267b66a2ef27445b89222c6a68de43c2f4771309ae8cffd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: d4rkdb-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 3.3 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6bdf7f6d8343841934056c503970b911c69eb743f76269cf6e148f3eef93dc09
MD5 1f33115bedd985768a8817c6a6b1d822
BLAKE2b-256 c4695404a0a30f554816377846dfe68f88228194acbb9b527fba3e97a1fbd177

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