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

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.

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.2
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.3.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.3-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: d4rkdb-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 76156f66059ef3f25a9a5978d8efec2c3729b7e953e56da0378fa48b487fb7f4
MD5 49c4c33d64bd2033e1e6e0beb04fe3f9
BLAKE2b-256 2775cf93998f46921761a6d3ddde797b5e573ebb05515a548690f3590dc64092

See more details on using hashes here.

File details

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

File metadata

  • Download URL: d4rkdb-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1361ef5ecdbef2aef5eb1d02107d02e3fecb9937a17fd490bf2230239b24cfbd
MD5 fb8a729b7793380fe0af5ebc0be1b39b
BLAKE2b-256 1fc068e0d3bded320a0bfedcd52d6321aede2725c69e26287e7a72f79c34bf33

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