Skip to main content

mswappinit

This package is expected to only be used by @mwartell for personal development projects. I've published it only after copying it into my third new project and figured an import would be easier. Others are certainly welcome to use it, but I'd be surprised.

This library provides three application bootstrap utilities

  1. project - a configuration dotenv loader that makes nice parameter accessors
  2. log - a logger that is pleasing to the author
  3. quick_db - a pickledb instance for quick and dirty persistence

project

dotenv is used to load environment variables from a file named .env these could be something like: AWS_PROFILE=cluster and these will all be loaded into the environment as expected.

this module provides convenience attribute access to project specific log variables that are loaded from the dotenv file. A PROJECT_NAME must be defined and then all other variables of the form {PROJECT_NAME}_{VAR} can be accessed as attributes of the project object.

For example, if the PROJECT_NAME is "rag" and the dotenv file contains RAG_DATA=/path/to/data then the value of project.data will be the Path object /path/to/data.

For convenience, the values are upcast to the most likely type. For example, if the value is "true" or "false" it will be converted to a boolean. If the value is a number it will be converted to an int or float. If the value is a

log

Using from mswappinit import log creates a development simple logger with log.debug, log.info and so on. Logs only go to stderr.

quick_db

If quick_db is imported, a [pickleDB][https://patx.github.io/pickledb/] instance will be created in project.data. This is a json backed key-value store. Writes should use the context manager:

from mswappinit.quick_db import quick_db
with quick_db:
    db.set("Cyclopedidae", ["Palaeomyrmidon", "Cyclopes didactylus"])

which ensures a quick_db.save() when the context exits.

Metadata

Release files for mswappinit 2025.4.30

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mswappinit 2025.4.30
File Size Uploaded
mswappinit-2025.4.30.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mswappinit 2025.4.30
File Interpreter ABI Platform
mswappinit-2025.4.30-py3-none-any.whl Python 3 none any Details

Total release size: 15.7 kB

Release files / mswappinit-2025.4.30.tar.gz

Download URL mswappinit-2025.4.30.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fc79205a9abf52ef32a954dcf1e504f2646ad7066b1f2be594b281681f25d84b
BLAKE2b-256 checksum
How to use checksums
3fd57a97f9b9dd27c39a89770c88281476bbbd5cb5bdd53cb42bf34bb3fc03d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.8

Release files / mswappinit-2025.4.30-py3-none-any.whl

Download URL mswappinit-2025.4.30-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa30a8212ebb190096fc1126e60c244dc93b63c8c070c4b322ba6ee9432fca2e
BLAKE2b-256 checksum
How to use checksums
e7a11bbe91a0a8f18521e275120801e505b298f4af552543525c5892945ae4c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.8

Release history Release notifications | RSS feed

This release

2025.4.30 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page