Skip to content

Use pyproject.toml as Python version source #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2024
Merged

Use pyproject.toml as Python version source #292

merged 1 commit into from
Jun 13, 2024

Conversation

per1234
Copy link
Collaborator

@per1234 per1234 commented Jun 13, 2024

All execution, development and validation for the project is performed using a specific version of Python.

Poetry is used for Python package dependencies management. Poetry installs dependencies into a virtual environment. For this reason, the Poetry configuration includes a Python version number, which must match the correct version of Python for the project. This configuration is stored in the pyproject.toml file.

Python is installed in the GitHub Actions runner environments using the actions/setup-python action, which also must be configured to install the correct version of Python. Previously the version number for use by the actions/setup-python action was defined in the .python-version file. This allowed the Python version for use by the arduino/compile-sketches action's execution and all the workflows that make up its infrastructure to be configured from a single source. However, Poetry does not support the .python-version file so we were stuck with two copies of the Python version information, which must be kept in sync.

Fortunately, support for using pyproject.toml as the version file for the actions/setup-python action was recently added (actions/setup-python@0d5da6a). This means it is now possible for all components of the project infrastructure to get the Python version from a single source.

All execution, development and validation for the project is performed using a specific version of Python.

Poetry is used for Python package dependencies management. Poetry installs dependencies into a virtual environment. For
this reason, the Poetry configuration includes a Python version number, which must match the correct version of Python
for the project. This configuration is stored in the `pyproject.toml` file.

Python is installed in the GitHub Actions runner environments using the actions/setup-python action, which also must be
configured to install the correct version of Python. Previously a the version number for use by the actions/setup-python
action was defined in the `.python-version` file. This allowed the Python version for use by the
arduino/compile-sketches action's execution and all the workflows that make up its infrastructure to be configured from
a single source. However, Poetry does not support the `.python-version` file so we were stuck with two copies of the
Python version information, which must be kept in sync.

Fortunately, support for using `pyproject.toml` as the version file for the actions/setup-python action was recently
added. This means it is now possible for all components of the project infrastructure to get the Python version from a
single source.
@per1234 per1234 added type: enhancement Proposed improvement topic: infrastructure Related to project infrastructure labels Jun 13, 2024
@per1234 per1234 self-assigned this Jun 13, 2024
@per1234 per1234 merged commit 1719ade into arduino:main Jun 13, 2024
33 checks passed
@per1234 per1234 deleted the pyproject_toml-version-file branch June 13, 2024 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant