Basic Python utilities
Reason this release was yanked:
0.1.1 release
Project description
Latest release: 0.1.0 (2025-07-01)
lockss-pybasic provides basic utilities for various LOCKSS projects written in Python.
Modules
- lockss.pybasic.cliutil
Command line utilities.
BaseCli is a base class for command line interfaces that uses pydantic-argparse to define arguments and subcommands, and rich-argparse to display help messages. For each command x-y-z induced by a pydantic-argparse field named x_y_z deriving from BaseModel , the dispatch() method expects a method named _x_y_z.
StringCommand provides a pydantic-argparse way to define a subcommand whose only purpose is printing a string, with COPYRIGHT_DESCRIPTION, LICENSE_DESCRIPTION and VERSION_DESCRIPTION constants provided for convenience. Example:
class MyCliModel(BaseModel): copyright: Optional[StringCommand.type(my_copyright_string)] = Field(description=COPYRIGHT_DESCRIPTION)at_most_one_from_enum and get_from_enum provide a facility for defining a pydantic-argparse model that defines one command line option per constant of an Enum, using an enum keyword argument in the Field definition. Example:
class Orientation(Enum): horizontal = 1 vertical = 2 diagonal = 3 DEFAULT_ORIENTATION = Orientation.horizontal class MyCliModel(BaseModel): diagonal: Optional[bool] = Field(False, description='display diagonally', enum=Orientation) horizontal: Optional[bool] = Field(False, description='display horizontally', enum=Orientation) unrelated: Optional[bool] = Field(...) vertical: Optional[bool] = Field(False, description='display vertically', enum=Orientation) @root_validator def _at_most_one_orientation(cls, values): return at_most_one_from_enum(cls, values, Orientation) def get_orientation(self) -> Orientation: return get_from_enum(self, Orientation, DEFAULT_ORIENTATION)
- lockss.pybasic.errorutil
Error and exception utilities.
InternalError is a no-arg subclass of RuntimeError.
- lockss.pybasic.fileutil
File and path utilities.
file_lines returns the non-empty lines of a file stripped of comments that begin with # and run to the end of a line.
path takes a string or PurePath and returns a Path for which Path.expanduser() and Path.resolve() have been called.
- lockss.pybasic.outpututil
Utilities to work with tabulate.
OutputFormat is an Enum of all the output formats from tabulate.tabulate_formats.
OutputFormatOptions defines a pydantic-argparse model for setting an output format from OutputFormat.
Release Notes
See CHANGELOG.rst.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lockss_pybasic-0.1.0.tar.gz.
File metadata
- Download URL: lockss_pybasic-0.1.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.13.3 Linux/6.15.2-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fef3bf200f49bb85d8926c5f092e03b509240550ad3913cc987c466fb23388b
|
|
| MD5 |
1ef49cb3453d9c4958f4adfede677186
|
|
| BLAKE2b-256 |
7c39f95af60ce452b5ed6837c35ddbcc136a23d88d399ceacf0090dd3fcc423a
|
File details
Details for the file lockss_pybasic-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lockss_pybasic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.13.3 Linux/6.15.2-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d012dfe4358253b60cb44348f84f5bd57d6ca5a2b3013522c8328eaafcd1df47
|
|
| MD5 |
557286d4317e834cb8855dd150c657e0
|
|
| BLAKE2b-256 |
d137039eb1ba652e171e244b7e58fc0d579b8df4be9b92828675a3641e1e50b8
|