FeatureRegistries.FeatureRegistriesModule

FeatureRegistries.jl is a Julia package to create registries of a package’s features, letting package users discover and use them more easily. FeatureRegistries.jl lets you create tables that list package features so that

  • users can explore and discover features,
  • users can search features through a consistent interface; and
  • developers of third-party packages can transparently add functionality

Usage

Package users

Package users of packages can use registries through:

  • find/filter/findfirst to subset the list of features based on filters,
  • info(registry) to get more information on a specific registry,
  • registry[id] to inspect an entry in a registry,
  • load(registry) to access a feature

See also how to use registries.

Package developers

Developers can create registries using Registry and Field, push!(registry).

FeatureRegistries.FieldMethod
struct Field(T, name; kwargs...)

A field defines what data will be stored in one column of a Registry.

Keyword arguments

  • description::String = "": More information on the field contents and how they can be used. May contain Markdown formatting.
  • optional = false: Whether a registry entry can be entered without alue in this field.
  • default = missing: The default value used if optional === true. If a non-missing value is passed, the value of optional is ignored and the field is treated as optional.
  • defaultfn = (row, key) -> default: Function to compute dynamically compute a default value from an entry. If passed, the value of default is ignored.

Examples

A simple Field with entries of type String:

Field(String, "My Field")
FeatureRegistries.RegistryMethod
Registry(fields; kwargs...)

Create a feature registry with columns of Fields.

Keyword arguments

  • name::String: A descriptive name.
  • fields::NamedTuple:
  • description::String = "": Description text for the registry. Shown when info(registry) is called.
  • loadfn = identity: Function to apply over a row when load is called. For example, calling load(registry["id"]) will call loadfn.
FeatureRegistries.RegistryEntryType
struct RegistryEntry(row, registry)

An entry in a feature registry registry with values row. Returned when indexing into a FeatureRegistry, i.e. registry[id].

FeatureRegistries.exampleregistryMethod
exampleregistry()

Create a Registry of mathematical functions for testing purposes.

Examples

{cell}

using FeatureRegistries
registry = FeatureRegistries.exampleregistry()
FeatureRegistries.findMethod
find(registry, [; col = filter, ...])

Find entries in a registry that match a set of filters given as keyword arguments. The keyword name must correspond to a field in registry, while the value is a filter that is checked against each field value.

See how to use registries for examples.

FeatureRegistries.infoFunction
info(registry)

Show information about a registry, specifically its name, description and fields.

Examples

{cell}

using FeatureRegistries: exampleregistry, info
registry = exampleregistry()
info(registry)
FeatureRegistries.loadMethod
load(entry)
load(registry[id])

Load a feature represented by a registry entry. The behavior depends on the Registry.

FeatureRegistries.runtestsMethod
FeatureRegistries.runtests(pattern...; kwargs...)

Equivalent to ReTest.retest(FeatureRegistries, pattern...; kwargs...). This function is defined automatically in any module containing a @testset, possibly nested within submodules.

FeatureRegistries.string_formatMethod
string_format(str)

Ensure that a string is shown with double quotes.

```julia-repl julia> string_format("hi") ""hi""