Package a Charm by default

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:

  1. 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).
  2. The project setup is “Python script” style (i.e. comparable to a Django project setup).
  3. requirements.txt contains loose dependencies.
  4. (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, keep tox.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) and requirements.txt generated for the purpose of deployment documentation only (e.g. using pip-toolspip-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).