semvec/pypi-packages huggingface dataset:
portainer-ctl 0.2.1
A poor man's kubectl for docker swarm
Requires Python: >=3.8
Keywords: docker, docker swarm, kubectl, portainer, swarm

### Portainer controller
[![](https://img.shields.io/pypi/v/portainer-ctl)](https://pypi.org/project/portainer-ctl/)

### Install
This project is published to PyPi and you can install it using pip:
```
pip install portainer-ctl
```

You can also use the published container images:

```sh
docker pull hnaderi/pctl
# or
docker pull ghcr.io/hnaderi/pctl
```

#### Features
- Fully automated deployment
- Support for multiple config and secret
- Support for .env files and multiple variables
- Support for api tokens introduced in portainer 2.11.0

#### Usage

``` plaintext
Usage: pctl [-h] [-T API_TOKEN] [-H HOST] [-U USERNAME] [-P PASSWORD] [--debug] [-j] {deploy,stacks,configs,secrets,endpoints,tags,system} ...

Poorman's kubectl, CLI for portainer on docker swarm

Options:
  -h, --help            show this help message and exit
  -T, --api-token API_TOKEN
                        api token for user, overrides PORTAINER_TOKEN variable (default: None)
  -H, --host HOST       portainer host, overrides PORTAINER_HOST variable (default: http://127.0.0.1:9000/api)
  -U, --username USERNAME
                        username to login, overrides PORTAINER_USERNAME variable (default: admin)
  -P, --password PASSWORD
                        password for user, overrides PORTAINER_PASSWORD variable (default: admin)
  --debug               Whether or not print debugging logs (default: False)
  -j, --json            Print json output (default: False)

Commands:
  {deploy,stacks,configs,secrets,endpoints,tags,system}

No budget. No vendors. No fleet of ops. Just you, a blinking cursor, and the will to script what others buy. The rich scale with dollars. You scale with shell. Excuses cost, Automation pays!
```

You can provide host, username and password in environment:
- PORTAINER_HOST
- PORTAINER_USERNAME
- PORTAINER_PASSWORD
- PORTAINER_TOKEN
fastapi-stats-page 0.1.7
FastAPI visitor statistics with middleware and stats page
Requires Python: >=3.7

# fastapi-stats-page

# usage
```
from fastapi import FastAPI
from fastapi_stats_page import StatsRouter, TrackVisitsMiddleware

app = FastAPI()

app.include_router(StatsRouter(title="Statistics of website").router)

app.add_middleware(TrackVisitsMiddleware)

@app.get("/")
async def homepage():
    return "hello world"
```
this will save visitors ip and user agens to a list

you can also save visitors to a file by doing this
```
from fastapi import FastAPI
from fastapi_stats_page import StatsRouter, TrackVisitsMiddleware

app = FastAPI()

app.include_router(StatsRouter(title="Statistics of website", get_from="users.txt").router)

app.add_middleware(TrackVisitsMiddleware, save_to="users.txt")

@app.get("/")
async def homepage():
    return "hello world"
```
unfazed-redis 0.0.2
Redis client for Unfazed
Requires Python: >=3.12

Unfazed Redis
====

Unfazed-Redis borned to solve namespace issues in Redis.


## Installation

```bash
pip install unfazed-redis
```


## Quick Start


### Add settings to your project


```python

# settings.py

UNFAZED_SETTINGS = {
    "CACHE": {
        "default": {
            "BACKEND": "unfazed_redis.backends.namespaceclient.NamespaceClient",
            "LOCATION": "redis://localhost:6379",
            "OPTIONS": {
                "PREFIX": "my_prefix",
                "VERSION": "1",
            }
        }
    }
}

```


### Use in your project


```python

# services.py

from unfazed.cache import caches

async def my_service():

    cache = caches["default"]
    await cache.set("my_key", "my_value")
    value = await cache.get("my_key")
    print(value)

```
Py-UselessLib 1.0.1
A useless Python library
Requires Python: >=3.6


# UselessLib 说明文档

## 1. 概述

UselessLib 是一个Python工具库，提供了一系列工具函数。本库采用模块化设计，包含对布尔值、整数、字符串等基础数据类型的判断操作，以及函数执行等功能。

## 2. 功能模块

### 2.1 布尔(Bool)操作模块

提供全面的布尔值判断和操作功能：

- 判断布尔值的真伪状态
- 生成随机布尔值
- 获取基础布尔常量

#### 核心功能示例

```python
from cn.xiuxius.uselesslib.bool import is_true, is_false, random_bool

print(is_true(True))  # True
print(random_bool())  # 随机True或False
```

| 函数                  | 描述         | 返回值  |
|---------------------|------------|------|
| `is_true(n: bool)`  | 判断是否为True  | bool |
| `is_false(n: bool)` | 判断是否为False | bool |
| `random_bool()`     | 生成随机布尔值    | bool |

### 2.2 整数(Int)操作模块

提供0-100整数的精确判断功能，支持自定义数字匹配：

#### 核心功能示例

```python
from cn.xiuxius.uselesslib.int import is_zero, is_twenty, is_custom_number

print(is_zero(0))  # True
print(is_custom_number(30, 30))  # True
```

本模块包含从0到100的精确判断函数，如 `is_one()` 到 `is_one_hundred()`。

### 2.3 字符串(Str)操作模块

提供字母a-z的大小写敏感/不敏感匹配，支持自定义字符串匹配：

#### 核心功能示例

```python
from cn.xiuxius.uselesslib.str import is_a, is_z_ignore_case, is_custom_str

print(is_a("a"))  # True
print(is_custom_str("Test", "test"))  # False
```

| 函数命名规则                 | 示例        |
|------------------------|-----------|
| `is_[a-z]`             | 区分大小写的匹配  |
| `is_[a-z]_ignore_case` | 不区分大小写的匹配 |

### 2.4 函数(Fun)操作模块

提供函数执行功能：

- 带参数/关键字参数执行
- 带异常概率的执行
- 多种执行方式封装

#### 核心功能示例

```python
from cn.xiuxius.uselesslib.fun import execute_fun_with_args, execute_fun_with_random_exception

def add(a, b):
    return a + b

execute_fun_with_args(add, 1, 2)  # 3

try:
    execute_fun_with_random_exception(lambda: 1/1, probability=0.1)
except Exception as e:
    print(f"捕获异常: {e}")
```


### 2.5 工具(Util)模块

提供系统级功能：

- 随机打印字符串
- 异步崩溃机制（用于测试场景）

#### 核心功能示例

```python
from cn.xiuxius.uselesslib.util import random_print_str, async_crash_with_random_time_in_1_minute

random_print_str()  # 输出随机字符串
# async_crash_with_random_time_in_1_minute()  # 谨慎使用
```

## 3. 安装与使用

### 3.1 安装方式

```bash
pip install Py-UselessLib
```

### 3.2 基础导入

```python
from cn.xiuxius.uselesslib import bool, int, str, fun, util
```

## 4. 最佳实践

### 4.1 布尔运算

```python
from cn.xiuxius.uselesslib.bool import is_true_or_false

result = is_true_or_false(False)  # 安全的布尔判断
```

### 4.2 执行一个函数并以probability的概率抛出一个随机异常

```python
from cn.xiuxius.uselesslib.fun import execute_fun_with_random_exception
execute_fun_with_random_exception(lambda: 1/1, probability=0.1)
```

### 4.3 自定义匹配

#### 可以自定义的字符串匹配 极高的扩展性和自由度

```python
from cn.xiuxius.uselesslib.str import is_custom_str_ignore_case

match = is_custom_str_ignore_case("Hello", "hello")  # True
```

## 6. 许可证

UselessLib 使用 MIT 许可证开放源代码，详情见 LICENSE 文件。