semvec/pypi-packages huggingface dataset:
simple-service-compose 0.1.0
Lightweight implementation of Finagle's Service and composable Filter types.
Requires Python: >=3.12

# Introduction

This library is a Python implementation of
[Finagle](https://twitter.github.io/finagle/)'s [`Service` and `Filter`
abstractions](https://twitter.github.io/finagle/guide/ServicesAndFilters.html).

# Purpose

The ability to compose methods is generically useful, and it's nice to have a
common dependency that creates this abstraction.

# Usage

## Create a `Service`

A `Service[A, B]` is a `Callabe[[A], Awaitable[B]]`, generally implemented
like:

```python
async def my_function(inp: A) -> B:
    # Do some awaitable work
    result = await ...
    return result
```

A `Filter[A, B, C, D]` composes logic with a service. A `Filter` is a
decorator/transformer on a service. Composing a `Filter[A, B, C, D]` with a
`Service[C, D]` returns a new `Service[A, B].`

A `SimpleFilter[A, B]` is represents the common case of a decorator that does
not transform the input or output in anyway. A `SimpleFilter[A, B]` is a
`Filter[A, B, A, B]`.

A `Filter` might implement timeout logic on a service, add observability to it,
map between domain types, etc.

A `Filter` is additionally composable with another `Filter`. Composing a
`Filter[A, B, C, D]` with a `Filter[C, D, E, F]` returns a new `Filter[A, B, E,
F]`. That `Filter[A, B, E, F]` could then be composed with another with a
`Service[E, F]` to produce a new `Service[A, B]`. (Of course, the `Filter[A, B,
E, F]` could also be composed with another `Filter[E, F, _, _]`.)

A `Filter` gets composed with another `Filter` using the `.and_then` method. A
`Filter` gets composed with a `Service` with the `.and_then_service` method.

For concrete examples of:
* building services,
* building filters,
* composing filters with services, and
* composing filters with other filters

see: `tests/simple_service_compose/test_service.py`.

# Known Limitations

* In an idealized version (and in the Finagle implementation), filters would
compose with servcie using the same `.and_then` method name that is used to
compose with other filters. Pull requests and issues are welcome.
* The original Finagle implementaion is careful to declare the generic types on
`Filter` as contravariant or covariant, as applicable. We haven't found this to
be necessary for our use cases yet. Pull requests and issues are welcome.
Brian2Cuda 1.0b1
A Brian2 extension to simulate spiking neural networks on GPUs
Requires Python: >=3.10
Keywords: computational neuroscience, simulation, neural networks, spiking neurons, gpu, cuda

Brian2CUDA
==========

Brian2CUDA is an extension of the spiking neural network simulator
[Brian2](https://github.com/brian-team/brian2), written in Python. It
generates C++/CUDA code to run simulations on NVIDIA GPUs.

For **support**, please use the [Brian forum](https://brian.discourse.group/). If
you think you found a bug in Brian2CUDA, please report it at the
[GitHub issue tracker](https://github.com/brian-team/brian2cuda/issues).

For **installation and usage instructions**, check out the
[Brian2CUDA documentation](https://brian2cuda.readthedocs.io).
For information on general Brian2 usage, check out the
[Brian2 documentation](http://brian2.readthedocs.io).

## Quick start
### Installation

You can install Brian2CUDA via `pip`:

```bash
python -m pip install brian2cuda
```

This will install a compatible version of Brian2 as dependency. For installation requirements and GPU configuration, check out the [Brian2CUDA documentation](https://brian2cuda.readthedocs.io/en/latest/index.html).

### Usage
Use your Brian2 code (see [Brian2 documentation](http://brian2.readthedocs.io/en/stable/index.html)) and modify the imports to:

```python
# Standard Brian2 import
from brian2 import *

# Enable GPU usage via Brian2CUDA
import brian2cuda
set_device("cuda_standalone")
```

See [Brian2's standalone code generation](https://brian2.readthedocs.io/en/stable/user/computation.html?highlight=set_device#standalone-code-generation) for more options for the `set_device` call.


## Citation
If you use this software in a published article, please cite
[our Brian2CUDA publication](https://www.frontiersin.org/articles/10.3389/fninf.2022.883700):

> Alevi, D, Stimberg, M, Sprekeler, H, Obermayer, K, Augustin, M. “Brian2CUDA: flexible and efficient simulation of spiking neural network models on GPUs” Frontiers in Neuroinformatics (2022). doi: 10.3389/fninf.2022.883700.

## License
Brian2CUDA is free software licensed under the [GNU General Public License v3 (GPLv3)](https://www.gnu.org/licenses/gpl-3.0.en.html).

## Testing
To run the test suite on Google Collab (no installation or GPU required), click on the badge below:

[![Open In Collab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/brian-team/brian2cuda/blob/master/brian2cuda/tools/test_suite/run_tests.ipynb)
peng-ui 0.3.5
Basic UI components for a Pygame environment.
Requires Python: >=3.11

# peng-ui

Basic UI components for a Pygame environment.

## Installation

```sh
pip install peng_ui
```

## Basic Usage
You can subclass the `Viewer` class to create a custom UI very quickly.

```python
import pygame as pg

from peng_ui.elements import TextField, EditField, Label, Button
from peng_ui.viewer import Viewer

class MyViewer(Viewer):
    def __init__(self):
        super().__init__(screen_size=(800, 600))
        self.button = Button(pg.Rect(50, 50, 120, 40), "Click Me!")
        self.label = Label(pg.Rect(50, 100, 120, 40), "This is text :)")
        self.edit_field = EditField(pg.Rect(200, 50, 220, 40), "Edit me...")
        self.text_field = TextField(pg.Rect(200, 100, 520, 440), "This is a long text :).\nIt supports multi-lines, copy-paste, selection, ...")

    def tick(self):
        if self.button.is_clicked:
            self.text_field.set_text(self.edit_field.text)
        if self.label.is_clicked:
            print('label clicked')


if __name__ == '__main__':
    viewer = MyViewer()
    viewer.run()
```

To get more finegrained control over the UI, see the implementation of the `peng_ui.viewer.Viewer` class.