3.6 KiB

Contribution guidelines

Dev Setup

Repository structure

  • src/aki_prj23_transparenzregister:

    • This sub-folder/package contains several subdirectories:
      • ai:
        • Houses AI models and pipelines, including NER and sentiment analysis.
      • config:
        • Contains configuration files such as database connection strings and model files.
      • models:
        • Stores data models.
      • ui:
        • Manages the user interface and dash interface.
      • utils:
        • Contains general tooling functions, including database access and other miscellaneous functions.
  • tests:

    • Test files organized in a mirrored structure of the 'src' folder. Please at least import every python file you add. Please Try to test every function with a test that compares with an example result. If that is not possible it would be best to find a big consensus that only limited testing is required.

Code style

We defined to use the following formats:

  • Whitespace Formatting by Black
  • Docstrings Style see the examples provided by sphinx napoleon Types in the docstrings are optional but should be consistent per module.
  • Import Order by isort
  • Strict Typing of function headers see the examples provided by the mypy documentation.
  • The generell linting is done by ruff but since ruff is a reimplementation of ruff of many different linters the old documentations are still valid.
  • Ruff can be executed with the ruff . command. May errors are auto-fixable with ruff --fix . if they are straight forward changes.

Language

We decided to use english on everything close to code but will write longer texts that are not close to the code in german.

Pre-Commit Usage

  • Install pre-commit pre-commit install --install-hooks -t post-checkout -t post-merge -t pre-commit

  • the following code format rules are so enforced:

    • Whitespace formatting:
      • Python-Black
      • leading whitespace in all files
      • Auto format: yaml, toml, ini
    • Import norm by:
      • isort
      • absolut module path
    • Validation:
      • yaml, toml, json, xml
      • Secret detection
      • python norms (pep8) with ruff
      • type checking with (mypy)
  • for more information read Python Pre-Commit