| 1 |
Contributing |
| 2 |
============ |
| 3 |
|
| 4 |
.. note:: **Abstract** |
| 5 |
|
| 6 |
This document describes the development process of {kiwi} |
| 7 |
and how you can be part of it. This description applies |
| 8 |
to version |version|. |
| 9 |
|
| 10 |
.. toctree:: |
| 11 |
:maxdepth: 1 |
| 12 |
|
| 13 |
contributing/kiwi_from_python |
| 14 |
contributing/kiwi_plugin_architecture |
| 15 |
contributing/scripts_testing |
| 16 |
contributing/schema_extensions.rst |
| 17 |
|
| 18 |
The core appliance builder is developed in Python and follows the |
| 19 |
test-driven development rules. |
| 20 |
|
| 21 |
If you want to implement a bigger feature, consider opening an issue on |
| 22 |
GitHub first to discuss the changes. Or, join the discussion in the |
| 23 |
`#kiwi` channel on `Matrix <https://matrix.to/#/#kiwi:matrix.org>`_. |
| 24 |
|
| 25 |
Fork the upstream repository |
| 26 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 27 |
|
| 28 |
1. On GitHub, navigate to: https://github.com/OSInside/kiwi. |
| 29 |
|
| 30 |
2. In the top-right corner of the page, click :command:`Fork`. |
| 31 |
|
| 32 |
Create a local clone of the forked repository |
| 33 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 34 |
|
| 35 |
.. code:: shell-session |
| 36 |
|
| 37 |
$ git clone https://github.com/YOUR-USERNAME/kiwi |
| 38 |
|
| 39 |
$ git remote add upstream https://github.com/OSInside/kiwi.git |
| 40 |
|
| 41 |
Install Required Operating System Packages |
| 42 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 43 |
|
| 44 |
{kiwi} requires additional packages at runtime that are not |
| 45 |
provided by `pip`. Those will be pulled in by installing |
| 46 |
the following package: |
| 47 |
|
| 48 |
* kiwi-systemdeps |
| 49 |
|
| 50 |
The package is provided on the Open Build Service in the |
| 51 |
`Virtualization:Appliances:Builder |
| 52 |
<https://download.opensuse.org/repositories/Virtualization:/Appliances:/Builder>`__ |
| 53 |
project. For manual inspection of the packages |
| 54 |
that are pulled in from the above `kiwi-systemdeps` package, please refer |
| 55 |
to the `package/python-kiwi-spec-template` spec file from the |
| 56 |
checked-out Git repository. |
| 57 |
|
| 58 |
Create a Python Virtual Development Environment |
| 59 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 60 |
|
| 61 |
The following commands initialize and activate a development |
| 62 |
environment for Python 3: |
| 63 |
|
| 64 |
.. code:: shell-session |
| 65 |
|
| 66 |
$ poetry install --all-extras |
| 67 |
|
| 68 |
.. note:: |
| 69 |
|
| 70 |
To create the python virtual env for another version of |
| 71 |
Python, e.g. 3.11, call the following prior the poetry install |
| 72 |
:: |
| 73 |
|
| 74 |
$ poetry env use python3.11 |
| 75 |
|
| 76 |
The command above automatically creates the application script |
| 77 |
called :command:`kiwi-ng`, which allows you to run {kiwi} from the |
| 78 |
Python sources inside the virtual environment using Poetry: |
| 79 |
|
| 80 |
.. code:: shell-session |
| 81 |
|
| 82 |
$ poetry run kiwi-ng --help |
| 83 |
|
| 84 |
Running the Unit Tests |
| 85 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 86 |
|
| 87 |
Before submitting your changes via a pull request, ensure that all tests |
| 88 |
pass and that the code has the required test coverage via the command: |
| 89 |
|
| 90 |
.. code:: shell-session |
| 91 |
|
| 92 |
$ make check |
| 93 |
$ make test |
| 94 |
|
| 95 |
Coding Style |
| 96 |
~~~~~~~~~~~~ |
| 97 |
|
| 98 |
{kiwi} follows the general PEP8 guidelines. |
| 99 |
|
| 100 |
Documentation |
| 101 |
~~~~~~~~~~~~~ |
| 102 |
|
| 103 |
{kiwi} uses `Sphinx <https://www.sphinx-doc.org/en/master/>`_ for the |
| 104 |
user documentation and man pages. |
| 105 |
|
| 106 |
.. code:: shell-session |
| 107 |
|
| 108 |
$ make docs |
| 109 |
|
| 110 |
Bumping the Version |
| 111 |
~~~~~~~~~~~~~~~~~~~ |
| 112 |
|
| 113 |
The {kiwi} project follows the `Semantic Versioning <https://semver.org>`_ |
| 114 |
scheme. We use the :command:`bumpversion` tool for consistent versioning. |
| 115 |
|
| 116 |
AI policy |
| 117 |
~~~~~~~~~ |
| 118 |
|
| 119 |
{kiwi} has a policy of human-centric development. Only humans can be authors |
| 120 |
and are ultimately responsible for the quality of their contributions. |
| 121 |
That said, assisted development with "AI" tools (particularly contemporary |
| 122 |
LLM-based tools) is permitted with the restriction that such usage is clearly |
| 123 |
labeled with the `Assisted-by:` trailer in the pull request and commit message. |
| 124 |
The format of the trailer is as such: `Assisted-by: <Tool>:<model-id>`. |
| 125 |
|
| 126 |
Examples of such trailers: |
| 127 |
|
| 128 |
================= ======================================= |
| 129 |
Tool Trailer |
| 130 |
================= ======================================= |
| 131 |
Claude `Assisted-by: Claude:claude-opus-4-6` |
| 132 |
Gemini `Assisted-by: Gemini:gemini-2.5-pro` |
| 133 |
GitHub Copilot `Assisted-by: Copilot:gpt-4o` |
| 134 |
ChatGPT `Assisted-by: ChatGPT:gpt-4o` |
| 135 |
================= ======================================= |
| 136 |
|
| 137 |
The trailers are required for the following scenarios: |
| 138 |
|
| 139 |
- AI wrote or generated code that ended up in the commit |
| 140 |
- AI substantially modified or refactored existing code |
| 141 |
- AI generated an implementation that the contributor then adapted |
| 142 |
|
| 143 |
It is **not** required for the following scenarios: |
| 144 |
|
| 145 |
- AI was used for **research only** - asking questions, understanding APIs, |
| 146 |
exploring approaches - but the human wrote all the code |
| 147 |
- AI performed purely **mechanical tasks** like formatting, running |
| 148 |
commands, or committing |
| 149 |
|
| 150 |
All submitted changes must be at least self-reviewed and all other |
| 151 |
guidelines continue to apply (follow code style, pass tests, make tests |
| 152 |
for new functionality, etc.) |
| 153 |
|
| 154 |
Intentional obfuscation of AI tooling usage is grounds for rejection |
| 155 |
and may result in being blocked from future contributions. |
| 156 |
|
| 157 |
Creating an RPM Package |
| 158 |
~~~~~~~~~~~~~~~~~~~~~~~ |
| 159 |
|
| 160 |
We provide a template for an RPM spec file in |
| 161 |
:file:`package/python-kiwi-spec-template` alongside a `rpmlint` |
| 162 |
configuration file and an automatically updated |
| 163 |
:file:`python-kiwi.changes`. |
| 164 |
|
| 165 |
To create the necessary files to build an RPM package via `rpmbuild`, run: |
| 166 |
|
| 167 |
.. code:: shell-session |
| 168 |
|
| 169 |
$ make build |
| 170 |
|
| 171 |
The sources are collected in the :file:`dist/` directory. These can be |
| 172 |
directly built with :command:`rpmbuild`, :command:`fedpkg`, or submitted |
| 173 |
to the Open Build Service using :command:`osc`. |