Development
Requirements
While not strictly required we assume that you installed
in the description below.
Install
You can use the instructions below, if you want to work on the code of the ICOtronic package, i.e. add additional features or fix bugs.
Clone the repository to a directory of your choice. You can either use the command line tool
git:git clone https://github.com/MyTooliT/ICOtronic.git
or one of the many available graphical user interfaces for Git to do that.
Install ICOtronic with uv
Change your working directory to the (root) directory of the cloned repository
Install ICOtronic:
just setupNotes:
The command above will install the package in a virtual environment.
You need to prefix commands, such as
iconwith the commanduv run(e.g.uv run icon) to execute it in this virtual environment.Using
uv runwill only work in the root folder of the repository (that containspyproject.toml).
Install other required tools (for tests)
hdf5: For the command line toolh5dump(Linux/macOS). You can install hdf5 via Homebrew:brew install hdf5
Style
Please use the guidelines from PEP 8. For code formatting we currently use Black, which should format code according to PEP 8 by default.
To format the whole code base you can use the following command in the root of the repository:
uv black .
For development we recommend that you use a tool or plugin that reformats your code with Black every time you save. This way we can ensure that we use a consistent style for the whole code base.
Tests
The following text describes some of the measures we should take to keep the software stable:
Please only push your changes to the
mainbranch, if you think there are no new bugs or regressions. Themainbranch should always contain a working version of the software.Please always run the automatic test (
just run) for every supported OS (Linux, macOS, Windows) before you push to themainbranch.
Code Checks
Flake8
We check the code with Flake8. Please use the following command in the root of the repository to make sure you did not add any code that introduces warnings:
uv run flake8
mypy
To check the type hint in the code base we use the static code checker mypy. Please use the following command in the root of the repository to check the code base for type problems:
uv run mypy icotronic
Pylint
We currently use Pylint to check the code:
uv run pylint .
Automatic Tests
Usage
Please run the following command in the root of the repository:
uv run pytest -v
and make sure that it reports no test failures.
Manual Tests
The text below specifies the manual test that should be executed before we release a new version of the ICOtronic package. Please note that the tests assume that you more or less use the default configuration values.
Check the Performance of the Library
Open your favorite terminal application and change your working directory to the root of the repository
Remove HDF5 files from the repository:
rm *.hdf5Note: You can ignore errors about “no matches for wildcard” on Linux and macOS. This message just tells you that there is no file with the extension
hdf5in the current directory.Check that no HDF5 files exist in the repository. The following command should not produce any output:
ls *.hdf5Give your test STH the name “Test-STH”
Run the following command
uv run icon measure -t 300 -n Test-STH
The command should not print any error messages.
The data loss must be below 1 %.
Check that the repo now contains a HDF5 (
*.hdf5) filels *.hdf5Open the file in HDFView
Check that the timestamp of the last value in the
accelerationtable has approximately the value30 000 000(all values above29 900 000should be fine).
Combined Checks & Tests
While you need to execute some test for the ICOtronic package manually, other tests and checks can be automated. To run all automated checks and tests use the following just command:
just
Release
Check that the CI jobs for the
mainbranch finished successfullyCheck that the most recent “Read the Docs” build of the documentation ran successfully
Check that the checks and tests run without any problems on Linux, macOS and Windows. To do that execute them command:
just
in the root of the repository
Execute the manual tests in Windows and check that everything works as expected.
Update the release notes:
Open the release notes for the latest version
Replace links with a permanent version:
For example instead of
../../something.txtusehttps://github.com/MyTooliT/ICOtronic/blob/REVISION/something.txt,
where
REVISIONis the latest version of the main branch (e.g.8568893ffor version1.0.5)Commit your changes
Change the version number and commit your changes (please replace
<VERSION>with the version number e.g.1.0.5):just release <VERSION>
Note: GitHub Actions will publish a package based on the tagged commit and upload it to PyPi.
Create a new release here
Insert the version number (e.g.
1.0.5) into the tag fieldFor the release title use “Version
”, where <VERSION>specifies the version number (e.g. “Version 1.0.5”)Paste the release notes for the lastest release into the main text field
Click on “Publish Release”
Note: Alternatively you can also use the
ghcommand:gh release create
to create the release notes.
Close the milestone for the latest release number