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

Also try mangling sdist urls to match pep625 #2794

Merged
merged 9 commits into from
Jun 14, 2024

Conversation

bollwyvl
Copy link
Contributor

  • Pydantic model updated or no update needed

This adds yet another URL to try, namely the basically-now-ubiquitous PEP625 form:

old    package-name-0.0.0.tar.gz
              V
new    package_name-0.0.1.tar.gz

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.05%. Comparing base (2c96e01) to head (2bea2c2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2794      +/-   ##
==========================================
+ Coverage   75.00%   75.05%   +0.05%     
==========================================
  Files         109      109              
  Lines       11156    11181      +25     
==========================================
+ Hits         8367     8392      +25     
  Misses       2789     2789              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@beckermr beckermr left a comment

Choose a reason for hiding this comment

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

Can we add some tests? I know the tests are thing already. :/

@bollwyvl
Copy link
Contributor Author

add some tests? I know the tests are thing already. :/

how do we feel about moving a bunch of the black-violating tests to .txt-based fixtures?

@beckermr
Copy link
Contributor

What do you mean by that? W/e it is, a new PR please.

conda_forge_tick/url_transforms.py Outdated Show resolved Hide resolved
conda_forge_tick/url_transforms.py Outdated Show resolved Hide resolved
conda_forge_tick/url_transforms.py Outdated Show resolved Hide resolved
@beckermr
Copy link
Contributor

beckermr commented Jun 13, 2024

I honestly don't get how this PR passes or works. Here are the existing tests for url transforms w/ pypi (which is way more complete than I recall!):

def test_url_transform_pypi():
    urls = set(list(gen_transformed_urls("https://pypi.io/{{ name }}/{{ name }}-barf")))
    assert urls == {
        "https://files.pythonhosted.org/{{ name }}/{{ name }}-barf",
        "https://files.pythonhosted.org/{{ name }}/{{ name.replace('-', '_') }}-barf",
        "https://files.pythonhosted.org/{{ name }}/{{ name.replace('_', '-') }}-barf",
        "https://pypi.io/{{ name }}/{{ name }}-barf",
        "https://pypi.io/{{ name }}/{{ name.replace('-', '_') }}-barf",
        "https://pypi.io/{{ name }}/{{ name.replace('_', '-') }}-barf",
    }

    urls = set(
        list(
            gen_transformed_urls(
                "https://pypi.io/{{ name }}/{{ name.replace('_', '-') }}-barf",
            ),
        ),
    )
    assert urls == {
        "https://files.pythonhosted.org/{{ name }}/{{ name }}-barf",
        "https://files.pythonhosted.org/{{ name }}/{{ name.replace('_', '-') }}-barf",
        "https://pypi.io/{{ name }}/{{ name }}-barf",
        "https://pypi.io/{{ name }}/{{ name.replace('_', '-') }}-barf",
    }

    urls = set(
        list(
            gen_transformed_urls(
                "https://pypi.io/{{ name }}/{{ name.replace('_','-') }}-barf",
            ),
        ),
    )
    assert urls == {
        "https://files.pythonhosted.org/{{ name }}/{{ name }}-barf",
        "https://files.pythonhosted.org/{{ name }}/{{ name.replace('_','-') }}-barf",
        "https://pypi.io/{{ name }}/{{ name }}-barf",
        "https://pypi.io/{{ name }}/{{ name.replace('_','-') }}-barf",
    }

    urls = set(
        list(
            gen_transformed_urls(
                "https://pypi.io/{{ name }}/{{ name|replace('_','-') }}-barf",
            ),
        ),
    )
    assert urls == {
        "https://files.pythonhosted.org/{{ name }}/{{ name }}-barf",
        "https://files.pythonhosted.org/{{ name }}/{{ name|replace('_','-') }}-barf",
        "https://pypi.io/{{ name }}/{{ name }}-barf",
        "https://pypi.io/{{ name }}/{{ name|replace('_','-') }}-barf",
    }

    urls = set(
        list(
            gen_transformed_urls(
                'https://pypi.io/{{ name }}/{{ name.replace("_", "-") }}-barf',
            ),
        ),
    )
    assert urls == {
        "https://files.pythonhosted.org/{{ name }}/{{ name }}-barf",
        'https://files.pythonhosted.org/{{ name }}/{{ name.replace("_", "-") }}-barf',
        "https://pypi.io/{{ name }}/{{ name }}-barf",
        'https://pypi.io/{{ name }}/{{ name.replace("_", "-") }}-barf',
    }

We already test at least part of the - to _ transform, right?

@beckermr
Copy link
Contributor

Oh you are munging hard-coded names. duh. Needs tests then for sure.

@bollwyvl
Copy link
Contributor Author

fixtures

url transforms w/ pypi (which is way more complete than I recall!):

Made #2797. Might do a little work there before coming back to here... and indeed, this (draft) PR needs some better stress tests, especially of bad/special/magic cases that categorically did change over time (PEP420 with ., poetry and flit epochs, etc. ).

@beckermr
Copy link
Contributor

We have pre-commit so it should be easy to solve linter errors.

@beckermr
Copy link
Contributor

pre-commit.ci autofix

@bollwyvl bollwyvl marked this pull request as ready for review June 14, 2024 00:30
@bollwyvl
Copy link
Contributor Author

bollwyvl commented Jun 14, 2024

I am struggling to find any in-the-wild examples that normalize . to _, or apply case normalization.

@beckermr
Copy link
Contributor

That's fine. As long as something made up is in the tests, it will be fine I think.

@beckermr
Copy link
Contributor

Thank you!

@beckermr beckermr merged commit efadfca into regro:master Jun 14, 2024
5 of 6 checks passed
@bollwyvl bollwyvl deleted the check-pep625-sdist-urls branch June 14, 2024 12:52
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.

3 participants