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

Support python 3.11 #3199

Merged
merged 5 commits into from
Jan 17, 2023
Merged

Support python 3.11 #3199

merged 5 commits into from
Jan 17, 2023

Conversation

AyanSinhaMahapatra
Copy link
Member

@AyanSinhaMahapatra AyanSinhaMahapatra commented Jan 16, 2023

Fixes #2730

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁

* Bump ahocorasick to v2.0.0
* Bump intbitset to v3.0.2

Additionally also bump saneyamp to v0.6.0

Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
@pombredanne
Copy link
Member

Here is a chat log with wonderful @SnoopJ on #python ! thank you

pombreda> Philippe Ombredanne Hiya, fierce pythonista ... why would this code fail only on Python 3.11 (and not any of 3.6 to 3.10) https://dev.azure.com/nexB/scancode-toolkit/_build/results?buildId=9632&view=logs&j=71924f90-629a-5f64-5467-4f9bed474c97&t=7cd9e9da-3c04-5bed-99f7-c0d42cb54f3b&l=641
11:10 PM https://github.com/nexB/scancode-toolkit/blob/support-py-311/src/packagedcode/models.py#L744
11:10 PM
Philippe Ombredanne did super() change in 3.11?

SnoopJ> snoopj pombreda, looks like something did change, some discussion here in attrs and a linked upstream issue: python-attrs/attrs#907
11:15 PM
Philippe Ombredanne SnoopJ: ah, this would in attrs! good catch!
11:15 PM
snoopj pombreda, it looks like this was fixed in attrs 22.1
11:15 PM
Philippe Ombredanne *you rock
11:16 PM
Philippe Ombredanne acresearch: pyenv is my friend for this ;)
11:16 PM
snoopj pombreda, it looks like spelling out the super() explicitly can work around the issue if you can't upgrade attrs. New bug to me :)

So the failures in https://dev.azure.com/nexB/44deaec8-15bb-470e-b20f-1e2c33a64c65/_apis/build/builds/9632/logs/142 on Python 3.11 is because of attrs-based classes:

2023-01-16T13:19:56.0426971Z >           assert result.exit_code == expected_rc, error
2023-01-16T13:19:56.0427278Z E           AssertionError: 
2023-01-16T13:19:56.0427518Z E             Failure to run:
2023-01-16T13:19:56.0427759Z E             rc: 1
2023-01-16T13:19:56.0428468Z E             scancode --package /home/vsts/work/1/s/tests/scancode/data/rpm/fping-2.4-0.b2.rhfc1.dag.i386.rpm --json /tmp/scancode-tk-tests -pyolaih8/v1olxgsg/td/tf.results.json --test-mode --verbose
2023-01-16T13:19:56.0429138Z E             output:
2023-01-16T13:19:56.0429403Z E              Setup plugin: scan:licenses...
2023-01-16T13:19:56.0429717Z E              Setup plugin: scan:packages...
2023-01-16T13:19:56.0430124Z E              Setup plugin: post_scan:license-references...
2023-01-16T13:19:56.0430481Z E              Setup plugin: output:json...
2023-01-16T13:19:56.0430784Z E             Collect file inventory...
2023-01-16T13:19:56.0431089Z E             Scan files for: packages with 1 process(es)...
2023-01-16T13:19:56.0431616Z E             Scanned: /home/vsts/work/1/s/tests/scancode/data/rpm/fping-2.4-0.b2.rhfc1.dag.i386.rpm
2023-01-16T13:19:56.0432211Z E             Scanned: /home/vsts/work/1/s/tests/scancode/data/rpm/fping-2.4-0.b2.rhfc1.dag.i386.rpm
2023-01-16T13:19:56.0432584Z E             Filter scans...
2023-01-16T13:19:56.0432842Z E              Filter scan: packages...
2023-01-16T13:19:56.0433171Z E             Run post-scans...
2023-01-16T13:19:56.0433533Z E              Run post-scan: license-references...
2023-01-16T13:19:56.0433823Z E             Save scan results...
2023-01-16T13:19:56.0434288Z E              Save scan results as: json...
2023-01-16T13:19:56.0434663Z E             Scanning done.
2023-01-16T13:19:56.0434942Z E             Some files failed to scan properly:
2023-01-16T13:19:56.0435367Z E             Path: fping-2.4-0.b2.rhfc1.dag.i386.rpm
2023-01-16T13:19:56.0435703Z E               ERROR: for scanner: packages:
2023-01-16T13:19:56.0435987Z E               ERROR: Unknown error:
2023-01-16T13:19:56.0436294Z E               Traceback (most recent call last):
2023-01-16T13:19:56.0436694Z E                 File "/home/vsts/work/1/s/src/scancode/interrupt.py", line 91, in interruptible
2023-01-16T13:19:56.0437110Z E                   return NO_ERROR, func(*(args or ()), **(kwargs or {}))
2023-01-16T13:19:56.0437438Z E                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-01-16T13:19:56.0437810Z E                 File "/home/vsts/work/1/s/src/scancode/api.py", line 308, in get_package_data
2023-01-16T13:19:56.0438244Z E                   return dict(package_data=[pd.to_dict() for pd in package_datas])
2023-01-16T13:19:56.0438600Z E                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-01-16T13:19:56.0439071Z E                 File "/home/vsts/work/1/s/src/scancode/api.py", line 308, in <listcomp>
2023-01-16T13:19:56.0439493Z E                   return dict(package_data=[pd.to_dict() for pd in package_datas])
2023-01-16T13:19:56.0440019Z E                                             ^^^^^^^^^^^^
2023-01-16T13:19:56.0440569Z E                 File "/home/vsts/work/1/s/src/packagedcode/models.py", line 744, in to_dict
2023-01-16T13:19:56.0441029Z E                   mapping = super().to_dict(with_details=with_details, **kwargs)
2023-01-16T13:19:56.0441386Z E                             ^^^^^^^
2023-01-16T13:19:56.0441757Z E               TypeError: super(type, obj): obj must be an instance or subtype of type

Here the super is a hierarchy of attrs objects.

The issue is python-attrs/attrs#907 and was fixed by @hynek in python-attrs/attrs#969 ... Thank you ++ @hynek ... you rock too!

The simple fix is to bump attrs to >= 22.1

But still support older attrs versions on older Python versions

Thank-you-to:  James Gerity @SnoopJ
Reference: python-attrs/attrs#907
Reference: python-attrs/attrs#969
Reference: #3199 (comment)
Signed-off-by: Philippe Ombredanne <[email protected]>
Also update setup metadata to Python 3.11

Signed-off-by: Philippe Ombredanne <[email protected]>
This is used when creating release archives

Signed-off-by: Philippe Ombredanne <[email protected]>
Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

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

All green and good looking. Thank you.

@pombredanne pombredanne merged commit fca6f82 into develop Jan 17, 2023
@pombredanne pombredanne deleted the support-py-311 branch January 17, 2023 07:40
@pombredanne pombredanne added this to the v32.0 milestone Jan 18, 2023
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.

Add support for the newly released Python 3.10 and 3.11
2 participants