Handy utility code, such as coloured logging.
Project description
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
├── README.md
├── requirements.txt
└── setup.py
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
To Build From Package Source
- Create a Python virtual environment and activate. E.g.
python3 -m venv .dazbo-commons-env
source .dazbo-commons-env/bin/activate
- Install dependent packages:
py -m pip install -r requirements.txt
- Run tests. E.g.
py -m unittest discover -v -s tests -p '*.py'
- Install packages for actually creating the build. (If nto already included in
requirements.txt
):
py -m pip install twine
py -m pip install --upgrade build
-
Make any required updates to the
setup.py
file. E.g. theversion
attribute. -
Build the package.
py -m build
This generates a dist
folder in your project folder.
- Upload the package to PyPi.
Notes:
- You'll need to create a free account, if you haven't done so already.
- You'll need to generate an API token in Account Settings, for uploading to the API.
- You may want to delete any previous builds.
py -m twine upload dist/*
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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dazbo_commons-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6af332a5b670d245d3775f4c3efd9ec1ef982bf547305d2e27bb62cc39f086e1 |
|
MD5 | a9f47343f303b091213a68b9ce134073 |
|
BLAKE2b-256 | 8c9a47dbb1e6b9450cddd37906764217c64f263a8e10aa395d48bf5aed3479e4 |