billwarrior icon indicating copy to clipboard operation
billwarrior copied to clipboard

RFC: `billwarrior install` command

Open jonafato opened this issue 2 years ago • 1 comments

TL;DR: I'm proposing a billwarrior install command to copy config files into the proper locations instead of keeping this logic in setup.py.

Currently, billwarrior writes some config files via setup.py. This is a bit tricky, because according to the Python docs the data_files key is not meant for arbitrary installation locations (see below).

The directory should be a relative path. It is interpreted relative to the installation prefix (Python’s sys.prefix for system installations; site.USER_BASE for user installations). Distutils allows directory to be an absolute installation path, but this is discouraged since it is incompatible with the wheel packaging format.

Because of this limitation, relying on setup.py for putting files in the right place on the system limits distribution options. I'm opening this issue to suggest a new CLI command billwarrior install, which would do the following:

  1. Create the sample config file
  2. Copy the sample invoice templates to their proper location (failing or prompting if this action would overwrite an existing file)
  3. Install the billwarrior extension to the proper path by detecting the user's extensions path via timew extensions (this is detailed as a TODO in the readme, and I think it makes sense to include here)

I'm happy to put this together if you're open to the change. I wanted to open an issue first since it's a change to the UI as well as a breaking change to the existing billwarrior CLI script (which would need to get a new command for the existing behavior to accommodate this change).

jonafato avatar Sep 15 '21 05:09 jonafato

Yes, I think that makes sense - setup.py should really only deal with package installation and not mess about with paths outside it.

Happy for you to proceed with billwarrior install and thanks for helping out!

sw00 avatar Sep 15 '21 20:09 sw00