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

pdm install started failing on Python 3.7 after importlib-metadata released v5.0.0 #1411

Closed
FeodorFitsner opened this issue Oct 2, 2022 · 8 comments · Fixed by #1417
Closed
Labels
🐛 bug Something isn't working

Comments

@FeodorFitsner
Copy link

A few hours ago importlib-metadata released v5.0.0 and pdm install started failing on Python 3.7.

Failing CI build: https://ci.appveyor.com/project/flet-dev/flet/builds/44943064/job/6j92ckkaol60n8q0#L98
Last good build: https://ci.appveyor.com/project/flet-dev/flet/builds/44942650/job/uxk5x5m152jrcl3r#L98

Steps to reproduce

pdm install

Actual behavior

Traceback (most recent call last):
  File "/home/appveyor/venv3.7.13/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/home/appveyor/venv3.7.13/lib/python3.7/site-packages/pdm/core.py", line 254, in main
    return Core().main(args)
  File "/home/appveyor/venv3.7.13/lib/python3.7/site-packages/pdm/core.py", line 55, in __init__
    self.load_plugins()
  File "/home/appveyor/venv3.7.13/lib/python3.7/site-packages/pdm/core.py", line 240, in load_plugins
    entry_points.get("pdm", []), entry_points.get("pdm.plugin", [])
AttributeError: 'EntryPoints' object has no attribute 'get'

Expected behavior

The command works normally.

@FeodorFitsner FeodorFitsner added the 🐛 bug Something isn't working label Oct 2, 2022
@analogrithems
Copy link

i've just started seeing the same in my circle builds started yesterday

@menzenski
Copy link

menzenski commented Oct 3, 2022

We are seeing this as well (GitHub actions with setup-pdm action)

@lecardozo
Copy link
Contributor

@frostming do you think updating the plugin loading snippet to the new importlib-metadata==5.0.0 EntryPoints would be enough? It seems to me that this API has diverged between importlib.metadata and importlib_metadata. 🤔

I've tried a quick fix to support this new API on this branch, but I'm not quite sure this will be enough to keep support for both 3.7 and >=3.8

@lecardozo
Copy link
Contributor

lecardozo commented Oct 4, 2022

I'm seeing a few options here:

  • setting an upper bound for importlib-metadata (<5.0.0) for Python 3.7 (seems reasonable) (branch)
  • keeping the code as is and dropping support for Python 3.7 (doesn't seem the best option, IMO)
  • treating EntryPoints differently between different importlib-metadata major versions

Are there any other options that we should be considering?

@pawamoy
Copy link
Contributor

pawamoy commented Oct 4, 2022

I'd vote for the first solution: setting an upper bound for importlib-metadata (<5.0.0) for Python 3.7.
It's the most straight-forward fix, will not require more maintenance, and can easily be removed once Python 3.7 is EOL (which happens in middle of 2023 I think, so not far away). Users will just have to upgrade PDM, and done 🙂

FeodorFitsner added a commit to flet-dev/flet that referenced this issue Oct 11, 2022
* Make `cryptography` dependency optional

* Setting Flet client build number

* Do not set build-number

* Update Flet macOS icons

* Clipboard re-done to support Safari

* Make crypto utils optional

Fix #417

* Re-enable Python 3.7 as PDM fixed the issue

pdm-project/pdm#1411 (comment)

* Fix #431 - Handling Flutter and platform errors

* Added additional styles to TextField and Dropdown

* label_style
* hint_style
* helper_style
* counter_style
* error_style
* prefix_style
* suffix_style

Fix #446

* Fix CI

* Add an ability to hide automatic back button in AppBar

Fix #209

* Added `SnackBar.action_color`

Fix #364

* Control TextFields cursor presentation

Fix #356

* Add x and y to DropTarget.on_accept event

#329

* Customize colors of Checkbox and Radio

Fix #320

* Restore `websocket.defaulttimeout` on connect

Fix #413

* `Audio.get_current_position` and `Audio.get_duration` returns `int`

Fix #440

* Update container.dart

* GestureDetector control started

* `Audio.playback_rate` added

Fix #451

* All Tap gestures

* Gesture detector ready but without throttling

* Throttling of drag and hover events

* Get version from Git repo

* Fix gesture handlers

* Added a simple integration test - just for fun

* ElevatedButton must show error if only icon specified without text

Fix #357

* Display an error when left, top, right or bottom are used not in Stack

Fix #296

* Shrink wrap ListView and GridView if bounds are unlimited

Fix #331

* Fix #303 - NavigationRail is not shown in a parent without fixed height

* Do not bind session value to the IP

Fix #457

* Fix path traversal in tar unpack (CVE-2007-4559)

* Added `Container.shape` property

* Fix the rest of warnings

* Remove ControlType enum

* Fix flutter tests

* Fix MouseCursor enum

* Added Flutter package readme
@henryiii
Copy link

henryiii commented Oct 26, 2022

Option a) is just delaying the issue. Dict based access has been deprecated since importlib_metadata 3.6 and Python 3.10. Per Python's deprecation policy, this will be removed in Python 3.12. python/importlib_metadata#409 (comment).

The correct solution is to require importlib_metadata >= 3.6; python_version<"3.10", update the sys.version_info checks to < (3, 10), and use .select(...) instead.

@henryiii
Copy link

Ahh, pdm install bumps importlib_metadata up to 5, then nothing works anymore. So the current solution doesn't work even as a temporary one if a package you are using requires importlib_metadata>=5, which packages are starting to do. :(

@frostming
Copy link
Collaborator

Fixing in #1467

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants