I’m looking at building charms from an application development (deployment and operations) perspective, and I was wondering whether it was feasible to make the current init-simple
template more elegant, future-proof and maintainable.
My current take is:
-
tox.ini
contains some slightly convoluted configuration details that take a while to analyse (e.g.[vars]
section,{[vars]all_path}
in several places, Coverage and Pytest are run with several command line options). - The project setup is “Python script” style (i.e. comparable to a Django project setup).
-
requirements.txt
contains loose dependencies. - (I’ll save the discussion about the
src
folder for later, if ever.)
Some potential improvements:
- Move the configuration switches of all tools used in the Tox setup to
pyproject.toml
, keeptox.ini
as clean and simple as possible. – process implementation in one file, the tool behavior setup in another. - Via
pyproject.toml
the charm could be configured as a Python package, possibly with a mandatory[project.scripts]
section. – provide clean isolation for testing and deployment. - Loose dependencies may be kept in
pyproject.toml
([project]
.dependencies
) andrequirements.txt
generated for the purpose of deployment documentation only (e.g. usingpip-tools
’pip-compile
).
I’m interested what you think about changes like that. Also because they are very specific to charms being implemented in Python (and running Python code as a script certainly resonates with a possible implementation in other scripting languages).