A collection of useful Python modules
Project description
README
Lab Utils, a collection of useful Python modules
This package contains several useful modules to help build Python applications. All modules provide support for a configuration file using configparser and standard logging.
Available modules:
- database: simple interface to manage connections to a PostgreSQL database
- socket_comm: TCP server/client communication for daemon-like apps.
Dependencies
The package lab-utils has the following pre-requisites:
-
libpq, a C library that implements connections to the PostgreSQL backend server. The python package psycopg2 needed by the module database is built around this library, and it is strongly recommended to have it installed. If for some reason you can't install it or don't have access to it, a precompiled binary package is also available. Please notice that using precompiled binaries can lead to other problems.
-
Python 3.6 and pip 10.0 are the minimum required versions to build and install lab-utils and its dependencies. It is recommended to install and run lab-utils (and any other package, for that matter) under a virtual environment.
Python Prerequisites
The following Python packages will be automatically installed by lab-utils:
Getting Started
These instructions will install the package lab-utils and let you import its modules in your own apps. It is assumed that you have successfully installed the prerequisites and are running inside a virtual environment.
-
Clone the repository into the directory
$DIR
:git clone git@gitlab.ethz.ch:exotic-matter/cw-beam/lab-utils $DIR cd $DIR
-
Install the package and its dependencies
python -m pip install .
If you don't have PostgreSQL and libpq installed, you can use
python -m pip install . --only-binary psycopg2
-
Run some examples to test that everything works
cd examples python database/create_column.py
-
If you want to build the documentation
cd $PATH_TO_SOURCE python -m pip install .[docs] cd docs make clean make html
Import into your own app
To use a <module>
from the lab_utils collection in your own Python apps, simply add
from lab_utils import <module>
Modules
All the modules provided by the package provide support for:
- Usage of a configuration file via the
<module>.config(filename)
method - Standard Python logging.
database
This module is a simple interface to manage connections to a PostgreSQL database based on the psycopg2 library. The main features are:
- Database connection and closing
- Create a new TimescaleDB table
- Check if column and/or table exist in a given database
- Create a new column in a table, with optional constraints
socket_comm
This module implements a simple TCP server/client structure to develop daemon-like application.
Authors
- Carlos Vigo - Initial work - GitLab
Contributing
Please read our contributing policy for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use Git for versioning. For the versions available, see the tags on this repository.
License
This project is licensed under the GNU GPLv3 License
Built With
- PyCharm Community Edition - The IDE used
- Sphinx - Documentation
Acknowledgments
- Nobody so far
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 lab_utils-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d16f03c5574d925420bb0f3f500f5f6419a8fcf736c586482e2216774c8f51ae |
|
MD5 | 1bdd0102216102f8e434d1ddff66aa27 |
|
BLAKE2b-256 | cb7edff6008e63023b84f759af7ee25606263a59600b7c00c3cf4b700d5b4b8e |