-
Notifications
You must be signed in to change notification settings - Fork 8
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
Re-export pep404 #19
Comments
For this case, you probably manually have to check that pep440_rs and pep508_rs have compatible versions (pep508_rs is lagging a bit behind atm), at least we had to do this other packages, but I'll check with an expert. |
Yeah, that what I had to do, and it is a bit error-prone because when upgrading can get unexpected errors unless the versions align up. As I do not use that lib directly, it is better to expose it IMHO, is a simple: pub use serde pep440_rs; inside https://github.com/konstin/pep508_rs/blob/main/src/lib.rs#L34 and then people can refer to it via |
@konstin ping on this? |
@gaborbernat Can you say more about the specific issue you're hitting here? I know you linked to a line of code, but it's not totally clear to me, from that link, what the specific issue you're hitting is. |
It is very simple. Unless you manually align up the two versions You are getting completion error because Rust thinks the two objects are not the same when making compression between an object a method returns from this library and a constant I am using to make the comparison. |
Okay, so let's be concrete about the workflow here that leads to a problem:
Is that right? Or is the workflow different from that? I suppose the above implies that you have to do the upgrades to I am overall in favor of re-exporting public dependencies in general. I think it's a good idea. There really isn't much downside AFAIK, and generally helps issues like this. Or at least, gives you a way out. But if the above workflow is an accurate reflection of your problem, then I do believe it would require that all uses of |
It is much simpler than that. Your project depends on this library. You call a public method from this library and want to check if the return value of that is a given value. The method in question returns the value from pep440. In the current situation, the only way Rust will allow you to do this is by adding an explicit dependency on pep440. However, should you at some point in time Set the version of pep440 library to something else than what this project set during its release. You will get a compilation error because oddly enough, Rust thinks the two objects are not the same. The error message is very confusing and takes some time to understand what's happening. This is actually very easily achievable if you use cargo update to update your dependencies because there might often be a newer version of the PEP 440 library than what this library uses. Did you read the stack overflow issue I linked? Explained the problem, I think pretty well. |
Yes. I understand the general shape of the problem. I'm more or less trying to understand how it specifically manifests for you. Thanks for explaining! I think what you're saying is the same as what I said? At least, I can't spot any differences except for one: doing a |
For me, in particular, I think the problem was that this library was using version 0.6.8, but there was a 0.7.0 already released, so when bumped to it, the problem manifested. Rust doesn't do semantic version compatibility. If there are two libraries, even with a minor difference, they are treated as two separate objects. |
If you have Now, if you update |
That's what I want. The only reason I added pep440 as a dependency is to check the return value of a public method of this library is of a given type. So If I can finally not do that, that would be grand. |
In https://github.com/tox-dev/pyproject-fmt-rust I am running into problems because of this line https://github.com/tox-dev/pyproject-fmt-rust/blob/d94116328fda35f8dd1a9caf8af755b9a6427ab4/rust/src/helpers/pep508.rs#L26. The issue boils down to the fact that the version of the pep440 I define is different from what this lib uses, and this behaviour is expected as detailed at https://doc.rust-lang.org/cargo/reference/resolver.html#version-incompatibility-hazards.
According to https://stackoverflow.com/questions/72366391/how-to-let-a-package-use-the-same-version-of-dependencies-as-b the best practice here in rust is to re-export these objects that are part of the public API. So I am asking here to do so.
The text was updated successfully, but these errors were encountered: