semvec/pypi-packages huggingface dataset:
lemonsqueezer 0.1.4
An fast and lightweight wrapper for lemonbar
License: MIT
Requires Python: >=3.6.0


LemonSqueezer
=============

**LemonSqueezer** is a python wrapper for lemonbar that makes it easy to make
beautiful, informative status bars using *less power* than most other status
bars. This is achieved by only updating the bar when new output is available,
without polling commands for output, (such as polybar or a custom lemonbar
script would do).

Installation
------------

- Arch Linux

  ```sh
  git clone https://aur.archlinux.org/python-lemonsqueezer.git
  cd python-lemonsqueezer
  makepkg -si
  ```

- General

  ```sh
  sudo pip install python-lemonsqueezer
  ```

Basics
------

Lemonsqueezer defines its output in terms of `Modules`. These are python
objects which define how and when to render output on the bar. The base
`BarModule` class has little to no behaviour attached to it and so, to create
useful modules, a couple of helper subclasses are available (See
`CommandWatcherModule` or `PeriodicModule` in the docs). There are also a few
premade modules for things such as battery or a clock.

Creating custom modules
-----------------------

New modules are created by subclassing the base `BarModule` class and
overriding the `setup` and `get_output` methods.

Lemonsqueezer uses asyncio to achieve its efficiency. Both `setup` and
`get_output` are coroutine methods. When the bar starts, `setup` is awaited
first. When it returns, its output is placed on the bar at the appropriate
location (as specified by the BarModule constructor). After that,
`get_output` is awaited repeatedly, setting the module text whenever it
returns. Note that if `get_output` returns None, then the bar is not updated
at all.

Helper subclasses
-----------------

- `PeriodicModule`

  Run a command every few seconds and set the output based on its output

  This is the closest to how other bars usually get output, and it's probably
  the most inefficient method to create a module. However you can still have
  a small improvement over a traditional bar manager since you are able to
  return None if there are no changes to the output.

- `CommandMonitorModule`

  Use this type of module when you want to have the module update whenever a
  command produces some output. A lot of the built-in modules are defined using this.
easy-config 0.2.0
Parse configuration values from files, the environment, and elsewhere all in one place.
License: MIT
Requires Python: >=3.6
Keywords: configuration,config,configuration management

easy_config |python_versions| |license| |develop_build| |develop_coverage|
==========================================================================

.. |python_versions| image:: https://img.shields.io/badge/python->%3D3.6-blue.svg?style=flat-square
    :alt: Supports Python 3.6 and later
.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
    :target: LICENSE.rst
    :alt: MIT License
.. |develop_build| image:: https://img.shields.io/travis/com/scolby33/easy_config/develop.svg?style=flat-square
    :target: https://travis-ci.com/scolby33/easy_config
    :alt: Develop Build Status
.. |develop_coverage| image:: https://img.shields.io/codecov/c/github/scolby33/easy_config/develop.svg?style=flat-square
    :target: https://codecov.io/gh/scolby33/easy_config/branch/develop
    :alt: Develop Test Coverage

Example
-------

Here is a full working example of using easy_config. First, write your configuration class:

.. code-block:: python

   # config.py
   from easy_config import EasyConfig

   class MyProgramConfig(EasyConfig):
      FILES = ['myprogram.ini']
      NAME = 'MyProgram'  # the name for the .ini file section and the namespace prefix for environment variables

      # define the options like you would a dataclass
      number: int
      name: str
      check_bounds: bool = True  # options with defaults must all come after non-default options

A sample configuration file:

.. code-block:: ini

   # myprogram.ini
   [MyProgram]
   # section name matches `NAME` from the configuration class
   number = 3

And a sample program to illustrate the usage:

.. code-block:: python

   # test_config.py
   import sys

   from config import MyProgramConfig

   print(MyProgramConfig.load(name=sys.argv[1])

Running this program with various options:

.. code-block:: bash

   $ python test_config.py Scott
   MyProgramConfig(number=3, name='Scott', check_bounds=True)

   $ env MYPROGRAM_CHECK_BOUNDS=False python test_config.py Scott
   # environment variable names are the all-uppercase transformation of the NAME concatenated with the option name and an underscore
   MyProgramConfig(number=3, name='Scott', check_bounds=False)

   $ env MYPROGRAM_NUMBER=10 MYPROGRAM_NAME=Charlie python test_config.py Scott
   MyProgramConfig(number=10, name='Scott', check_bounds=True)

As you can see, values are taken in precedence, with arguments passed to ``load`` overriding values from the environment which, in turn, override values from configuration files.

Once you have the ``MyProgramConfig`` instance, you can use it just like any dataclass.