semvec/pypi-packages huggingface dataset:
stallion-python-sdk 1.2.4
SDK for Stallion message broker
Requires Python: >=3.6

<h1 align="center">
Stallion Python SDK
</h1>

<br />

<p align="center">
<img src="https://img.shields.io/badge/Python-3.21-blue?style=for-the-badge&logo=python" alt="go version" />
<img src="https://img.shields.io/badge/Version-1.2.1-2255DD?style=for-the-badge&logo=github" alt="version" /><br />
<img src="https://img.shields.io/badge/MacOS-black?style=for-the-badge&logo=apple" alt="version" />
<img src="https://img.shields.io/badge/Linux-white?style=for-the-badge&logo=linux" alt="version" />
<img src="https://img.shields.io/badge/Windows-blue?style=for-the-badge&logo=windows" alt="version" /><br /><br />
Client SDK for Stallion message broker
</p>

## How to use?
Python install:
```shell
pip install stallion-python-sdk
```

### Client
Create a client:
```python
# importing Client module
from stallion import Client

# creating a client
# with given stallion server url
c = Client(url="st://localhost:9090")
```

### Publish
```python
# publish an object on a topic
c.Publish("book", {'author': "Amirhossein", 'name': "Stallion"})
```

### Subscribe
```python
# creating a handler
# any published object will be given to this handler as data
def handler(data):
    print(f'{data['author']}: {data['name']})

# subscribe over a topic with given handler
c.Subscribe("book", handler)
```

### Unsubscribe
```python
# unsubscribe from a topic
c.Unsubscribe("book")
```
fastapi-sqlmodel-crud 0.3.0
fastapi-sqlmodel-crud is a program which is based on fastapi+sqlmodel and used to quickly build the Create, Read, Update, Delete generic API interface.
Requires Python: >=3.6.1
Keywords: sqlmodel,fastapi-sqlmodel-crud,fastapi-amis-admin,fastapi-crud,fastapi-sqlmodel

## Project Introduction

`fastapi-sqlmodel-crud` is a project based on `FastAPI`+`SQLModel`, which is used to quickly build Create, Read, Update, Delete common API interfaces.

## Install

```bash
pip install fastapi-sqlmodel-crud 
```

## Simple example

**main.py**:

```python
from typing import Optional
from fastapi import FastAPI
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine
from sqlmodel import SQLModel, Field
from fastapi_amis_admin.crud import SQLModelCrud


# 1. Create SQLModel model
class Article(SQLModel, table=True):
    id: int = Field(default=None, primary_key=True, nullable=False)
    title: str = Field(title='ArticleTitle', max_length=200)
    description: Optional[str] = Field(default='', title='ArticleDescription', max_length=400)
    status: bool = Field(None, title='status')
    content: str = Field(title='ArticleContent')


# 2. Create AsyncEngine
database_url = 'sqlite+aiosqlite:///amisadmin.db'
engine: AsyncEngine = create_async_engine(database_url, future=True)

# 3. Register crud route
article_crud = SQLModelCrud(model=Article, engine=engine).register_crud()

app = FastAPI(debug=True)

# 4. Include the router
app.include_router(article_crud.router)


# 5. Create model database table (first run)
@app.on_event("startup")
async def startup():
    async with engine.begin() as conn:
        await conn.run_sync(SQLModel.metadata.create_all)

```

## Development documentation

- https://docs.gh.amis.work/crud/SQLModelCrud/

## Dependent projects

- [FastAPI](https://fastapi.tiangolo.com)

- [SQLModel](https://sqlmodel.tiangolo.com/)

## Licence

The project follows the Apache2.0 license agreement.
python-clock-timer 0.4.0
Awesome clock_timer created by maycuatroi

# Clock Timmer

[![CI](https://github.com/maycuatroi/clock_timer/actions/workflows/main.yml/badge.svg)](https://github.com/maycuatroi/clock_timer/actions/workflows/main.yml)

Clock Timmer is a Python library that provides a tool for logging the time and number of calls of a function in Python. It can be used as a decorator or context manager, allowing you to log the time and number of calls of a function or block of code without modifying any lines of code within the function or block.

Installation
To install Clock Timmer, use the following command:
```commandline
pip install python-clock-timer
```
# Usage
## As a decorator
To use Clock Timmer as a decorator, you can use it like this:

```python
from clock_timer import ClockLogger

logger = ClockLogger()

@logger
def my_function():
    # code of the function
```
After using the decorator, you can access the time and number of calls logs of the function by accessing the log attribute of the Clock Timmer object. For example, to get the number of calls and total time elapsed of the my_function, you can do the following:

```python
print(logger.log['my_function'])
```
## As a context manager
To use Clock Timmer as a context manager, you can use it like this:

```python
from clock_timer import ClockLogger

with ClockLogger() as logger:
# code of the block

print(logger.total_elapsed)
```
After using the context manager, you can access the total time elapsed by accessing the elapsed attribute of the Clock Timmer object.

# Example
Here is an example of using Clock Timmer as a decorator and a context manager:

```python
from clock_timer import ClockLogger
import time

# Using Clock Timmer as a decorator
logger = ClockLogger()

@logger
def my_function():
    time.sleep(1)

my_function()
my_function()

print(logger.log['my_function'])
```
the output
```
my_function was called 1 times, total time elapsed: 1.005031s
my_function was called 2 times, total time elapsed: 2.005123s
[2, 2.0051226250000003]
```

## Using Clock Timmer as a context manager

```python
import time

from clock_timer import ClockLogger

with ClockLogger() as logger:
    time.sleep(1)

print(logger.total_elapsed)
```
The output of this example will be:

```
Total time elapsed: 1.003622s
1.003622042
```
# Contributing
We welcome contributions to Clock Timmer. If you have any ideas for improvements or want to report a bug, please open an issue or submit a pull request.

# License
Clock Timmer is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.