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

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.

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.1
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.2.tar.gz (4.0 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.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: d4rkdb-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 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.2.tar.gz
Algorithm Hash digest
SHA256 865c54908f801a70d36a58025343ee8957bd85d1f611fe4e17fa0eceeded0e90
MD5 b6bab91b7031f6b4e06c4426488cc0df
BLAKE2b-256 150b25357500f99ba03a0b6c5cbc3f0292b283097df58fa4393bd19b900d9263

See more details on using hashes here.

File details

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

File metadata

  • Download URL: d4rkdb-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fde1ea5acdca6b151e0a7dcc5d24c4595c31d26337d63eea0c559b23f67b4425
MD5 197f6bcb322e94c94c0118b876377327
BLAKE2b-256 4ab529568fb1457e6bddd753ed6ea6f704f003ed7b561257dfa6778888c40af0

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