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

Add py310 support #74

Merged
merged 5 commits into from
Aug 4, 2022
Merged

Add py310 support #74

merged 5 commits into from
Aug 4, 2022

Conversation

ocefpaf
Copy link
Collaborator

@ocefpaf ocefpaf commented Aug 3, 2022

Added a test matrix to be sure we find some corner cases.

Closes #69

  • add py310 support
  • make stdlib-list a py<310 dependency
  • fix false positive in our tests

@codecov-commenter
Copy link

codecov-commenter commented Aug 3, 2022

Codecov Report

Merging #74 (a1db75a) into master (7ea5755) will decrease coverage by 0.21%.
The diff coverage is 83.33%.

@@            Coverage Diff             @@
##           master      #74      +/-   ##
==========================================
- Coverage   92.32%   92.10%   -0.22%     
==========================================
  Files           6        7       +1     
  Lines         456      456              
==========================================
- Hits          421      420       -1     
- Misses         35       36       +1     
Impacted Files Coverage Δ
depfinder/stdliblist.py 75.00% <75.00%> (ø)
depfinder/inspection.py 88.72% <100.00%> (-0.25%) ⬇️
depfinder/reports.py 96.55% <100.00%> (+1.09%) ⬆️
depfinder/utils.py 77.41% <100.00%> (-2.59%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

depfinder/inspection.py Outdated Show resolved Hide resolved
@ocefpaf ocefpaf mentioned this pull request Aug 3, 2022
@ocefpaf ocefpaf force-pushed the py310 branch 2 times, most recently from 45f0c5a to 60fd24d Compare August 3, 2022 21:57
@ocefpaf ocefpaf marked this pull request as ready for review August 3, 2022 21:57
@ocefpaf ocefpaf requested review from zmoon and ericdill and removed request for zmoon August 3, 2022 21:57
.github/workflows/tests.yml Outdated Show resolved Hide resolved
.github/workflows/tests.yml Show resolved Hide resolved
.github/workflows/tests.yml Show resolved Hide resolved

- uses: conda-incubator/setup-miniconda@v2
- name: Setup Micromamba
uses: mamba-org/provision-with-micromamba@main
with:
Copy link
Contributor

@zmoon zmoon Aug 3, 2022

Choose a reason for hiding this comment

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

I was thinking about the caching options but I guess that wouldn't help since no conda env yml file. But maybe if use extra-specs as mentioned below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Probably. I only use cache for big envs, this one is not that heavy but we can try that in another PR I already added too much in this one.

.github/workflows/tests.yml Outdated Show resolved Hide resolved
.github/workflows/tests.yml Show resolved Hide resolved
@@ -36,7 +36,7 @@
from collections import defaultdict
from typing import Union

from stdlib_list import stdlib_list
from .stdliblist import builtin_modules
Copy link
Contributor

Choose a reason for hiding this comment

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

Could just be me but I find stdliblist a bit ugly / hard to read, maybe the module could be stdlib_list_ instead or something

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Super ugly! I'm terrible with names. I'm OK with stdlib_list_. Let's see what @ericdill thinks and we'll rename.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, let's hold this one for a bit. I forgot I'm also a maintainer of stdlib-list and these changes should be there instead.

Copy link
Owner

Choose a reason for hiding this comment

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

Let's see what @ericdill thinks and we'll rename.

FWIW you don't need my approval for anything in this project. do whatever you think is best. i trust you on this stuff

Copy link
Owner

Choose a reason for hiding this comment

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

i'd prefix this to be _stdlib_list but it's an internal detail so we can fix it in post

@zmoon
Copy link
Contributor

zmoon commented Aug 3, 2022

Also did you see the

test.py::test_for_smoke
  <unknown>:485: DeprecationWarning: invalid escape sequence \s

in the test run? Not part of this PR though.

builtin_modules = stdlib_list(pyver)
del pyver
except ImportError:
# assuming py>=3.10
Copy link
Contributor

@zmoon zmoon Aug 3, 2022

Choose a reason for hiding this comment

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

This should be the case now, but if stdlib-list was somehow missing in Python <3.10 situation, then the error message could be a bit confusing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is listed as a dependency for py<3.10, so the only way that scenario would happen is in a broken installation with "no-deps" and people doing that are usually experts. The error message would be:

AttributeError: module 'sys' has no attribute 'stdlib_module_names'

That is, IMO, the correct information an advanced users should know but I accept suggestions for a better one.

Copy link
Contributor

@zmoon zmoon Aug 3, 2022

Choose a reason for hiding this comment

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

Yeah, I suppose you are right, that makes sense.

I guess I would lean towards switching the try and except parts or doing a sys.version_info check.

And I know you're going another way here, but I also feel like it could be useful to have this in stdlib-list, e.g. to support listing the 3.10 stdlib from an older Python version, and to reduce the number of times this sort of code here would have to be written perhaps.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep. It makes sense to put in stliblib-list. I completely forgot I am a maintainer there and I can port this over tomorrow.

@ocefpaf
Copy link
Collaborator Author

ocefpaf commented Aug 3, 2022

in the test run? Not part of this PR though.

Not sure where that is coming from but we should probably fix it in another PR.

@ocefpaf ocefpaf marked this pull request as draft August 3, 2022 23:27
@beckermr
Copy link
Collaborator

beckermr commented Aug 4, 2022

My approval never was or is needed here, but I am LGTMing this in an effort to get it merged ASAP.

Thank you @ocefpaf!

@ericdill
Copy link
Owner

ericdill commented Aug 4, 2022

i pushed a change to fix the tests but now we're failing because of the change introduced in #76. the reason for this is that python-stdlib-list has the builtin as "concurrent.futures". so when we're using python-stdlib-list, that's the thing that gets reported. The new way we're finding modules,

    builtin_modules = list(set(list(sys.stdlib_module_names) + list(sys.builtin_module_names)))

only has the top-level namespace (i.e., it only shows concurrent).

so now i think the solution probably has to be to have separate tests for py<=3.9 and py>=3.10. i'll give a think on how to implement that

@ericdill
Copy link
Owner

ericdill commented Aug 4, 2022

🤞🏻 584c8a9 🤞🏻 should fix it

@ericdill ericdill marked this pull request as ready for review August 4, 2022 21:45
@ericdill
Copy link
Owner

ericdill commented Aug 4, 2022

:485: DeprecationWarning: invalid escape sequence \s

@zmoon iirc this was from some weird windows encoding thing that CJ hit a while back. it's in one of the test files somewhere i think. could be a thing to look into later

@ericdill
Copy link
Owner

ericdill commented Aug 4, 2022

yolo

@ericdill ericdill merged commit e7d8463 into ericdill:master Aug 4, 2022
@ericdill
Copy link
Owner

ericdill commented Aug 4, 2022

@ocefpaf it's embarassing to admit but i have no idea how to release a new version of this

@ericdill
Copy link
Owner

ericdill commented Aug 4, 2022

oh actually looks like @beckermr did the last release. want to do another?

@ocefpaf ocefpaf deleted the py310 branch August 5, 2022 00:10
@ocefpaf
Copy link
Collaborator Author

ocefpaf commented Aug 5, 2022

@ocefpaf it's embarassing to admit but i have no idea how to release a new version of this

I'm just tagging and using GitHub auto generated changelog. See https://github.com/ericdill/depfinder/releases/tag/V2.9.0

I'll add some extra stuff to automatically push to PyPI soon but I can push this one manually.

@ocefpaf
Copy link
Collaborator Author

ocefpaf commented Aug 5, 2022

@ericdill I do plan to move most of this stuff to stdlib-list at some point and "archive" that project. In theory we won't need it again for Python >=3.10.

@ericdill
Copy link
Owner

ericdill commented Aug 5, 2022

thanks for releasing!

conda-forge PR conda-forge/depfinder-feedstock#29

@beckermr
Copy link
Collaborator

beckermr commented Aug 5, 2022

Something is failing for python 3.10 in the feedstock pr. Can you all look?

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.

Python 3.10
5 participants