Skip to content

Conversation

@schaefi
Copy link
Collaborator

@schaefi schaefi commented Mar 19, 2025

This commit moves the kiwi commandline and plugin interface to typer and drops the use of docopt. Typer is based on python type hints and allows for a more modern way to define Cli interfaces and auto completion, even for plugins. Also docopt is split into an old and a next generation variant and allows us to get rid of spec file hacks as well as documentation rendering hacks.

@schaefi schaefi self-assigned this Mar 19, 2025
@schaefi
Copy link
Collaborator Author

schaefi commented Mar 19, 2025

There are still open tasks before we can consider this change to go in

  • stackbuild plugin needs cli.py: TBD by @schaefi
  • box plugin needs cli.py: TBD by @schaefi
  • is python-typer package available in all distros ?

@schaefi schaefi force-pushed the move_to_typer branch 5 times, most recently from ace7dab to fb35cbd Compare March 19, 2025 15:23
@schaefi
Copy link
Collaborator Author

schaefi commented Mar 19, 2025

@Conan-Kudo I'm mostly interested in getting the open questions from the checklist answered, so no need to do an in-depth review of the code changes as it's time consuming. Thanks much

@schaefi schaefi requested a review from Conan-Kudo March 19, 2025 15:29
schaefi added a commit to OSInside/kiwi-boxed-plugin that referenced this pull request Mar 19, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
schaefi added a commit to OSInside/kiwi-boxed-plugin that referenced this pull request Mar 19, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
schaefi added a commit to OSInside/kiwi-boxed-plugin that referenced this pull request Mar 19, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
schaefi added a commit to OSInside/kiwi-boxed-plugin that referenced this pull request Mar 19, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
schaefi added a commit to OSInside/kiwi-boxed-plugin that referenced this pull request Mar 20, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
schaefi added a commit to OSInside/kiwi-boxed-plugin that referenced this pull request Mar 20, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
@Conan-Kudo
Copy link
Member

We can't drop Python 3.9 support since that's required for CentOS/RHEL 9.

@schaefi
Copy link
Collaborator Author

schaefi commented Mar 20, 2025

We can't drop Python 3.9 support since that's required for CentOS/RHEL 9.

I found a fix to make it work on 3.9 too

schaefi added a commit to OSInside/kiwi-boxed-plugin that referenced this pull request Mar 20, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
schaefi added a commit to OSInside/kiwi-boxed-plugin that referenced this pull request Mar 20, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
schaefi added a commit to OSInside/kiwi-stackbuild-plugin that referenced this pull request Mar 20, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
schaefi added a commit to OSInside/kiwi-stackbuild-plugin that referenced this pull request Mar 20, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
schaefi added a commit to OSInside/kiwi-stackbuild-plugin that referenced this pull request Mar 20, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
schaefi added a commit to OSInside/kiwi-stackbuild-plugin that referenced this pull request Mar 20, 2025
In addition to docopt also support the typer
commandline interface. This is relevant for
kiwi versions that has moved to typer.
OSInside/kiwi#2751
@schaefi
Copy link
Collaborator Author

schaefi commented Mar 20, 2025

@Conan-Kudo I finished the Cli change and also updated the plugins. The plugins continues to support both docopt and typer such that they can continue to work also with older versions of kiwi. The upstream kiwi should change to typer and the interface is a drop-in-replacement such that there should be no difference in the former caller semantic.

The only open question is if the typer python module is available in all distros we support. I did a short test on Virtualization:Appliances:Staging/python-kiwi and it would build the package for all targets that exists there except for ALP which is an issue that I need to resolve prior merge

Also I appreciate your feedback with regards to the other OS'es

Thanks

@schaefi
Copy link
Collaborator Author

schaefi commented Mar 20, 2025

And there is also the question on the min version of typer in the pyproject.toml to be ok or not

@schaefi schaefi removed the blocked label Mar 24, 2025
@Conan-Kudo Conan-Kudo marked this pull request as draft March 25, 2025 10:54
@schaefi schaefi force-pushed the move_to_typer branch 2 times, most recently from 6ca82a6 to ea0e919 Compare March 25, 2025 11:24
@schaefi schaefi force-pushed the move_to_typer branch 2 times, most recently from 134d296 to f8234e1 Compare May 27, 2025 09:24
@schaefi
Copy link
Collaborator Author

schaefi commented Jan 5, 2026

  • port --ca-cert option
  • port --ca-target-distribution

@schaefi schaefi force-pushed the move_to_typer branch 2 times, most recently from dfcf2c5 to 655873b Compare January 7, 2026 10:08
This commit moves the kiwi commandline and plugin interface
to typer and drops the use of docopt. Typer is based on python
type hints and allows for a more modern way to define Cli
interfaces and auto completion, even for plugins. Also docopt
is split into an old and a next generation variant and allows
us to get rid of spec file hacks as well as documentation
rendering hacks.
See in code comment for the reason
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants