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.inicontains 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.txtcontains loose dependencies. - (I’ll save the discussion about the
srcfolder for later, if ever.)
Some potential improvements:
- Move the configuration switches of all tools used in the Tox setup to
pyproject.toml, keeptox.inias clean and simple as possible. – process implementation in one file, the tool behavior setup in another. - Via
pyproject.tomlthe 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.txtgenerated 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).