Skip to main content

Dazbo Commons

Table of Contents

Overview

A reusable utility library.

dazbo-commons/
│
├── src/
│   └── dazbo_commons/
│       ├── __init__.py
│       └── colored_logging.py
│
├── tests/
│   └── test_colored_logging.py
│
├── .env
├── .gitignore
├── LICENSE
├── pyproject.toml
├── README.md
└── requirements.txt

To Install and Use

You can simply install the package from PyPi. There's no need to clone this repo.

pip install --upgrade dazbo-commons

Then, in your Python code, include this import:

import dazbo_commons as dc

Coloured Logging Module

This module provides a function to retrieve a logger that logs to the console, with colour.

Example:

import logging
import dazbo_commons as dc

logger_name = __name__ # or just pass in a str
logger = dc.retrieve_console_logger(logger_name)
logger.setLevel(logging.INFO) # Set threshold. E.g. INFO, DEBUG, or whatever

logger.info("Some msg") # log at info level

File Locations Module

This module is used to retrieve a Locations class, which stores directory paths based on the location of a specified script. This makes it convenient to manage and access different file and directory paths relative to a given script's location.

Example:

import dazbo_commons as dc
APPNAME = "My_App"

locations = get_locations(APP_NAME)

with open(locations.input_file, mode="rt") as f:
    input_data = f.read().splitlines()

To Build From Package Source

  1. Create a Python virtual and install dependencies. E.g.
make install # runs uv sync
  1. Run tests. E.g.
make test

# Or for more verbose logging
py -m unittest discover -v -s tests -p '*.py'
  1. Make any required updates to the pyproject.toml file. E.g. the version attribute.

  2. Build the package.

make build-dist

This generates a dist folder in your project folder and uploads it to PyPi.

You'll be prompted for your API token. In my experience, when doing this from a terminal inside VS Code, Ctrl-V doesn't work here. So I use Paste from the menu, and this works.

And we're done!

Metadata

Release files for dazbo-commons 0.2.0

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

Source distribution (sdist)

Source distribution for dazbo-commons 0.2.0
File Size Uploaded
dazbo_commons-0.2.0.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dazbo-commons 0.2.0
File Interpreter ABI Platform
dazbo_commons-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / dazbo_commons-0.2.0.tar.gz

Download URL dazbo_commons-0.2.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6d047de07bc9728a1d06487bf6efcf62b14b999ccd8d41409737e56847ecc3c0
BLAKE2b-256 checksum
How to use checksums
a8891a212d15ce5b7cd9ba2ce6029f8f0498bb131b9b5038739f088baa0a89e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / dazbo_commons-0.2.0-py3-none-any.whl

Download URL dazbo_commons-0.2.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b8338ee04b3138a3bc9bf01636bf9b3c787b647cd7856dd6a2e75a4a6e8f3be
BLAKE2b-256 checksum
How to use checksums
61bffc695c1fe28592b3c29893ca8c37de783673f169da685a9cf6786e1be816
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

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