Suppose I have a librari named foo-bar
, and I've written a conanfile.py
for it. When running conan create
for it, I get the warning:
WARN: Name containing special chars is discouraged 'foo-bar'
right away.
My question: How strongly is this discouraged? How bad is it - if at all - to have a Conan package name with hyphens/minus chars?
PS - In case it matters, I'm using Conan 2.0.13 and am hoping to get my package onto the Conan Center.
TL;DR: There's a risk of conflicts when exporting packages whose names only vary in the special characters
+
/-
/_
. For examplefoo+bar
,foo-bar
, andfoo_bar
.Looking at the source where that warning is emitted, there's a comment that provides a bit of context:
This check was added in PR #12053 (issue #11857), which was a response to PR #11826 (issue #11822). The root issue was that
+
s and-
s in package names would both become normalized to_
in some contexts, which could create ambiguity if two package names differed only in their use of+
/-
/_
.How bad using a
-
is depends on whether you think there's a risk of conflicts from exporting two packages that vary only in+
/-
/_
.I do not see any references about using
-
s being officially deprecated. The tutorial in the docs still states that-
s are valid in package names: