Git Product home page Git Product logo

dazbo-commons-py's Introduction

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

To Build From Package Source

  1. Create a Python virtual environment and activate. E.g.
python3 -m venv .dazbo-commons-env
source .dazbo-commons-env/bin/activate
  1. Install dependent packages:
py -m pip install -r requirements.txt
  1. Run tests. E.g.
py -m unittest discover -v -s tests -p '*.py'
  1. 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
  1. Make any required updates to the pyproject.toml file. E.g. the version attribute.

  2. Build the package.

py -m build

This generates a dist folder in your project folder.

  1. 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!

dazbo-commons-py's People

Contributors

derailed-dash avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.