-
Notifications
You must be signed in to change notification settings - Fork 110
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
Remove types from pre-1.0 crates from the public API, or hide them behind features #771
Comments
Why limit this to pre-1.0 crates? |
FWIW, the issue was inspired by this guideline: https://rust-lang.github.io/api-guidelines/necessities.html#public-dependencies-of-a-stable-crate-are-stable-c-stable , and the trick with the features was inspired by what the MongoDB driver did: https://docs.rs/mongodb/2.8.0/mongodb/#all-feature-flags . Of course, SemVer is just a convention and dependencies are free to release 2.0, 3.0, etc. However, the meaning of pre-1.0 versions is that they explicitly opt-out of API stability, so it is reasonable to expect >=1.0 versions to be more stable and release new major versions less frequently. We can take a look at >=1.0 dependencies as well, but in general they should release new major versions less frequently and some of them will probably maintain older versions for some time. I don't think we will need features for most, if not all of them. Ultimately, we are also be free to release new major versions after 1.0 - I think it's perfectly fine, but we just shouldn't do it too frequently because then the implied API stability that comes with >=1.0 goes away. |
We did most of the work for the types used for serialization, but we still have some pre-1.0 dependencies that should be taken care of:
|
I discussed the When it comes to this dependency, we indeed use some of its items in the public - precisely:
Notice that these public items are hidden behind the crate features anyway ( I think we can leave this dependency as is. Perhaps, we could only add a version number to the feature name i.e. rename We should close this topic so it's possible to review the PR introducing |
I started reviewing rustls PR, and I think I'd prefer a different approach, which I'll describe there. |
Of course an alternative for an enum is trait, this could maybe enable more modularity / extensibility - we'll need to decide on something. |
@wprzytula @Lorak-mmk We can close this. |
What about |
We already hide the dependency behind |
@Lorak-mmk if you agree, please close this. |
Those features, and how they are implemented internally don't really allow us to support new versions of those crates or different backends, so I don't think this should be closed. |
Currently, the driver has a number of dependencies on crates that did not commit to the API stability, i.e. their latest releases are pre-1.0. Those crates do sometimes release new major versions and we usually, after some time, update those dependencies as well. However, updating dependencies on crates whose types appear in our public API generates friction for users: they may need to update the dependencies in their projects as well. This can require some effort, depending on how much stuff has been modified in the dependencies. Even if the effort is not large, the fact that we need to do it regularly prevents us from stabilising our API.
We should approach this as follows:
num-bigint_03
for version 0.3 andnum-bigint_04
for v0.4. This will allow us to introduce support for newer versions without breaking support for the old ones, as we do now. If we feel brave enough, we can consider deprecating support for the old versions and eventually remove them when they are no longer supported by the authors.If such a feature is enabled, the API that it brings can, of course, depend on the unstable crate. This also includes trait implementations, e.g.
impl FromCqlVal for num_bigint::BigInt
.The biggest offender seems to be the
CqlValue
. This PR: #745 seems to be a step in the right direction to fixing this type. Of course, there may be more issues and we should vet all current pre-1.0 dependencies.The text was updated successfully, but these errors were encountered: