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

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

users = database.get_collection("users")

Collection wrapper example:

from database 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 database 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.5
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.5.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.5-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: d4rkdb-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 4896c9f40758460de3eba6528db7dab90495be233bd7fbfd9161cc3810762990
MD5 e198cb8d3da37fd3573a0bcbc5a18a38
BLAKE2b-256 0e44856fe2cd500538852e0bdb3dee929a746822972678d85d7fc5ded64701d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: d4rkdb-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 252683c1e40a285e825e9570623183f164780947ccc2dd4fc6ec707fa2d0c36e
MD5 65d06a215f14d92e5d695b134ae9c169
BLAKE2b-256 68b7bae0392f06e05a4aab7ec12265864e5e0ab7650fb95a2eed9ef00b9acdb1

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