-
Notifications
You must be signed in to change notification settings - Fork 252
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
Make package names consistent with official Azure SDKs #304
Comments
Previous rename of the crates was in October #34. |
In C++ (which is the language most similar to Rust), we use namespaces such as Azure.Security.KeyVault.Keys; see https://github.com/Azure/azure-sdk-for-cpp/blob/master/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/key_client.hpp#L27 Since Rust doesn't have namespaces; I think package names should match our C++ guidelines (except for changing periods to kebaba/snake and all lowercase). I did find this RFC: https://github.com/rust-lang/rfcs/blob/master/text/0430-finalizing-naming-conventions.md This indicates that crates should be snake_case. |
If we hope to be an official SDK at some point, we need to be consistent when there's no idiomatic reason to not be. Maybe the track 2 SDKs should've used "Key Vault" as two words (in marketing it is, and I've made sure all our documentation reflects that at least in the KV SDK for .NET) but it's not that way in the official SDKs. It also helps if the service directories match, e.g. sdk/keyvault. A lot of our common EngSys pipeline I'll get hooked up eventually works best when the service directories match across repos. Package names and all source beyond them e.g. sdk/keyvault/<package_name> can differ without issue. |
Using "Azure Key Vault" as an example, the new .NET packages are:
The .NET packages use PascalCase for "Key Vault", so it becomes "KeyVault". The kebab-case of "Key Vault" is what you see in the product marketing and product documentation URLs:
For Rust, we should be using snake_case. The snake_case of "Key Vault" is "key_vault". This is more consistent with SDKs like .NET than a convention to lowercase and remove the spaces that results in "keyvault". |
The Azure SDK team doesn't follow Azure branding for package/namespace naming. The reason why we don't is because branding changes. For example, Azure Storage Tables is now called Azure Cosmos Tables. So, the SDK team uses a pattern of Azure..Service. See https://azure.github.io/azure-sdk/general_design.html#namespaces |
JS and Python use kebob case for package names and are still one word:
The goal was to be consistent with the rest of the Azure SDKs in hopes that one day these may be official as well. |
kebob case for |
"azure-keyvault" is kebob-cased. As @JeffreyRichter pointed out we don't treat Key Vault as two words in our packages - not in track 1 nor track 2 packages. The goal of the original repo was to be consistent where idiomacy didn't matter. Package names should be no different. Whether the original package names are wrong is irrelevant: they already GA'd that way years ago. |
.NET packages use KeyVault, not Keyvault. It uses PascalCase on two words. |
No separating dots, though. Track 1 was the same way. Same with Java. "Key Vault" is often colloquially referred to as "KeyVault". In fact, I fixed a lot of instance is documentation across properties some time back to refer to it as "Key Vault". Still doesn't change that packages with the structure documented here already shipped as they did, and having consistent APIs including package names is a goal of the Azure SDKs. @JeffreyRichter I still don't see what benefit "Security" has in this example (or any topic-level name). If Go is allowed to use names as short as azkeyvault and Python and JS ship some variant of azure-keyvault, why not for Rust? A rough analysis of the crates.io index shows short names are preferred as well. The top 10 results account for almost 70% of the total length of names:
(based on latest version of all crates using crates-index crate) |
We discussed in Teams today and the result was this: #[test]
fn test() {
assert!( name_crate(["Azure", "Security", "Key Vault"]) == "azure_security_keyvault");
}
/// crates will be named <azure>_<group>_<service>
/// The group and service will be lowercase with spaces removed.
/// https://azure.github.io/azure-sdk/general_design.html#namespaces
pub fn name_crate(parts: [&str; 3]) -> String {
let parts: Vec<_> = parts.iter().map(name_crate_part).collect();
parts.join("_")
}
fn name_crate_part(part: &&str) -> String {
part.to_lowercase().replace(" ", "")
} |
This is fixed by renaming these crates: |
The other packages use approved namespaces :
And correspond to those .NET packages:
|
This is complete. |
When not idiomatic, our guidelines state we should be consistent. That includes package names. While our statically-typed languages tend to favor a name in the package name e.g. (.NET) Azure.Security.KeyVault.{Keys, Secrets, Certificates, Administration}, our JavaScript and Python packages do not. So far, we seem to have more in common with Python packages, hence I recommend a pattern like so:
If we were to use topic names, that would be the values in parens. Personally I like the brevity of Python (and JS, which uses @azure/keyvault for example), but wanted to open the discussion.
/cc @JeffreyRichter
The text was updated successfully, but these errors were encountered: