Skip to content

chore: update to Python 3.9 #10809

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

Merged
merged 5 commits into from
Feb 23, 2022

Conversation

miketheman
Copy link
Member

@miketheman miketheman commented Feb 23, 2022

Resolves: #10807

For the development (outer) environment,
update to Python 3.9.10 - latest as of this writing.

Signed-off-by: Mike Fiedler <[email protected]>
Move us to 3.9.10 - latest release.

Signed-off-by: Mike Fiedler <[email protected]>
@miketheman miketheman marked this pull request as draft February 23, 2022 00:53
@miketheman
Copy link
Member Author

Test failure is for coverage missing a branch-jump for a raise, will need to investigate further.

@miketheman
Copy link
Member Author

I'm a bit stymied here.

Current output:

+ python -m coverage report -m --fail-under 100
Name                        Stmts   Miss Branch BrPart  Cover   Missing
-----------------------------------------------------------------------
warehouse/search/tasks.py     112      0     20      1    99%   199->225
-----------------------------------------------------------------------
TOTAL                        9104      0   2551      1    99%

Here's a link to the segment in question, with some added context:

https://github.com/pypa/warehouse/blob/d2cafdb6b59a5a0c53931cb280e1322659bd4cf6/warehouse/search/tasks.py#L185-L226

If I read the coverage report correctly, it's telling us that the request.db.close() in the finally block isn't being exercised due to the raise on L196 , so the code jumps all the way down to L225, the except clause.

I've tried upgrading coverage to the latest 6.3.2 (just in case), but am still getting the same result. 🤔

The only test I was able to track down that would be relevant seemed to be test_fails_when_raising - but wasn't able to figure out why coverage reports the segment covered in 3.8, but not in 3.9.

Any ideas?

@miketheman
Copy link
Member Author

A little more from htmlcov:

Screen Shot 2022-02-22 at 11 36 31 PM

@di
Copy link
Member

di commented Feb 23, 2022

Looks like this is nedbat/coveragepy#1041

@di
Copy link
Member

di commented Feb 23, 2022

(I'm fine with adding a # pragma: no cover here if that will suppress the failure)

In the move to Python 3.9, we are subject to a coverage behavior that
has yet to be corrected.
In the interest of keeping the coverage report to 100%, we exclude
the statement that coverage.py reports as not being executed, despite
it being executed via tests.

Refs: nedbat/coveragepy#1041

Signed-off-by: Mike Fiedler <[email protected]>
@miketheman miketheman marked this pull request as ready for review February 23, 2022 12:19
@miketheman
Copy link
Member Author

@di thanks for the linkage, I've added another commit disabling coverage reporting for that step.

@di di requested a review from ewdurbin February 23, 2022 15:57
@ewdurbin ewdurbin merged commit b26deed into pypi:main Feb 23, 2022
@miketheman miketheman deleted the miketheman/migrate-to-python-10807 branch February 23, 2022 16:33
@miketheman
Copy link
Member Author

@ewdurbin Thanks! How does one find out when this is released, and live? I was looking at https://p.datadoghq.com/sb/7dc8b3250-85dcf667bd - hoping to see if there was better CPU/memory utilization, bit I don't think that's currently graphed.

@ewdurbin
Copy link
Member

You can see it going live in the "PyPI Backend HTTP Requests (req/sec)" when the color of the graph changes (those show releases).

We don't publicly chart cpu/mem for the services, and I'm not sure that we should necessarily (as it gives insight if someone wants to DoS us), but here's a snapshot of the last four hours:

Screen Shot 2022-02-23 at 12 14 13 PM

I wouldn't take much away from that on resource utilization since the workloads on PyPI backends do vary hour by hour based on what's going on (heavy XMLRPC use, large quantity of new releases, etc).

But overall looks pretty much equivalent, so that's good.

Is there a particularly reason you expected to see a difference in utilization?

@miketheman
Copy link
Member Author

Thanks for sharing the image! Totally understand why it's not public.

Is there a particularly reason you expected to see a difference in utilization?

I read there was a memory leak fixed with 3.9 where multiple instantiations of Python - but I may have been off.

@abitrolly
Copy link
Contributor

In somebody want to DoS PyPI, absence of public metrics won't stop them. On the other hand public metrics not only help to build DoS resilient service, but also help to bring decent performance.

domdfcoding pushed a commit to domdfcoding/warehouse that referenced this pull request Jun 7, 2022
* chore: update local/CI execution to Python 3.9

For the development (outer) environment,
update to Python 3.9.10 - latest as of this writing.

Signed-off-by: Mike Fiedler <[email protected]>

* chore: upgrade python version

Move us to 3.9.10 - latest release.

Signed-off-by: Mike Fiedler <[email protected]>

* chore: update requrements hashes for python3.9

* test: exclude statement from coverage report

In the move to Python 3.9, we are subject to a coverage behavior that
has yet to be corrected.
In the interest of keeping the coverage report to 100%, we exclude
the statement that coverage.py reports as not being executed, despite
it being executed via tests.

Refs: nedbat/coveragepy#1041

Signed-off-by: Mike Fiedler <[email protected]>

Co-authored-by: Dustin Ingram <[email protected]>
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.

Migrate to Python 3.9
4 participants