zensols-util

Command line, configuration and persistence utilities

https://github.com/plandes/util

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.9%) to scientific vocabulary

Keywords

command-line command-line-parser python python3
Last synced: 4 months ago · JSON representation ·

Repository

Command line, configuration and persistence utilities

Basic Info
  • Host: GitHub
  • Owner: plandes
  • License: mit
  • Language: Python
  • Default Branch: master
  • Size: 2.09 MB
Statistics
  • Stars: 2
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Topics
command-line command-line-parser python python3
Created over 5 years ago · Last pushed 5 months ago
Metadata Files
Readme Changelog Contributing License Citation

README.md

Zensols Utilities

PyPI Python 3.12 Python 3.11 Build Status

Command line, configuration and persistence utilities generally used for any more than basic application. This general purpose library is small, has few dependencies, and helpful across many applications.

Some features include:

  • A Hydra or Java Spring like application level support for configuration than configparser.
    • Construct objects using configuration files (both INI and YAML).
    • Parse primitives, dictionaries, file system objects, instances of classes.
  • A command action library using an action mnemonic to invocation of a handler that is integrated with a the configuration API. This supports long and short GNU style options as provided by optparse.
  • Streamline in memory and on disk persistence.
  • Multi-processing work with a persistence layer.

A secondary goal of the API is to make prototyping Python code quick and easy using the REPL. Examples include reloading modules in the configuration factory.

Documentation

Obtaining

The easiest way to install the command line program is via the pip installer: bash pip3 install zensols.util

Command Line Usage

This library contains a full persistence layer and other utilities. However, a quick and dirty example that uses the configuration and command line functionality is given below. See the other examples to learn how else to use it.

```python from dataclasses import dataclass from enum import Enum, auto import os from io import StringIO from zensols.cli import CliHarness

CONFIG = """

configure the command line

[cli] apps = list: app

define the application, whose code is given below

[app] class_name = fsinfo.Application """

class Format(Enum): short = auto() long = auto()

@dataclass class Application(object): """Toy application example that provides file system information.

"""
def ls(self, format: Format = Format.short):
    """List the contents of the directory.

    :param format: the output format

    """
    cmd = ['ls']
    if format == Format.long:
        cmd.append('-l')
    os.system(' '.join(cmd))

if (name == 'main'): harnes = CliHarness(appconfigresource=StringIO(CONFIG)) harnes.run() ```

The framework automatically links each command line action mnemonic (i.e. ls) to the data class Application method ls and command line help. For example: ```shell $ python ./fsinfo.py -h Usage: fsinfo.py [options]:

List the contents of the directory.

Options: -h, --help show this help message and exit --version show the program version and exit -f, --format short the output format

$ python ./fsinfo.py -f short pycache fsinfo.py ```

See the full example that demonstrates more complex command line handling, documentation and explanation.

Template

The easiest to get started is to template out this project is to create your own boilerplate project with the mkproj utility. This requires a Java installation, and easy to create a Python boilerplate with the following commands:

```bash

clone the boilerplate repo

git clone https://github.com/plandes/template

download the boilerplate tool

wget https://github.com/plandes/clj-mkproj/releases/download/v0.0.7/mkproj.jar

create a python template and build it out

java -jar mkproj.jar config -s template/python java -jar mkproj.jar ```

This creates a project customized with your organization's name, author, and other details about the project. In addition, it also creates a sample configuration file and command line that is ready to be invoked by either a Python REPL or from the command line via GNU make.

If you don't want to bother installing this program, the following sections have generated code as examples from which you can copy/paste.

Citation

If you use this project in your research please use the following BibTeX entry:

bibtex @inproceedings{landes-etal-2023-deepzensols, title = "{D}eep{Z}ensols: A Deep Learning Natural Language Processing Framework for Experimentation and Reproducibility", author = "Landes, Paul and Di Eugenio, Barbara and Caragea, Cornelia", editor = "Tan, Liling and Milajevs, Dmitrijs and Chauhan, Geeticka and Gwinnup, Jeremy and Rippeth, Elijah", booktitle = "Proceedings of the 3rd Workshop for Natural Language Processing Open Source Software (NLP-OSS 2023)", month = dec, year = "2023", address = "Singapore, Singapore", publisher = "Association for Computational Linguistics", url = "https://aclanthology.org/2023.nlposs-1.16", pages = "141--146" }

Changelog

An extensive changelog is available here.

License

MIT License

Copyright (c) 2020 - 2025 Paul Landes

Owner

  • Name: Paul Landes
  • Login: plandes
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
title: >-
  DeepZensols: Deep Learning Framework
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
date-released: 2023-12-05
repository-code: https://github.com/plandes/deepnlp
authors:
  - given-names: Paul
    family-names: Landes
    email: landes@mailc.net
    affiliation: University of Illinois at Chicago
    orcid: 'https://orcid.org/0000-0003-0985-0864'
preferred-citation:
  type: conference-paper
  authors:
    - given-names: Paul
      family-names: Landes
      email: landes@mailc.net
      affiliation: University of Illinois at Chicago
      orcid: 'https://orcid.org/0000-0003-0985-0864'
    - given-names: Barbara
      family-names: Di Eugenio
      affiliation: University of Illinois at Chicago
    - given-names: Cornelia
      family-names: Caragea
      affiliation: University of Illinois at Chicago
  title: >-
    DeepZensols: A Deep Learning Natural Language Processing Framework for
    Experimentation and Reproducibility
  url: https://aclanthology.org/2023.nlposs-1.16/
  year: 2023
  conference:
    name: >-
      Proceedings of the 3rd Workshop for Natural Language Processing Open
      Source Software, Empirical Methods in Natural Language Processing
    city: Singapore
    country: SG
    date-start: 2023-12-05
    date-end: 2023-12-05

GitHub Events

Total
  • Delete event: 2
  • Push event: 65
  • Create event: 14
Last Year
  • Delete event: 2
  • Push event: 65
  • Create event: 14

Issues and Pull Requests

Last synced: 5 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: about 22 hours
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • WarthogARJ (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 733 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 60
  • Total maintainers: 1
pypi.org: zensols-util

Command line, configuration and persistence utilites generally used for any more than basic application.

  • Versions: 60
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 733 Last month
Rankings
Dependent packages count: 9.2%
Downloads: 10.1%
Average: 23.6%
Dependent repos count: 51.6%
Maintainers (1)
Last synced: 5 months ago

Dependencies

src/python/requirements.txt pypi
  • PyYAML >=5.4
  • configparser *
  • frozendict *
  • parse >=1.9.0
.github/workflows/test.yml actions
  • actions/checkout v2.4.0 composite
  • actions/setup-python v2 composite
src/python/setup.py pypi