Tim ea7c955533 fixed sqlAlchemy and db connection
Co-authored-by: Tristan Nolde <TrisNol@users.noreply.github.com>
2023-08-14 20:59:30 +02:00

2.3 KiB

Contribution guidelines

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.

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 installation

  • clone the project

  • install the following python package:

    • pre-commit
  • execute the command pre-commit install to insert the git githook into your local repository.

    • for more information read Python Pre-Commit
    • the following code format rules are so enforced:
      • Whitespace formatierung:
        • Python-Black
        • leading whitespace in all files
        • Auto format: yaml, toml, ini
      • Import norm by:
        • isort
        • absolut module path
      • Validierung:
        • yaml, toml, json, xml
        • Secret detection
        • python normen (pep8) with flake8
        • type checking with (mypy)
  • Install Python 3.11

  • Install Poetry

pip install poetry
  • Install dependencies
poetry install

Setup

Connection strings

Create a secrets.json in the root of this repo with the following structure (values to be replaces by desired config):

   {
    "postgres": {
      "username": "postgres",
      "password": "postgres",
      "host": "localhost",
      "database": "postgres",
      "port": 5432
    },
    "mongo": {
      "username": "username",
      "password": "password",
      "host": "localhost",
      "database": "transparenzregister",
      "port": 27017
    }
  }

Example usage see connector.py