-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix!: fully move all dependencies on pyo3 time types under our time feature + expose new abi3 feature for documentation #46
Conversation
The check job uses That said, the previous PR (#45) also passed this check, because there was nothing checking that any of those types actually implement the traits. Some simple "it compiles" checks would be useful to make sure this doesn't happen in the future. A macro would work here too, something like: macro_rules! types_impl_trait {
($trait: ident, [$($ty: ty),+$(,)?]) => {
paste::paste! {
[< _impl_ $trait >]<T: $trait>() {}
fn test_impls_$trait() {
$(
[< _impl_ $trait >]::<$ty>();
)+
}
}
}
}
types_impl_trait {
ToPython, [
Py<PyDate>,
Py<PyDateTime>,
// etc.
]
} |
I think perhaps a better test would be to try to build this crate against a pyo3 with |
Yeah, so we've got basically a 2x2 grid of possible things (
|
Mm, I see. This fixes a different problem than the one that caused this PR (types being referenced that didn't exist), but still a worthy one. On the other hand, though, your comment "Requires updating tests when adding types and/or traits." makes me wonder if we'll actually get much of a benefit from adding those tests. It seems to me like it's just as easy to forget to add a test as it is to forget to add an implementation, and the tests won't catch you forgetting. Some more powerful "let's scrape all of these and test them" test would work here, but I'm not convinced we get a big win. |
I thought this / #45 were just fixes, but rigetti/qcs-sdk-rust#475 shows that they can break things that were assuming the time types were in scope – I don't know that there's anything to do about the existing releases, but I'm upgrading this to |
In rigetti/rigetti-pyo3#45 (and rigetti/rigetti-pyo3#46), I moved all references to the Python time types under the "time" feature. This was a bugfix, but I didn't realize it was also a breaking change – any library that relied on the time types implicitly being available would break, just as this one did! This adds the missing feature dependency, and I've also upgraded rigetti/rigetti-pyo3#46 to be a breaking change. This commit also updates Cargo.lock to force the update to rigetti-pyo3, meaning that builds will fail without the substantive change.
In rigetti/rigetti-pyo3#45 (and rigetti/rigetti-pyo3#46), I moved all references to the Python time types under the "time" feature. This was a bugfix, but I didn't realize it was also a breaking change – any library that relied on the time types implicitly being available would break, just as this one did! This adds the missing feature dependency, and I've also upgraded rigetti/rigetti-pyo3#46 to be a breaking change. This commit also updates Cargo.lock to force the update to rigetti-pyo3, meaning that builds will fail without the substantive change. Closes #475.
…me feature I somehow missed `to_python` last time, despite the fact that I thought I'd tried building it.
… our time feature
6b33f4a
to
20ef589
Compare
Valid. I do not think that should block this being merged. |
I somehow missed
to_python
last time, despite the fact that I thought I'd tried building it.