lupkg package¶
Submodules¶
lupkg.exceptions module¶
-
exception
lupkg.exceptions.
LupkgMetadataException
(message, key=None, valid_values=None)[source]¶ Bases:
exceptions.Exception
Custom exception for LuPKG.
Thrown when there is a problem with the provided or missing metadata, either from user input, or the lupkg repo structure/format.
Parameters:
lupkg.lupkg module¶
Main module.
-
class
lupkg.lupkg.
LuPKG
(metadata, base_url=None)[source]¶ Bases:
object
Model class for a package.
Enables access to metadata like download url, author, type of file, etc.
-
details
()[source]¶ Returns all metadata as a dictionary, in a raw form.
Returns: all metadata Return type: dict
-
fill_string_template
(text, version, properties=None, ignore_template_errors=False, use_first_value_as_default=False, use_global_properties=True, use_version_properties=True)[source]¶ Replace template variables in strings with values from the property attribute.
- If ‘use_first_value_as_default’ is a list, the requirement key will be checked against this list,
- and only if it is included will the first value used as default. Otherwise this value needs to be a bool.
Parameters: - text (str) – the source string
- version (str) – the version
- properties (dict) – the properties to use when templating the url details (defaults to merged version/general properties of this pkg)
- ignore_template_errors (bool) – whether to error out when missing template keys are encountered (False) or not (True)
- use_first_value_as_default (bool, list) – whether to use the first value of the version properties as default when no user input for that key
- use_global_properties (bool) – whether to use the ‘global’ properties of this pkg for templating
- use_version_properties (bool) – whether to use the properties of the specified version of this pkg for templating
Returns: the templated string
Return type:
-
classmethod
from_dict
(lupkg_dict, pkg_name=None, base_url=None)[source]¶ Creates a :class:~LuPKG object.
Parameters: Returns: the package object
Return type:
-
classmethod
from_name_and_url
(pkg_name, url, base_url=None)[source]¶ Creates a minimal package description from a name and url.
To use this, the package name and the (only) file need to be the same.
Parameters: Returns: the package object
Return type:
-
get_property
(prop_key)[source]¶ Returns the value(s) associated with a property key for this package.
Returns: a list of potential values for this property Return type: list
-
get_property_names
()[source]¶ Returns a list of additional property names available for this package.
Returns: a list of property names Return type: list
-
get_url_details
(version=None, properties=None, ignore_template_errors=False, use_first_value_as_default=False)[source]¶ Get url details for version number.
Parameters: - version (str) – the version in question, defaults to ‘LATEST’
- properties (dict) – the properties to use when templating the url details
- ignore_template_errors (bool) – whether to error out when missing template keys are encountered (False) or not (True)
- use_first_value_as_default (bool) – whether to use the first value of the version properties as default when no user input for that key
Returns: the url details
Return type:
-
get_version
(version_name)[source]¶ Returns the version details for the specified version name.
Parameters: version_name (str) – the version name Returns: the version details dict (keys: ‘version’, ‘properties’, ‘urls’) Return type: dict
-
get_version_details
(version=None, properties=None, ignore_template_errors=False, use_first_value_as_default=False)[source]¶ Get version details for version number.
Parameters: - version (str) – the version in question, defaults to ‘LATEST’
- properties (dict) – the properties to use when templating the url details (defaults to merged version/general properties of this pkg)
- ignore_template_errors (bool) – whether to error out when missing template keys are encountered (False) or not (True)
- use_first_value_as_default (bool) – whether to use the first value of the version properties as default when no user input for that key
Returns: the version details
Return type:
-
get_version_properties
(version=None)[source]¶ Get a dictionary of version-specific properties.
The result is a merged dictionary of the general properties and the versions specific ones.
Parameters: version (str) – the version Returns: the version properties Return type: dict
-
has_file
(file_name, version=None)[source]¶ Checks whether this package contains a file with the specified filename.
Parameters: Returns: whether the file is available in this package (True) or not (False)
Return type:
-
version_numbers
()[source]¶ Returns a list of version numbers.
Returns: a list of version number strings Return type: list
-
versions
()[source]¶ The available versions for this package.
The result will be a list containing dicts. For more details look up the metadata format.
Returns: a list of versions for this package Return type: list
-
-
class
lupkg.lupkg.
LupkgRepoFolderReader
(use_folders_as_tags=True, **kwargs)[source]¶ Bases:
luci.readers.MetadataFolderReader
Parses a folder for lupkg metadata files/structure.
Parameters:
-
class
lupkg.lupkg.
RepoLucifier
(**kwargs)[source]¶ Bases:
luci.lucify.Lucifier
-
process_dictlet
(metadata, dictlet_details=None)[source]¶ The main method implemented by a lucifier, it executes the task it is written for, using the metadata accrued as configuration.
Depending on the lucifier, this may return a string, an object, or nothing (and just prints out text to stdout).
Parameters: - metadata – the metadata to process
- dictlet_details – metadata about the dictlet itself
Returns: the new (processed) metadata
Return type:
-
lupkg.lupkg_config module¶
Main module.
lupkg.lupkg_index module¶
Main module.
-
class
lupkg.lupkg_index.
LupkgFileIndex
(url=None, alias=None, pkg_base_url=None, **kwargs)[source]¶ Bases:
lupkg.lupkg_index.LupkgIndex
LuPKGS
implementation that reads one or multiple yaml files to get package metadata.-
get_available_packages
()[source]¶ Returns all available package names in no particular order.
Returns: a list of package names Return type: list
-
-
class
lupkg.lupkg_index.
LupkgFolderIndex
(url=None, alias=None, pkg_base_url=None, reader_params=None, **kwargs)[source]¶ Bases:
lupkg.lupkg_index.LupkgIndex
LuPKGS
implementation that stores metadata about packages in a folder structure.Internally this uses the luci python library to read the metadata from the folder. This happens in the
LupkgMetadataFolderLucifier
class to hold the relevant metadata derived from the folder.-
get_available_packages
()[source]¶ Returns all available package names in no particular order.
Returns: a list of package names Return type: list
-
-
class
lupkg.lupkg_index.
LupkgFolderLucifier
(reader_params=None, **kwargs)[source]¶ Bases:
luci.lucify.Lucifier
-
process_dictlet
(metadata, dictlet_details=None)[source]¶ The main method implemented by a lucifier, it executes the task it is written for, using the metadata accrued as configuration.
Depending on the lucifier, this may return a string, an object, or nothing (and just prints out text to stdout).
Parameters: - metadata – the metadata to process
- dictlet_details – metadata about the dictlet itself
Returns: the new (processed) metadata
Return type:
-
-
class
lupkg.lupkg_index.
LupkgIndex
(url=None, alias=None, pkg_base_url=None)[source]¶ Bases:
object
Base class to hold information about a package repository.
This can be extended by classes that wish to implement a specific way of storing and querying that data (e.g. using a database etc.).
-
get_all_urls
(properties=None)[source]¶ Returns a map of all package names with their corresponding url for the latest version.
Parameters: properties (dict) – optional properties to be used in the package selection Returns: a dict with the package name as key, and the url as value Return type: OrderedDict
-
get_available_packages
()[source]¶ Returns all available package names in no particular order.
Returns: a list of package names Return type: list
-
get_package_types
()[source]¶ Returns a list of package types in this repository.
Returns: the list of package types Return type: list
-
get_pkg
(name)[source]¶ Returns the
LuPKG
object for the specified package name.Returns: the package details, or none if package doesn’t exist Return type: LuPKG
-
get_pkg_metadata
(name)[source]¶ Returns the metadata of a package (in LuPKG format).
Parameters: name (str) – the package name Returns: the metadata Return type: dict
-
get_pkg_names
()[source]¶ Returns a sorted list of available package names.
Returns: a list of package names Return type: list
-
-
class
lupkg.lupkg_index.
LupkgMultiIndex
(url=None, alias=None, pkg_base_url=None, indexes=None, **kwargs)[source]¶ Bases:
lupkg.lupkg_index.LupkgIndex
LuPKGS
implementation to hold multiple, different LuPKGS objectsParameters: -
get_available_packages
()[source]¶ Returns all available package names in no particular order.
Returns: a list of package names Return type: list
-
lupkg.lupkg_list module¶
-
class
lupkg.lupkg_list.
LupList
(pkgs, context=None, meta=None, vars=None)[source]¶ Bases:
frkl.frklist.Frklist
-
class
lupkg.lupkg_list.
LupkgPath
(path, metadata_file=None)[source]¶ Bases:
object
lupkg.lupkg_processors module¶
Main module.
-
class
lupkg.lupkg_processors.
DownloadProcessor
(**kwargs)[source]¶
-
class
lupkg.lupkg_processors.
LupkgProcessor
(output_callback=None, default_log_level=20)[source]¶ Bases:
object
lupkg.utils module¶
Main module.
-
class
lupkg.utils.
TqdmUpTo
(iterable=None, desc=None, total=None, leave=True, file=None, ncols=None, mininterval=0.1, maxinterval=10.0, miniters=None, ascii=None, disable=False, unit='it', unit_scale=False, dynamic_ncols=False, smoothing=0.3, bar_format=None, initial=0, position=None, postfix=None, unit_divisor=1000, gui=False, **kwargs)[source]¶ Bases:
tqdm._tqdm.tqdm
Alternative Class-based version of the above.
Provides update_to(n) which uses tqdm.update(delta_n).
Inspired by [twine#242](https://github.com/pypa/twine/pull/242), [here](https://github.com/pypa/twine/commit/42e55e06).
-
lupkg.utils.
ensure_base_path
(path, create_folder=False)[source]¶ Utility method to manage the target path.
Module contents¶
Top-level package for lupkg.