semvec/pypi-packages huggingface dataset:
py-viper 0.1.0.dev5
Python viper

# Python Viper

This project was inspired by [spf13/viper](https://github.com/spf13/viper).

## Installation

```
pip install py-viper
```

## Usage

```python
import tempfile
import viper

yaml_example = b'''
hello:
  name: foo
'''


class Hello:
    name = ''


class Config:
    hello = Hello


if __name__ == '__main__':
    with tempfile.NamedTemporaryFile(suffix='.yaml') as temp:
        temp.write(yaml_example)
        temp.seek(0)
        viper.set_config_path(temp.name)
        viper.read_config()
        assert viper.get('hello.name') == 'foo'

        conf = Config()
        viper.unmarshal(conf)
        assert conf.hello.name == 'foo'
```

You can also use remote config instead of local config:

```python
viper.set_config_type('yml')
viper.set_remote_provider('consul', '127.0.0.1', 8500, 'hello')
viper.read_remote_config()
```

Note:

- The config type only supports *yaml* or *yml*.
- The backend of remote config only supports *consul*.

## TODO

- [x] Read remote config
- [x] Unmarshal config
- [x] Add support for JSON
aioevents-ng 0.0.9
A simple library for managing events through an asynchronous queue
Requires Python: >=3.7

=========
aioevents
=========

.. image:: https://travis-ci.com/mpyatishev/aioevents.svg?branch=master
    :target: https://travis-ci.com/mpyatishev/aioevents
.. image:: https://codecov.io/gh/mpyatishev/aioevents/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/mpyatishev/aioevents
.. image:: https://img.shields.io/pypi/v/aioevents-ng.svg
    :target: https://pypi.python.org/pypi/aioevents-ng


A simple library for managing events through an asynchronous queue


Installation
============

.. code:: bash

   pip install aioevents-ng


Usage example
=============

.. code:: python

   import asyncio

   from dataclasses import dataclass

   import aioevents


   @dataclass
   class MyEvent(aioevents.Event):
      payload: str


   @aioevents.manager.register(MyEvent)
   async def event_hadler(event: aioevents.Event):
      print(f"recieved: {event}")


   async def produce():
      async with aioevents.events as events:
         await events.publish(MyEvent("Hello!"))


   async def main():
      aioevents.start(asyncio.get_event_loop())

      await produce()

      print('stopping worker')
      aioevents.stop()

      # wait for all coroutines
      await asyncio.sleep(1)


   if __name__ == "__main__":
      asyncio.run(main())


License
=======

``aioevents`` library is offered under Apache 2 license.