once upon a time, we had a pretty solid system for naming packages:
-
package names must be valid URL characters (no spaces, punctuation, etc.)
-
package names must be lowercased, and use hyphen-case (“kebab case”)
-
package names must start with “swift-”
of course, this was always something of a fiction. pretty much nobody outside of Apple ever really observed rule #3, and the only enforcement mechanism we had for rules #1 and #2 was the fact that packages once used their repository URLs as a notion of identity, and those two things were (rightly) decoupled a few toolchain releases ago.
and yet, by giving up on “URL path components as package identities”, we must acknowledge we have given up on a few important properties:
-
we lost the notion of a “machine-readable” package name, e.g. a string with format restrictions such that we could use the package identity for things like generating directory names or assigning URLs.
-
we lost a visual indicator for quickly determining if a name refers to a package or a module. (e.g. “
swift-syntax
” is the package, while “SwiftSyntax
” is the module.)
i did a quick survey of a handful of “official” Apple packages, and it seems even among them, chaos now reigns supreme:
repository | package identity | package identity (mangled) |
---|---|---|
GitHub - apple/swift-package-manager: The Package Manager for the Swift Programming Language | SwiftPM |
swiftpm |
GitHub - apple/swift-system: Low-level system calls and types for Swift | swift-system |
swift-system |
GitHub - apple/swift-syntax: A set of Swift libraries for parsing, inspecting, generating, and transforming Swift source code. | SwiftSyntax |
swiftsyntax |
GitHub - apple/swift-nio: Event-driven network application framework for high performance protocol servers & clients, non-blocking. | swift-nio |
swift-nio |
GitHub - apple/swift-markdown: A Swift package for parsing, building, editing, and analyzing Markdown documents. | swift-markdown |
swift-markdown |
GitHub - apple/swift-argument-parser: Straightforward, type-safe argument parsing for Swift | swift-argument-parser |
swift-argument-parser |
as we can see, “mangling” the package identities into something suitable as a machine identifier doesn’t give consistent results, and moreover it’s not clear to me how to mangle package identifiers that contain spaces or other special characters.
what are the names of these packages?