Equinox Common Code Utility for Python 3 with minimal dependencies and easy installation!
Includes utilities for logging and config files
Installation
To install the latest version, use pip:
pip install datacoco-core
Logger
The logging module is a lightwight wrapper around the default logging module. Basic usage:
from datacoco_core import Logger
l = Logger()
l.l("Your important log message here')
By default the log message will be saved in a logs dir of the project root, in a file named by python module and date. For example:
cat logs/test.py-20190827-135736.log 2019-08-27 13:57:36,471 Your important message here
Optionally, parameters logname and project_name can be passed on class instantiation to customize the logfile name, and logfile path respectively.
config
The config module is a lightweight wrapper around the configparser module. It converts INI files to a dictionary object. By default, the Config class will look for a file named in etl.cfg in the project root.
Example INI config file:
[secret1] answer_to_the_universe=42
This credential can be accessed by the following example code:
from datacoco_core.config import config c = config() c['secret1']['answer_to_the_universe'] 42
Note: The config class assumes base64 hashing for any key named pwd or password. (See below)
Password Encryption
The coco config class uses base64 encryption. Any option named pwd or password will be assumed base 64 encrypted. To derive the encrypted password for your config, launch python shell and run the following command:
>>> import base64
>>> print base64.b64encode("password")
cGFzc3dvcmQ=
In python3 if you get the error TypeError: a bytes-like object is required, not 'str' do this.
>>> import base64 >>> print(base64.b64encode(b'password')) b'cGFzc3dvcmQ=
Development
Getting Started
It is recommended to use the steps below to set up a virtual environment for development:
python3 -m venv <virtual env name> source venv/bin/activate pip install --upgrade pip pip install datacoco-core
Testing
To run the testing suite, simply run the command: tox
Metadata
Release files for datacoco-core 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| datacoco_core-0.1.1.tar.gz | 4.3 kB | Without provenance | Details |
Release files / datacoco_core-0.1.1.tar.gz
| Download URL | datacoco_core-0.1.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba14eabce5881a2b40b9938d9ce787713f69a87c5bc58342e819e7a22820ada3
|
|
BLAKE2b-256 checksum How to use checksums |
d0a9be9b1fb6ff8b5361bc5b85f1e5ce61db9286a3a7c7cd33b0504833b7e12e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4
|
Security for datacoco-core 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.