duckinator / bork

A Python build and release management tool.
https://bork.readthedocs.io
MIT License
12 stars 2 forks source link

Allow overriding zipapp config from command line #280

Closed duckinator closed 1 month ago

duckinator commented 2 years ago

Being able to pass arguments to bork build to override zipapp configuration would be very nice, especially for testing/debugging if a zipapp of a project can be built.

I'm thinking:

--zipapp [true|false]       If true, build a zipapp. Otherwise, don't build a zipapp.
--zipapp-name NAME          NAME is the name of the project, as used in the ZipApp filename.
--zipapp-main ENTRYPOINT    ENTRYPOINT is of the format "some.module:function_name". Implies `--zipapp true`.

This means if you want to test a zipapp build, you can just do (e.g.) bork build --name fido --zipapp-main fido.fido:main

duckinator commented 2 years ago

This issue was inspired by trying to make a ZipApp of fido: https://github.com/openpreserve/fido

I downloaded the latest release, and made very few changes and was able to make a zipapp of it.

First, I added a pyproject.toml with these contents:

[tool.bork.zipapp]
enabled = true
main = "fido.fido:main"

And added this at the start of their setup.cfg:

[metadata]
name=fido

If what I suggested above, or an equivalent, is implemented, this can be done with bork build --zipapp-name fido --zipapp-main fido.fido:main and no code changes from what they already have.