Python packaging

The package template we discussed today is available in the section GitLab: https://gitlab.cern.ch/dsb/devops/python-package-template

You can use it as reference on what to include in your pyproject.toml, docs, CI pipeline, tests, etc.

The DSB pkginit package is hosted also on GitLab: https://gitlab.cern.ch/dsb/devops/devtools It is not yet 100% foolproof and deployed on Acc-Py on the TN. I will send a second email when it is ready with instructions how to use it.

Devops tools that you might want to use

Linters IDEs will do the main linting for you. I personally use ruff in the pre-commit to have a double check. https://docs.astral.sh/ruff/

Formatters Ruff: https://docs.astral.sh/ruff/ Black: https://black.readthedocs.io/en/stable/getting_started.html

Recent versions of Ruff implement a formatter ruff format that should format according to the same rules as black. This will likely replace black in the future.

Modern IDEs support running formatters like black on save: PyCharm: https://www.jetbrains.com/help/pycharm/reformat-and-rearrange-code.html#format-python-code-with-black VSCode: https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter

Type checkers MyPy: https://mypy.readthedocs.io/en/stable/ Optional, but highly recommended.

Pre-commit Checks your code before it’s committed https://pre-commit.com

Dotfiles

My personal dotfiles that contain useful functions and aliases, as well as SSH configurations for kerberos and dynamically use lxtunnel if you are not at CERN for SSH connections.

Repository: https://github.com/antolu/dotfiles zshrc/bashrc: https://github.com/antolu/dotfiles/blob/4d4fc0c2859b2b10c1ecb8ef3fa71cbd7e5650db/dot_zshrc.tmpl#L55 SSH config: https://github.com/antolu/dotfiles/blob/4d4fc0c2859b2b10c1ecb8ef3fa71cbd7e5650db/private_dot_ssh/config.tmpl#L21