semvec/pypi-packages huggingface dataset:
p115image302 0.0.2
115 image 302 backend.
License: MIT
Requires Python: <4.0,>=3.12
Keywords: python-115, 302, backend

# 115 image 302 backend

## 安装

你可以通过 [pypi](https://pypi.org/project/p115image302/) 安装

```console
pip install -U p115image302
```

## 用法

### 作为模块

```python
from p115client import P115Client
from p115image302 import make_application
from uvicorn import run

cookies = "UID=...; CID=...; SEID=...; KID=..."
client = P115Client(cookies, ensure_cookies=True, check_for_relogin=True)
run(
    make_application(client, debug=True), 
    host="0.0.0.0", 
    port=8000, 
    proxy_headers=True, 
    server_header=False, 
    forwarded_allow_ips="*", 
    timeout_graceful_shutdown=1, 
)
```

### 作为命令

```console
$ p115image302 -h
usage: p115image302 [-h] [-c COOKIES] [-cp COOKIES_PATH] [-H HOST] [-P PORT] [-d] [-uc UVICORN_RUN_CONFIG_PATH] [-v] [-l] [dbfile]

    ╭───────────────────────── Welcome to 115 image 302 ───────────────────────────╮
    │                                                                              │
    │  maintained by ❤     ChenyangGao https://chenyanggao.github.io               │
    │                                                                              │
    │                      Github      https://github.com/ChenyangGao/p115client/  │
    │                                                                              │
    │                      license     https://www.gnu.org/licenses/gpl-3.0.txt    │
    │                                                                              │
    │                      version     0.0.2                                       │
    │                                                                              │
    ╰──────────────────────────────────────────────────────────────────────────────╯

⚽️ 支持下载：用 key 查询，可以是 sha1、oss、id 或者 pickcode，其中 oss 是阿里云 OSS 对象存储的存储桶和对象 id 的组合，格式形如 f"{bucket}_{object}"，例如 "fhnimg_6991ce15fa60d3515b1eb7866a73b6b59a6b9598_0_0"。支持查询参数 permanent=1，以指定获取永久链接

    GET http://localhost:8000/{key}
    GET http://localhost:8000/{key}/name

🏀 支持上传：用 PUT 方法上传，请求体即是文件内容

    PUT http://localhost:8000

⚾️ 无论上传还是下载，文件大小不得超过 50 MB
🥎 如果用 sha1 或 oss 下载图片（或者任何不大于 50 MB 的文件），则对应文件不必在你网盘中

positional arguments:
  dbfile                缓存的数据库路径，默认为当前工作目录下的 'p115image302.db'

options:
  -h, --help            show this help message and exit
  -c, --cookies COOKIES
                        cookies 字符串，优先级高于 -cp/--cookies-path
  -cp, --cookies-path COOKIES_PATH
                        cookies 文件保存路径，默认为当前工作目录下的 115-cookies.txt
  -H, --host HOST       ip 或 hostname，默认值：'0.0.0.0'
  -P, --port PORT       端口号，默认值：8000，如果为 0 则自动确定
  -d, --debug           启用调试，会输出更详细信息
  -uc, --uvicorn-run-config-path UVICORN_RUN_CONFIG_PATH
                        uvicorn 启动时的配置文件路径，会作为关键字参数传给 `uvicorn.run`，支持 JSON、YAML 或 TOML 格式，会根据扩展名确定，不能确定时视为 JSON
  -v, --version         输出版本号
  -l, --license         输出授权信息
```
unmake 0.1.4
A reversible-operations journal library with session-based history and undo orchestration.
License: MIT
Requires Python: >=3.10

# unmake

`unmake` is a Python library for recording destructive operations in **sessions** and orchestrating undos later.

It is intentionally split into:

- **Storage backend** (you choose persistence strategy, e.g., SQLite)
- **Operation payload** (you define schema and reconstruction)
- **Undo orchestration** (library provides session + operation ordering)

## Install

```bash
uv sync
```

## Quickstart

```python
from pathlib import Path

from unmake import HistoryManager, OperationRegistry, SQLiteStorage

manager = HistoryManager(SQLiteStorage("history.db"))

# Record a run
with manager.start_session(script="dangerous_script.py", args=["--force"]) as session:
    Path("a.txt").rename("b.txt")
    session.record_operation("fs.move", {"src": "a.txt", "dst": "b.txt"})

# Register reconstruction logic for undo
class MoveUndo:
    def __init__(self, payload: dict):
        self.src = payload["src"]
        self.dst = payload["dst"]

    def undo(self) -> None:
        Path(self.dst).rename(self.src)

registry = OperationRegistry()
registry.register("fs.move", MoveUndo)

# Undo all operations in reverse order
session_id = manager.list_sessions(limit=1)[0].session_id
manager.undo_session(session_id, registry)
```

## Development workflow

This project is configured for `uv`, `make`, and PEP 621 metadata.

```bash
make install
make test
make lint
make build
```

### Publish

```bash
# Configure token in env first
# export UV_PUBLISH_TOKEN=...
make publish
```

### Bump version

```bash
make bump-patch
make bump-minor
make bump-major
```

## Thread Safety

### InMemoryStorage
- Not thread-safe by default
- Use external locking for concurrent access:

```python
import threading

from unmake import HistoryManager, InMemoryStorage

storage = InMemoryStorage()
manager = HistoryManager(storage)
lock = threading.Lock()

with lock:
    with manager.start_session(script="safe.py") as session:
        session.record_operation("demo.noop", {"value": 1})
```

### SQLiteStorage
- Thread-safe for standard usage with one connection per method call
- SQLite handles concurrent access with internal locking
- Performance may degrade under very high contention
- Prefer one `HistoryManager` per thread

### Best Practices
- Use `SQLiteStorage` for multi-threaded applications
- Use `InMemoryStorage` only with external locking when shared across threads
- Avoid sharing a mutable `HistoryManager` + `InMemoryStorage` pair across threads

## CLI

Install project dependencies and run:

```bash
unmake --db history.db list-sessions
unmake --db history.db show-session <session-id>
unmake --db history.db undo <session-id>
```
runcommands 1.0a73
A framework for writing console scripts and running commands
License: MIT
Requires Python: >=3.10
Keywords: run, commands, console, scripts, terminal

RunCommands
+++++++++++

A simple command runner that uses ``argparse`` from the Python standard
library under the hood. Runs on Python 3 only (3.10 and up). Uses
annotations to configure options.

There are two basic use cases:

1. Standalone console scripts (including scripts with subcommands).
2. Collections of commands (similar to make, Fabric, etc).

Building on these, especially #2, there are a couple of more advanced
use cases:

1. A simple orchestration/deployment tool. If you have a simple build
   process and just need to ``rsync`` some files to a server, a few
   simple commands might be all you need.
2. A wrapper for more sophisticated orchestration/deployment tools--an
   alternative to the Bash scripts you might use to drive Ansible
   playbooks and the like.

Basic Usage
===========

Define a command:

.. code-block:: python

    from runcommands import arg, command
    from runcommands.commands import local

    @command
    def test(*tests: arg(help='Specific tests to run (instead of using discovery)')):
        if tests:
            local(('python', '-m', 'unittest', tests))
        else:
            local('python -m unittest discover .')

Show its help::

    > run test -h
    test [-h] [TESTS [TESTS ...]]

    positional arguments:
      TESTS       Specific tests to run (instead of using discovery)

    optional arguments:
      -h, --help  show this help message and exit

Run it::

    > run test
    ..........
    ----------------------------------------------------------------------
    Ran 0 tests in 0.000s

    OK

Create a standalone console script using a standard script entry point:

.. code-block:: toml

    # pyproject.toml
    [project.scripts]
    my-test-script = "package.module:test.console_script"

Reinstall the package to install the script and then run it::

    > my-test-script
    ..........
    ----------------------------------------------------------------------
    Ran 0 tests in 0.000s

    OK

See the `main documentation`_ for more information on installation,
defining & running commands, configuration, etc.

Features
========

* Easily create standalone console scripts: simply define a function and
  wrap it with the ``@command`` decorator.
* Easily create standalone console scripts that have subcommands (a la
  ``git``).
* Create collections of commands (similar to make, Fabric, etc).
* Run multiple commands in sequence: ``run build deploy``.
* Uses ``argparse`` under the hood so command line usage is familiar.
* Provides built-in help/usage for all commands via ``argparse``.
* Provides command line completion (including example scripts for bash
  and fish).

Documentation
=============

Detailed documentation is on `Read the Docs`_.

License
=======

MIT. See the LICENSE file in the source distribution.

TODO
====

* Improve command line completion
* Add more documentation and examples
* Add more tests (current coverage is 45%)

.. _main documentation: http://runcommands.readthedocs.io/
.. _Read the Docs: `main documentation`_