API reference

PackageAnalyzer.analyze!Method
analyze!(root, registry_entries::AbstractVector{<:RegistryEntry}; auth::GitHub.Authorization=github_auth(), sleep=0) -> Vector{Package}

Analyze all packages in the iterable registry_entries, using threads, cloning them to root if a directory with their uuid does not already exist. Returns a Vector{Package}.

If the GitHub authentication is non-anonymous and the repository is on GitHub, the list of contributors to the repositories is also collected, after waiting for sleep seconds for each entry (useful to avoid getting rate-limited by GitHub). See PackageAnalyzer.github_auth to obtain a GitHub authentication.

source
PackageAnalyzer.analyze!Method
analyze!(root, package::RegistryEntry; auth::GitHub.Authorization=github_auth()) -> Package

Analyze the package whose entry in the registry is in the dir directory, cloning the package code to joinpath(root, uuid) where uuid is the UUID of the package, if such a directory does not already exist.

If the GitHub authentication is non-anonymous and the repository is on GitHub, the list of contributors to the repository is also collected, after waiting for sleep seconds. Only the number of contributors will be shown in the summary. See PackageAnalyzer.github_auth to obtain a GitHub authentication.

source
PackageAnalyzer.analyzeMethod
analyze(name_or_dir_or_url::AbstractString; repo = "", reachable=true, subdir="", registry=general_registry(), auth::GitHub.Authorization=github_auth())

Analyze the package pointed to by the mandatory argument and return a summary of its properties.

If name_or_dir_or_url is a valid Julia identifier, it is assumed to be the name of a package available in registry. The function then uses find_package to find its entry in the registry and analyze its content.

If name_or_dir_or_url is a filesystem path, analyze the package whose source code is located at name_or_dir_or_url. Optionally repo and reachable a boolean indicating whether or not the package is reachable online, since these can't be inferred from the source code. The subdir keyword arguments indicates the subdirectory of dir under which the Julia package can be found.

Otherwise, name_or_dir_or_url is assumed to be a URL. The repository is cloned to a temporary directory and analyzed.

If the GitHub authentication is non-anonymous and the repository is on GitHub, the list of contributors to the repository is also collected. Only the number of contributors will be shown in the summary. See PackageAnalyzer.github_auth to obtain a GitHub authentication.

Example

You can analyze a package just by its name, whether you have it installed locally or not:

julia> analyze("Pluto")
Package Pluto:
  * repo: https://github.com/fonsp/Pluto.jl.git
  * uuid: c3e4b0f8-55cb-11ea-2926-15256bba5781
  * is reachable: true
  * lines of Julia code in `src`: 5108
  * lines of Julia code in `test`: 2342
  * has license(s) in file: MIT
    * filename: LICENSE
    * OSI approved: true
  * has license(s) in Project.toml: MIT
    * OSI approved: true
  * number of contributors: 63
  * has documentation: false
  * has tests: true
  * has continuous integration: true
    * GitHub Actions
source
PackageAnalyzer.analyzeMethod
analyze(package::RegistryEntry; auth::GitHub.Authorization=github_auth(), sleep=0) -> Package
analyze(packages::AbstractVector{<:RegistryEntry}; auth::GitHub.Authorization=github_auth(), sleep=0) -> Vector{Package}

Analyzes a package or list of packages using the information in their directory in a registry by creating a temporary directory and calling analyze!, cleaning up the temporary directory afterwards.

If the GitHub authentication is non-anonymous and the repository is on GitHub, the list of contributors to the repository is also collected after waiting for sleep seconds (useful to avoid getting rate-limited by GitHub). Only the number of contributors will be shown in the summary. See PackageAnalyzer.github_auth to obtain a GitHub authentication.

Example

julia> analyze(find_package("BinaryBuilder"))
Package BinaryBuilder:
  * repo: https://github.com/JuliaPackaging/BinaryBuilder.jl.git
  * uuid: 12aac903-9f7c-5d81-afc2-d9565ea332ae
  * is reachable: true
  * lines of Julia code in `src`: 4724
  * lines of Julia code in `test`: 1542
  * has license(s) in file: MIT
    * filename: LICENSE.md
    * OSI approved: true
  * number of contributors: 50
  * has documentation: true
  * has tests: true
  * has continuous integration: true
    * GitHub Actions
    * Azure Pipelines
source
PackageAnalyzer.analyzeMethod
analyze(m::Module; kwargs...) -> Package

If you want to analyze a package which is already loaded in the current session, you can simply call analyze, which uses pkgdir to determine its source code:

julia> using DataFrames

julia> analyze(DataFrames)
Package DataFrames:
  * repo:
  * uuid: a93c6f00-e57d-5684-b7b6-d8193f3e46c0
  * is reachable: true
  * lines of Julia code in `src`: 15347
  * lines of Julia code in `test`: 15654
  * has license(s) in file: MIT
    * filename: LICENSE.md
    * OSI approved: true
  * has documentation: true
  * has tests: true
  * has continuous integration: true
    * GitHub Actions
source
PackageAnalyzer.analyze_path!Method
analyze_path!(dest::AbstractString, repo::AbstractString; name="", uuid=UUID(UInt128(0)), subdir="", auth=github_auth(), sleep=0) -> Package

Analyze the Julia package located at the URL given by repo by cloning it to dest and calling analyze_path(dest).

If the clone fails, it returns a Package with reachable=false. If a name and uuid are provided, these are used to populate the corresponding fields of the Package. If the clone succeeds, the name and uuid are taken instead from the Project.toml in the package itself, and the values passed here are ignored.

If the GitHub authentication auth is non-anonymous and the repository is on GitHub, the list of contributors to the repository is also collected, after waiting for sleep seconds for each entry. See PackageAnalyzer.github_auth to obtain a GitHub authentication.

source
PackageAnalyzer.analyze_pathMethod
analyze_path(dir::AbstractString; repo = "", reachable=true, subdir="", auth::GitHub.Authorization=github_auth(), sleep=0) -> Package

Analyze the package whose source code is located at the local path dir. If the package's repository is hosted on GitHub and auth is a non-anonymous GitHub authentication, wait for sleep seconds before collecting the list of its contributors.

source
PackageAnalyzer.find_packagesFunction
find_packages(; registry = general_registry()) -> Vector{RegistryEntry}
find_packages(names::AbstractString...; registry = general_registry()) -> Vector{RegistryEntry}
find_packages(names; registry = general_registry()) -> Vector{RegistryEntry}

Find all packages in the given registry (specified by the registry keyword argument), the General registry by default. Return a vector of RegistryEntry pointing to to the directories of each package in the registry.

Pass a list of package names as the first argument to return the paths corresponding to those packages, or individual package names as separate arguments.

source
PackageAnalyzer.github_authFunction
PackageAnalyzer.github_auth(token::String="")

Obtain a GitHub authetication. Use the token argument if it is non-empty, otherwise use the GITHUB_TOKEN and GITHUB_AUTH environment variables, if set and of length 40. If all these methods fail, return an anonymous authentication.

source