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

Updated StaticVisitor #317

Merged
merged 2 commits into from
Jan 30, 2025
Merged

Conversation

MarcinKonowalczyk
Copy link
Contributor

Fixes #316.

Tested in python 3.14.0a4+ (commit 5c9a63f62c9e56d1576c2dc62c986f2be988729f) and in python 3.8.20 (the latest patch of the earliest supported by line_profiler). I'm making a wild assumption that it therefore works fine in-between.

@MarcinKonowalczyk
Copy link
Contributor Author

Ok, fine, it felt wrong to assume. Here is the output of tox, tested from 3.8->3.13 (and even 3.13t)

Screenshot 2025-01-29 at 14 48 20

For reference, here is my tox.ini:

[tox]
min_version = 4.2
env_list =
    3.13.1t
    3.13.1
    3.12
    3.11
    3.10
    3.9
    3.8

[testenv]
deps =
    pytest
    ubelt
    ipython
commands =
    python -m pip install -e .
    python -m pytest

(I've had to specify the patch version of 3.13 or else tox would not find my free-threading installation)

@Erotemic
Copy link
Member

Thanks for catching this. I have this construct in most of my packages, so I'll need to update in a bunch of places.

We probably don't need the if condition that checks for constant and string. If we are going to do a check, then a constant check should be enough, and we should raise an error if it is not a constant.

@MarcinKonowalczyk
Copy link
Contributor Author

MarcinKonowalczyk commented Jan 29, 2025

Thanks for catching this.

No worries :))

I have this construct in most of my packages, so I'll need to update in a bunch of places.

Hehe, I use this:

def get_version(filename):
    """Get the __version__ string from the __init__ file"""
    version_regex = r"^__version__ *= *(?P<quote>[\"'])(?P<version>[^'\"]*)(?P=quote)"
    for line in iter_lines(filename):
        match = re.search(version_regex, line)
        if match:
            return match.group("version")
    raise RuntimeError(f"Unable to find version in {filename}")

Pros and cons I guess.. 🤷‍♀️

We probably don't need the if condition that checks for constant and string. If we are going to do a check, then a constant check should be enough, and we should raise an error if it is not a constant.

Done 👍. Sorry for resetting the workflow run indication. The previous one did succeed though.

@Erotemic Erotemic merged commit 61afe6e into pyutils:main Jan 30, 2025
34 checks passed
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.

Install fails in python 3.14
2 participants