The idsse_common
is a location for common utilities that will be installed as a package for IDSSe micro-service deployments.
Name: config
Contents: class Config
Name: path_builder
Contents: class PathBuilder
Name: publish_confirm
Contents: class publish_confirm
Name: utils
Contents:
name: log_util
Contents:
name: json_message
Content
The following sections cover the packaging, build/install and use of the IDSSe Common code.
The complete documentation for packaging python projects can be found at Python Packaging which outlines several ways to do this. The initial packaging for the project uses setuptools to manage the dependencies and install
Developer Note: It is assumed that this idsse-commons package will be part of the standard docker container installed with all other required dependencies.
For any of the steps below, first clone this idss-engine-commons repository locally from GitHub.
cd
into/python/idsse_common
- Build the project
$ python3 setup.py install
NOTE Python 3.11+ is required to install and use this package. Install should fail for earlier versions
cd
into the project's directory (where you want to use this library)- Make sure you're command line session has a
virtualenv
created and activated- If you haven't done this, run
python3 -m venv .venv
- Activate the virtualenv with
source .venv/bin/activate
- If you haven't done this, run
- Use
pip -e
to install the library using the local path to the cloned repo'ssetup.py
. E.g.pip install -e /Users/my_user_name/idss-engine-commons/python/idsse_common
On success, you should see a message from pip like Successfully built idsse-1.x
Once installed, elements from the package can be imported directly into code. For example:
from idsse.common.path_builder import PathBuilder
my_path_builder = PathBuilder()
- Install this library's dependencies as detailed above in Building this library
- Install pytest and the pytest-cov plugin if you don't have it
pip install pytest pytest-cov
- Generate a pytest coverage report with the following command
pytest --cov --cov-report=term-missing