# SwiftPM must relax its versioning requirements for dependencies

**URL:** <https://forums.swift.org/t/swiftpm-must-relax-its-versioning-requirements-for-dependencies/63969>\
**Category:** Discussion\
**Created:** [March 25, 2023, 10:03pm UTC](https://forums.swift.org/t/swiftpm-must-relax-its-versioning-requirements-for-dependencies/63969 "2023-03-25T22:03:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![taylorswift](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/taylorswift/32/43413_2.png) [@taylorswift](https://forums.swift.org/u/taylorswift)\
**Post date:** [March 25, 2023, 10:03pm UTC](https://forums.swift.org/t/swiftpm-must-relax-its-versioning-requirements-for-dependencies/63969/1 "2023-03-25T22:03:07Z")

</div>

i was originally going to bump the [Confused by unsafe flags being disallowed in dependencies - #51 by Joakim\_Hassila1](https://forums.swift.org/t/confused-by-unsafe-flags-being-disallowed-in-dependencies/27359/51) thread, but i figured this is a different enough issue to warrant its own thread.

as i’m sure most of us are aware, SPM prohibits any of the following in a package that can be consumed by another package:

1. dependencies which need “unsafe” flags like `-Xcc -mcx16`
2. dependencies that follow “non-standard” release patterns.

the first restriction has been discussed at length in the other thread. i want to talk about the second restriction, because i am currently trying to add a dependency to the [swift-markdown](https://github.com/apple/swift-markdown) package, which does not follow semantic versioning (it has its own [toolchain-synchronized release process](https://github.com/apple/swift-markdown/tags)).

according to the swift package index, swift-markdown [has not tagged a ‘semantic’ release](https://swiftpackageindex.com/apple/swift-markdown) since the package was founded, and that release is not a semantic version release (it is not prefixed with `v`), so it can’t be used with SPM anyway. this appears to be intentional, because [the instructions](https://github.com/apple/swift-markdown#getting-started-using-markup) in the package’s README tell us to pin it to the default branch head:

```swift
.package(url: "https://github.com/apple/swift-markdown.git", .branch("main")),

```

so we cannot say that depending on the default branch head is not using the package as intended. and this strikes me as strange, because this implies that packages like swift-markdown are banned from SPM by design.

swift-markdown is not some random package developed by a third-party. it is an official package that releases with and is part of the toolchain (via DocC). and i feel that, in lieu of alternatives to SPM, SPM must support dependencies on packages that are part of Apple’s “official” sector of the ecosystem.

does Apple intentionally ship tooling that is incompatible with its own ecosystem?

---

<div class="post-metadata">

**Author:** ![SDGGiesbrecht](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sdggiesbrecht/32/4768_2.png) [@SDGGiesbrecht](https://forums.swift.org/u/SDGGiesbrecht)\
**Post date:** [March 25, 2023, 10:18pm UTC](https://forums.swift.org/t/swiftpm-must-relax-its-versioning-requirements-for-dependencies/63969/2 "2023-03-25T22:18:11Z")

</div>

Your main question is a good one, but regarding this side note:

> [@taylorswift](#):
>
> that release is not a semantic version release (it is not prefixed with `v`), so it can’t be used with SPM anyway

What? Any leading `v` is ignored. It was permitted as a courtesy for compatibility with other package managers needing to point at the same repository. It is officially equivalent to the standard tag format without it. `0.1.0` is the recommended way to tag a release of a Swift package, and is used in most of the documentation examples. Where did you get the idea SwiftPM would reject it?

---

<div class="post-metadata">

**Author:** ![taylorswift](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/taylorswift/32/43413_2.png) [@taylorswift](https://forums.swift.org/u/taylorswift)\
**Post date:** [March 25, 2023, 10:24pm UTC](https://forums.swift.org/t/swiftpm-must-relax-its-versioning-requirements-for-dependencies/63969/3 "2023-03-25T22:24:43Z")

</div>

i remember depending on `0.1.0` did not resolve the last time i tried it, but i just tried it again, and while it is still unresolvable, it looks like this is not because of the missing `v`, it is because of the `swift-cmark` dependency:

```swift
.package(url: "https://github.com/apple/swift-markdown", .upToNextMinor(
    from: "0.1.0")),

```

```swift
error: Dependencies could not be resolved because root depends on 'swift-markdown' 0.1.0..<0.2.0.
'swift-markdown' >= 0.1.0 cannot be used because package 'swift-markdown' is required using a stable-version but 'swift-markdown' depends on an unstable-version package 'swift-cmark' and no versions of 'swift-markdown' match the requirement 0.1.1..<0.2.0.

```

the impact is the same though, it appears there are no (!!!) extant versions of swift-markdown that can be used in a versioned SPM package.

* * *

aside: for the moment i am actually consuming your github fork of swift-markdown:

> **[GitHub - SDGGiesbrecht/swift-markdown: A Swift package for parsing, building,...](https://github.com/SDGGiesbrecht/swift-markdown)**
>
> A Swift package for parsing, building, editing, and analyzing Markdown documents. - GitHub - SDGGiesbrecht/swift-markdown: A Swift package for parsing, building, editing, and analyzing Markdown doc...

as far as i am concerned, yours is now the official repository, since the original package is unusable.

---

<div class="post-metadata">

**Author:** ![SDGGiesbrecht](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sdggiesbrecht/32/4768_2.png) [@SDGGiesbrecht](https://forums.swift.org/u/SDGGiesbrecht)\
**Post date:** [March 26, 2023, 12:45am UTC](https://forums.swift.org/t/swiftpm-must-relax-its-versioning-requirements-for-dependencies/63969/4 "2023-03-26T00:45:06Z")

</div>

Yes, that explanation for its rejection sounds more familiar—almost as though I encountered it too somewhere... 😉

---

<div class="post-metadata">

**Author:** ![MPLewis](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mplewis/32/40019_2.png) [@MPLewis](https://forums.swift.org/u/MPLewis)\
**Post date:** [March 26, 2023, 4:14am UTC](https://forums.swift.org/t/swiftpm-must-relax-its-versioning-requirements-for-dependencies/63969/5 "2023-03-26T04:14:39Z")

</div>

Big +1. At the very least, a package maintainer should be able to pin to specific commit hashes for dependencies (and thus take on the responsibility of updating and ensuring compatibility manually) and have SPM shut up about semantic releases when people in turn consume that package.

---

<div class="post-metadata">

**Author:** ![Playrom](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/playrom/32/29309_2.png) [@Playrom](https://forums.swift.org/u/Playrom)\
**Post date:** [March 26, 2023, 3:32pm UTC](https://forums.swift.org/t/swiftpm-must-relax-its-versioning-requirements-for-dependencies/63969/6 "2023-03-26T15:32:57Z")

</div>

Semantic versioning is not even an international standard, it is just a "common method"

Nowadays a lot of repositories and projects use other methods, for example the "year.version"  
method (like 2023.1, 2023.2 ecc...)
