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

Mismatched local wheels can fail silently and be hard to debug #43

Open
codebreach opened this issue Aug 26, 2023 · 1 comment
Open

Comments

@codebreach
Copy link

If a local wheel is present with the wrong version there is no indication of why its not used

leaving this here as a comment in case someone in the future gets stumped by this

to make it more obvious you can replace

# Override per-file with given local wheel labels
for filename, local_label in self.local_wheels.items():
name, version, _, _ = parse_wheel_filename(filename)
if (package.name, package.version) == (name, version):
package_sources[filename] = PackageSource(label=local_label)

with the following

            # has name_version and just name as specified in local_wheels
            # used to warn the user if a name is specified but version does not match
            specified_local_wheels = set() 
            
            # Override per-file with given local wheel labels
            for filename, local_label in self.local_wheels.items():
                name, version, _, _ = parse_wheel_filename(filename)
                specified_local_wheels.add(name)
                specified_local_wheels.add(f"{name}_{version}")
                
                if (package.name, package.version) == (name, version):
                    package_sources[filename] = PackageSource(label=local_label)

            if package.name in specified_local_wheels and f"{package.name}_{package.version}" not in specified_local_wheels:
                print(f"WARNING: {package.name} is specified in local_wheels but version does not match version {package.version} of package used in lock file.")
@jvolkman
Copy link
Owner

@codebreach if you're still using this, would you consider submitting a PR?

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

No branches or pull requests

2 participants