Development processes

For software development purposes alexandria3k can also be installed and used through its Github repository, rather than as a Python package.

Installation

git clone https://github.com/dspinellis/alexandria3k.git
cd alexandra3k/src
pipenv install

Development environment

Perform the following steps for setting up a virtual environment with the required development dependencies.

# While in alexandria3k/src directory

# Install development dependencies
pipenv install --dev

# Launch a shell in the virtual environment
pipenv shell

You can the run the command-line version from the source distribution top-level directory as follows:

bin/alexandria3k --help

Continuous integration

GitHub actions are used for running unit tests, linting, verifying the code’s format, as well as building the package and the documentation when a new commit is pushed to GitHub. Before doing so, it’s advisable to perform these actions locally, as detailed in the following sections.

Testing

Python unit and integration tests

# While in the top-level directory
python3 -m unittest discover

SQL unit tests

To run SQL unit tests install rdbunit and the SQLite command-line tool.

# While in the top-level directory
for t in tests/*.rdbu; do rdbunit --database=sqlite $t | sqlite3 ; done

Code formatting

# While in the top-level directory
find src -name '*.py' | xargs black -l 79

Linting

# While in the top-level directory
find src -name '*.py' | xargs python -m pylint --rcfile .pylintrc

Plugin documentation

When data source of processing plugins are added the Python API documentation must be updated as follows.

# While in the top-level directory
bin/update-python-api

Database schema diagrams

After the database schema has changed, its relational diagrams in the documentation must be updated as follows.

# While in the top-level directory
bin/update-schema

This requires an installed version of the GraphViz dot command.

Building

# While in the top-level directory
python3 -m build

Documentation building

The process for converting the documentation into HTML and a Unix man page is documented in the installation instructions.