Skip to content
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

[FIX] github pre-commit action: pin python version to 3.11 #214

Merged
merged 2 commits into from
Oct 27, 2023

Conversation

em230418
Copy link
Contributor

@em230418 em230418 commented Oct 27, 2023

Recently I had problems with passing pre-commit, since github action started to use Python 3.12

When running pre-commit action on 3.12 you get following errors:

autoflake................................................................Failed
- hook id: autoflake
- exit code: 1

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repo7lg_lq3_/py_env-python3/bin/autoflake", line 5, in <module>
    from autoflake import main
  File "/home/runner/.cache/pre-commit/repo7lg_lq3_/py_env-python3/lib/python3.12/site-packages/autoflake.py", line 32, in <module>
    import distutils.sysconfig
ModuleNotFoundError: No module named 'distutils'
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repotxkzga5l/py_env-python3/bin/flake8", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/runner/.cache/pre-commit/repotxkzga5l/py_env-python3/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "/home/runner/.cache/pre-commit/repotxkzga5l/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 363, in run
    self._run(argv)
  File "/home/runner/.cache/pre-commit/repotxkzga5l/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 350, in _run
    self.initialize(argv)
  File "/home/runner/.cache/pre-commit/repotxkzga5l/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 330, in initialize
    self.find_plugins(config_finder)
  File "/home/runner/.cache/pre-commit/repotxkzga5l/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 153, in find_plugins
    self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pre-commit/repotxkzga5l/py_env-python3/lib/python3.12/site-packages/flake8/plugins/manager.py", line 356, in __init__
    self.manager = PluginManager(
                   ^^^^^^^^^^^^^^
  File "/home/runner/.cache/pre-commit/repotxkzga5l/py_env-python3/lib/python3.12/site-packages/flake8/plugins/manager.py", line 238, in __init__
    self._load_entrypoint_plugins()
  File "/home/runner/.cache/pre-commit/repotxkzga5l/py_env-python3/lib/python3.12/site-packages/flake8/plugins/manager.py", line 254, in _load_entrypoint_plugins
    eps = importlib_metadata.entry_points().get(self.namespace, ())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'EntryPoints' object has no attribute 'get'

Pinning to 3.11 fixes errors above.

@legalsylvain
Copy link
Contributor

Thanks !

Some test are failing. Could you take a look ?

@em230418
Copy link
Contributor Author

Some test are failing. Could you take a look ?

Python 2.7 issue. Related PR #199

@@ -13,4 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
python-version: "3.11"
Copy link
Member

Choose a reason for hiding this comment

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

I think this one shouldn't be pinpointed. The problem is in pre-commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this one shouldn't be pinpointed. The problem is in pre-commit.

I think otherwise. Github action should not behave differently when suddenly other python version is used.

Copy link
Member

Choose a reason for hiding this comment

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

The problem pinpointing this is that when GitHub removes this version in the future, we will have a red CI, and meanwhile lots of version have passed, and we lost the opportunity to improve during it. It's not a big deal though, as this is only the CI for this repo, and the effort to change it is not too much.

The template is other beast, as it propagates to each OCA repo, but pinpointing is right now the only option (or wait till pre-commit fixes whatever problem it is), and maybe we will need to raise any library version as well.

Copy link
Member

Choose a reason for hiding this comment

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

I think we must pin the python version for pre-commit, just like we pin it for running tests.
Otherwise we hit this kind of issue every time GitHub upgrades its default python.

My suggestion would be to use the same python version as for the tests.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure what you want to say here. Can you do a suggestion if still on time?

pedrobaeza added a commit to Tecnativa/sale-workflow that referenced this pull request Oct 27, 2023
@pedrobaeza
Copy link
Member

Being tested in OCA/sale-workflow#2748

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

@sbidoul @yajo can you make a new release and maybe launch the massive update for 15/16?

@sbidoul
Copy link
Member

sbidoul commented Oct 27, 2023

can you make a new release and maybe launch the massive update for 15/16?

I'm not available today, I'll see what I can do this weekend. In the meantime if any board member or core maintainer wants to do the mass update, feel totally free (using oca-copier-update in maintainer-tools).

@pedrobaeza
Copy link
Member

Thanks, Stéphane. Let's see in @yajo can do at least a release after merging this for manual updates of the needed repos. Other helpful colleagues can be @etobella or @simahawk

@pedrobaeza
Copy link
Member

Version 14 is also affected.

josep-tecnativa added a commit to Tecnativa/mis-builder that referenced this pull request Oct 27, 2023
Set python versio to 3.11 referencing to this OCA/oca-addons-repo-template#214
josep-tecnativa added a commit to Tecnativa/mis-builder that referenced this pull request Oct 27, 2023
Set python versio to 3.11 referencing to this OCA/oca-addons-repo-template#214
josep-tecnativa added a commit to Tecnativa/mis-builder that referenced this pull request Oct 27, 2023
Set python versio to 3.11 referencing to this OCA/oca-addons-repo-template#214
rvalyi added a commit to akretion/l10n-brazil that referenced this pull request Oct 27, 2023
@sbidoul sbidoul merged commit 4fc2d4a into OCA:master Oct 27, 2023
7 of 8 checks passed
@pedrobaeza
Copy link
Member

Thank you, Stéphane.

GCKrauss pushed a commit to kmee/l10n-brazil that referenced this pull request Nov 10, 2023
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.

7 participants