Skip to content

Conversation

@schodet
Copy link
Contributor

@schodet schodet commented Sep 9, 2025

Allow usage of python version 3.13 as this is the one shipped with Debian stable since Trixie. This will make life easier for Debian users.

Add pre-commit configuration to automatically check coding style on commit. This is a useful tool, tell me what you think about it.

@coveralls
Copy link

coveralls commented Sep 9, 2025

Coverage Status

coverage: 58.75%. remained the same
when pulling 170de96 on schodet:python-pre-commit
into 9759e90 on pybricks:master.

pyproject.toml Outdated

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
python = ">=3.10,<3.14"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
python = ">=3.10,<3.14"
python = ">=3.10"

Then we don't have to change it in the future. If poetry lock fails with this, we can limit the python version in individual dependencies instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pybricks-micropython% poetry lock
Resolving dependencies... (5.9s)

The current project's supported Python range (>=3.10) is not compatible with some of the required packages Python requirement:
  - pybricksdev requires Python <3.14,>=3.10, so it will not be installable for Python >=3.14
  - pybricks requires Python <4.0,>=3.8, so it will not be installable for Python >=4.0
  - pybricks requires Python >=3.8,<4.0, so it will not be installable for Python >=4.0
  - pybricks requires Python >=3.8,<4.0, so it will not be installable for Python >=4.0
  - pybricks requires Python >=3.8,<4.0, so it will not be installable for Python >=4.0
  - pybricks requires Python >=3.8,<4.0, so it will not be installable for Python >=4.0
  - pybricks requires Python >=3.8,<4.0, so it will not be installable for Python >=4.0
  - pybricks requires Python <4.0,>=3.8, so it will not be installable for Python >=4.0
  - pybricks requires Python <4.0,>=3.8, so it will not be installable for Python >=4.0

    Because no versions of pybricksdev match >1.2.0,<2.0.0 || >2.0.0,<2.0.1 || >2.0.1
 and pybricksdev (2.0.0) depends on pybricks (>=3), pybricksdev (>1.2.0,<2.0.1 || >2.0.1) requires pybricks (>=3).
(1) So, because pybricksdev (2.0.1) depends on pybricks (>=3), pybricksdev (>1.2.0) requires pybricks (>=3).

    Because no versions of pybricks match >=3,<3.1.0 || >3.1.0,<3.2.0 || >3.2.0,<3.3.0 || >3.3.0,<3.4.0 || >3.4.0,<3.4.1 || >3.4.1,<3.5.0 || >3.5.0,<3.6.0 || >3.6.0,<3.6.1 || >3.6.1,<4.0.0
 and pybricks (3.1.0) requires Python >=3.8,<4.0, pybricks is forbidden.
    And because pybricks (3.2.0) requires Python >=3.8,<4.0
 and pybricks (3.3.0) requires Python >=3.8,<4.0, pybricks is forbidden.
    And because pybricks (3.4.0) requires Python >=3.8,<4.0
 and pybricks (3.4.1) requires Python >=3.8,<4.0, pybricks is forbidden.
    And because pybricks (3.5.0) requires Python <4.0,>=3.8
 and pybricks (3.6.0) requires Python <4.0,>=3.8, pybricks is forbidden.
    And because pybricksdev (>1.2.0) requires pybricks (>=3) (1), pybricksdev (>1.2.0) requires pybricks (3.6.1 || >=4.0.0)
    And because pybricksdev (1.2.0) requires Python <3.14,>=3.10
 and pybricks (3.6.1) requires Python <4.0,>=3.8, pybricksdev (>=1.2.0) requires pybricks (>=4.0.0).
    So, because pybricks-micropython depends on both pybricks (^3.0.0a5) and pybricksdev (>=1.2.0), version solving failed.

  * Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties

    For pybricksdev, a possible solution would be to set the `python` property to ">=3.10,<3.14"
For pybricks, a possible solution would be to set the `python` property to ">=3.10,<4.0"
For pybricks, a possible solution would be to set the `python` property to ">=3.10,<4.0"
For pybricks, a possible solution would be to set the `python` property to ">=3.10,<4.0"
For pybricks, a possible solution would be to set the `python` property to ">=3.10,<4.0"
For pybricks, a possible solution would be to set the `python` property to ">=3.10,<4.0"
For pybricks, a possible solution would be to set the `python` property to ">=3.10,<4.0"
For pybricks, a possible solution would be to set the `python` property to ">=3.10,<4.0"
For pybricks, a possible solution would be to set the `python` property to ">=3.10,<4.0"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers

I think ">=3.10,<4.0" would be safer, but it would at least mean to update the pybrickdev dep to 2.0.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... yeah, I guess since this isn't a library that others are depending on, that is fine.

CONTRIBUTING.md Outdated
This will automatically fix common problems in files that follow the MicroPython
style.

This can be run automatically using pre-commit. Install pre-commit, then run:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This can be run automatically using pre-commit. Install pre-commit, then run:
This can be run automatically using `pre-commit`. Install [pre-commit], then run:

And at the end of the section...

[pre-commit]: https://pre-commit.com/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or since it is a Python package, we could just add it as a development dependency so there isn't a separate install step.

CONTRIBUTING.md Outdated

pre-commit install

It will install a pre-commit hook for this repository. On every commit, the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It will install a pre-commit hook for this repository. On every commit, the
It will install a pre-commit git hook for this repository. On every commit, the

CONTRIBUTING.md Outdated
pre-commit install

It will install a pre-commit hook for this repository. On every commit, the
coding style will be checked before the commit is done.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked or automatically formatted?

Debian Trixie ships Python 3.13, this makes Debian users life easier.
Also document the usage in CONTRIBUTING.md.
@schodet
Copy link
Contributor Author

schodet commented Sep 10, 2025

I made the changes, I do not know why github actions is stuck…

@dlech
Copy link
Member

dlech commented Sep 10, 2025

No source code files changed, so nothing triggered that job. It's normal.

@dlech dlech merged commit 9eb3623 into pybricks:master Sep 10, 2025
16 checks passed
@dlech
Copy link
Member

dlech commented Sep 10, 2025

Merged, thanks!

@schodet schodet deleted the python-pre-commit branch September 10, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants