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

seeing ImportError: cannot import name 'Set' from 'pyparsing' issue in 3.2.0 release #576

Closed
chenrui333 opened this issue Oct 13, 2024 · 3 comments

Comments

@chenrui333
Copy link

👋 seeing ImportError: cannot import name 'Set' from 'pyparsing' in 3.2.0 release, while 3.1.4 works fine.

relates to Homebrew/homebrew-core#194190

@ptmcg
Copy link
Member

ptmcg commented Oct 13, 2024

"Set" is defined in the stdlib typing module, and should not be imported from pyparsing.

3.1.4 did import Set from typing, but no longer does so, now that the builtin set is provided in Python 3.9. Pyparsing 3.2.0 requires Python 3.9.

I think this line indicated in traceback should be changed to import Set from typing (or if sigma-cli gets configured to support only Python 3.9 and later, then references to Set from typing can be changed to use the set builtin).

@ptmcg
Copy link
Member

ptmcg commented Oct 13, 2024

Yes, this should actually be fixed in the pySigma project. It already imports a number of names from typing, so removing Set from the pyparsing import and moving it to the typing import will fix one aspect of this problem.

But the bigger problem is that pySigma's pyproject.toml indicates that it supports Python back to 3.8, and pyparsing 3.2 does not do that. Even if you fix the Set import, pyparsing's use of builtins list, set, dict, etc. instead of List, Set, and Dict means that other code will break when run on Python 3.8.

At that point, pySigma will need to either drop support for Python 3.8 (it is past EOL), or pin the pyparsing dependency to <3.2 (perhaps using the ~=3.1 version marker, which will accept any 3.1.x version, but not 3.2).

@ptmcg
Copy link
Member

ptmcg commented Oct 20, 2024

Closing as resolved.

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

No branches or pull requests

2 participants