Introducing the Swift Package Index

Hi all, we've made something that should be particularly interesting to the community here: The Swift Package Index. The project indexes SPM packages and presents various stats like popularity, maturity, activity, number of releases - and more. We hope it's going to be a great resource for the Swift community.

Please take a look at https://swiftpackageindex.com and let us know what you think!

Dave (@daveverwer) & Sven (@finestructure)

23 Likes

Thanks for posting it @finestructure - Happy to chip in with any answers that I can too!

:wave: everyone

pretty cool index aggregation hub! :smile:

1 Like

Looks amazing! Very clean and fast.

Would you consider removing Google Analytics though please.

9 Likes

Nice work on this! The package stats feature is very cool. :100:

1 Like

i tried to add my own package to the list and run the validate.swift script, but it does not specify a swift version and is not compiling on my environment. i tried with swift 4.2, 5.0.1, 5.2 (which is the version matching the xcode in your github action workflow), and the latest nightly build.

output with 4.2:

$ swiftenv local 4.2
$ swift validate.swift diff
validate.swift:116:11: error: use of undeclared type 'Result'
extension Result where Success == Void {
          ^~~~~~
validate.swift:117:17: error: use of undeclared type 'Failure'
  init(_ error: Failure?) {
                ^~~~~~~
validate.swift:160:45: error: use of undeclared type 'Result'
func getPackageSwiftURL(for gitURL: URL) -> Result<URL, PackageError> {
                                            ^~~~~~
validate.swift:189:96: error: use of undeclared type 'Result'
func download(_ packageSwiftURL: URL, withSession session: URLSession, _ callback: @escaping ((Result<URL, PackageError>) -> Void)) -> URLSessionDataTask {
                                                                                               ^~~~~~
validate.swift:317:122: error: use of undeclared type 'Result'
func filterRepos(_ packageUrls: [URL], withSession session: URLSession, includingMaster: Bool, _ completion: @escaping ((Result<[URL], Error>) -> Void)) {
                                                                                                                         ^~~~~~
validate.swift:356:30: error: use of unresolved identifier 'Result'
  var packageUnsetResults = [Result<Void, PackageError>?].init(repeating: nil, count: packageUrls.count)
                             ^~~~~~
validate.swift:365:38: error: use of unresolved identifier 'Result'
        packageUnsetResults[index] = Result<Void, PackageError>(error)
                                     ^~~~~~
validate.swift:427:97: error: argument type 'String' does not conform to expected type 'CVarArg'
  print(String(format: helpText, CommandLine.arguments.first?.components(separatedBy: "/").last ?? "validate.sh"))
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
                                                                                                                 as! CVarArg

output with 5.0.1:

$ swiftenv local 5.0.1
$ swift validate.swift diff
validate.swift:221:11: warning: 'launchPath' is deprecated: renamed to 'executableURL'
  process.launchPath = "/usr/bin/swift"
          ^
validate.swift:221:11: note: use 'executableURL' instead
  process.launchPath = "/usr/bin/swift"
          ^~~~~~~~~~
          executableURL
validate.swift:268:11: warning: 'launch()' is deprecated: renamed to 'run'
  process.launch()
          ^
validate.swift:268:11: note: use 'run' instead
  process.launch()
          ^~~~~~
          run
validate.swift:427:97: error: argument type 'String' does not conform to expected type 'CVarArg'
  print(String(format: helpText, CommandLine.arguments.first?.components(separatedBy: "/").last ?? "validate.sh"))
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
                                                                                                                 as! CVarArg

output with 5.2:

$ swiftenv local 5.2
$ swift validate.swift diff
validate.swift:189:136: error: 'URLSessionDataTask' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
func download(_ packageSwiftURL: URL, withSession session: URLSession, _ callback: @escaping ((Result<URL, PackageError>) -> Void)) -> URLSessionDataTask {
                                                                                                                                       ^~~~~~~~~~~~~~~~~~
Foundation.URLSessionDataTask:2:18: note: 'URLSessionDataTask' has been explicitly marked unavailable here
public typealias URLSessionDataTask = AnyObject
                 ^
validate.swift:189:60: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
func download(_ packageSwiftURL: URL, withSession session: URLSession, _ callback: @escaping ((Result<URL, PackageError>) -> Void)) -> URLSessionDataTask {
                                                           ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:282:57: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
func verifyPackage(at gitURL: URL, withSession session: URLSession, _ callback: @escaping ((PackageError?) -> Void)) {
                                                        ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:317:61: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
func filterRepos(_ packageUrls: [URL], withSession session: URLSession, includingMaster: Bool, _ completion: @escaping ((Result<[URL], Error>) -> Void)) {
                                                            ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:351:60: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
func parseRepos(_ packageUrls: [URL], withSession session: URLSession, _ completion: @escaping (([URL: PackageError]) -> Void)) {
                                                           ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:411:13: error: 'URLSessionConfiguration' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
let config: URLSessionConfiguration = .default
            ^~~~~~~~~~~~~~~~~~~~~~~
Foundation.URLSessionConfiguration:2:18: note: 'URLSessionConfiguration' has been explicitly marked unavailable here
public typealias URLSessionConfiguration = AnyObject
                 ^
validate.swift:416:15: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
let session = URLSession(configuration: config)
              ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:427:97: error: argument type 'String' does not conform to expected type 'CVarArg'
  print(String(format: helpText, CommandLine.arguments.first?.components(separatedBy: "/").last ?? "validate.sh"))
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
                                                                                                                 as! CVarArg
validate.swift:143:14: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
  let task = URLSession.shared.dataTask(with: apiURL) { (data, response, error) in
             ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:221:11: warning: 'launchPath' is deprecated: renamed to 'executableURL'
  process.launchPath = "/usr/bin/swift"
          ^
validate.swift:221:11: note: use 'executableURL' instead
  process.launchPath = "/usr/bin/swift"
          ^~~~~~~~~~
          executableURL
validate.swift:268:11: warning: 'launch()' is deprecated: renamed to 'run'
  process.launch()
          ^
validate.swift:268:11: note: use 'run' instead
  process.launch()
          ^~~~~~
          run

output with DEVELOPMENT-SNAPSHOT-2020-05-26-a:

$ swiftenv local DEVELOPMENT-SNAPSHOT-2020-05-26-a
klossy@klossy:~/downloads/MasterPackageList$ swift validate.swift diff
validate.swift:189:136: error: 'URLSessionDataTask' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
func download(_ packageSwiftURL: URL, withSession session: URLSession, _ callback: @escaping ((Result<URL, PackageError>) -> Void)) -> URLSessionDataTask {
                                                                                                                                       ^~~~~~~~~~~~~~~~~~
Foundation.URLSessionDataTask:2:18: note: 'URLSessionDataTask' has been explicitly marked unavailable here
public typealias URLSessionDataTask = AnyObject
                 ^
validate.swift:189:60: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
func download(_ packageSwiftURL: URL, withSession session: URLSession, _ callback: @escaping ((Result<URL, PackageError>) -> Void)) -> URLSessionDataTask {
                                                           ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:282:57: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
func verifyPackage(at gitURL: URL, withSession session: URLSession, _ callback: @escaping ((PackageError?) -> Void)) {
                                                        ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:317:61: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
func filterRepos(_ packageUrls: [URL], withSession session: URLSession, includingMaster: Bool, _ completion: @escaping ((Result<[URL], Error>) -> Void)) {
                                                            ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:351:60: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
func parseRepos(_ packageUrls: [URL], withSession session: URLSession, _ completion: @escaping (([URL: PackageError]) -> Void)) {
                                                           ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:411:13: error: 'URLSessionConfiguration' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
let config: URLSessionConfiguration = .default
            ^~~~~~~~~~~~~~~~~~~~~~~
Foundation.URLSessionConfiguration:2:18: note: 'URLSessionConfiguration' has been explicitly marked unavailable here
public typealias URLSessionConfiguration = AnyObject
                 ^
validate.swift:416:15: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
let session = URLSession(configuration: config)
              ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:427:3: error: type of expression is ambiguous without more context
  print(String(format: helpText, CommandLine.arguments.first?.components(separatedBy: "/").last ?? "validate.sh"))
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
validate.swift:143:14: error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
  let task = URLSession.shared.dataTask(with: apiURL) { (data, response, error) in
             ^~~~~~~~~~
Foundation.URLSession:2:18: note: 'URLSession' has been explicitly marked unavailable here
public typealias URLSession = AnyObject
                 ^
validate.swift:221:11: warning: 'launchPath' is deprecated: renamed to 'executableURL'
  process.launchPath = "/usr/bin/swift"
          ^
validate.swift:221:11: note: use 'executableURL' instead
  process.launchPath = "/usr/bin/swift"
          ^~~~~~~~~~
          executableURL
validate.swift:268:11: warning: 'launch()' is deprecated: renamed to 'run'
  process.launch()
          ^
validate.swift:268:11: note: use 'run' instead
  process.launch()
          ^~~~~~
          run

This is strange: I tried this earlier with 5.2 and got Killed: 9 :thinking: With 5.2.4 on the other hand it worked.

I’ll need to take a look as to why that’s completely dying on my machine. Thanks for reporting it!

That's a great point, I didn't notice that it starts tracking without consent. I've created an issue: Remove Google Analytics or ask user's permission · Issue #411 · SwiftPackageIndex/SwiftPackageIndex-Server · GitHub

i’m not sure this is the same issue, the problem i am running into is a compilation error, not a runtime error. i think it probably has something to do with foundation incompatibilities between macos and linux.