semvec/pypi-packages huggingface dataset:
pyglitch 0.1.1
A library for image file manipulation, focused on data corruption and glitch effects.
Requires Python: >=3.6

pyglitch
A library for image file manipulation, focused on data corruption and glitch effects.

Introduction
pyglitch is a simple yet powerful tool for creating artistic data corruption effects on image files. By directly manipulating the raw byte data of an image, this library produces unique and unpredictable "glitches" that can be used for digital art and creative projects.

The library supports popular image formats like JPEG and PNG by navigating their file headers and focusing corruption on the main image data.

Installation
You can install pyglitch directly from PyPI (when published) or from a local source.

To install from a local source:

pip install .

The library has no external dependencies beyond Python's standard library.

Usage
The main function you will use is glitch_img(). You can import it directly from the main package, as shown below.

glitch_img(image_path, output_path, corruption_level)

image_path: The path to the input image file (e.g., 'my_photo.jpg').

output_path: The path where the glitched image will be saved (e.g., 'glitched_photo.jpg').

corruption_level: (Optional) A float representing the percentage of the file's data to corrupt (e.g., 0.05 for 5%). The default value is 0.01.

Example
Here is a simple Python script to use the pyglitch library:

from pyglitch import glitch_img

input_image = 'path/to/your/image.jpg'
output_image = 'path/to/save/glitched_image.jpg'

# Glitch the image with a 2% corruption level
glitch_img(input_image, output_image, corruption_level=0.02)

print(f"Glitched image saved to {output_image}")

Contributing
pyglitch is an open-source project. If you have an idea for a new type of glitch effect or an improvement, please feel free to contribute!

License
This project is licensed under the MIT License. See the LICENSE file for details.
filetype-py 1.0.0
Python package for getting identifying file types, based on Rust's file_type crate.
Requires Python: >=3.8

# filetype_py

This is a quick and dirty Python package for identifying file types, based on Rust's [file_type](https://docs.rs/file_type/latest/file_type/) crate.

It is not to be confused with [filetype](https://pypi.org/project/filetype/), a package written in pure Python, and it's possible you may want something written in that instead. I made this before I realized that package existed, but I'm continuing to upload it because the Rust library supports more types then the python version (upwards of 10,000+).

# Usage

```py
import file_type
import sys

if(len(sys.argv)) <= 1:
    print(sys.argv[0]+" <filetype>")
    exit(0)

# Get the file type information about the given file
file = file_type.filetype_from_file(sys.argv[1])
# There is also filetype_from_bytes, filetype_from_media_type, and filetype_from_extension

# Print what the file type is, as a human readable string
print("Name:", file.name())

# Print the ID of the file type, corresponding to the table at https://github.com/theseus-rs/file-type/blob/main/FILETYPES.md
print("ID:", file.id())

# Print the extension(s) that this file type usually has.
print("Extensions:", file.extensions())

# Print the 'source type' of the file. This is what provided the information the library uses to determine the file, i.e. ICANN or Wikidata.
print("Source Type:", file.source_type())
```
py-archons 0.3.3
A simple Python package with get_names, get_cities, and get_countries functions
Requires Python: >=3.7
Keywords: python, package, names

# py-archons

A simple Python package that provides `get_names`, `get_cities`, and `get_countries` functions.

## Installation

```bash
pip install py-archons
```

## Usage

```python
from py_archons import get_names, get_cities, get_countries

names = get_names()
print(names)  # Output: ["guapo", "bandida"]

cities = get_cities()
print(cities)  # Output: ["new york", "london"]

countries = get_countries()
print(countries)  # Output: ["united states", "united kingdom"]
```

## Development

To install in development mode:

```bash
pip install -e .
```

## Building and Publishing

### Automated Publishing (Recommended)

Use the `publish.py` script for a complete workflow. The script automatically:
- Reads the current version from `version.py`
- Checks if the version already exists on PyPI
- Prevents duplicate uploads
- Updates version only when specified

```bash
# Publish current version from version.py (smart - checks if version exists)
python publish.py

# Test current version with TestPyPI
python publish.py --test

# Just build current version without uploading
python publish.py --build-only

# Update to specific version and publish
python publish.py 0.4.0

# Using shell script (auto-activates venv)
./publish.sh
./publish.sh --test
```

### Manual Publishing

```bash
# Edit version in py_archons/version.py, then:
python -m build
python -m twine upload dist/py_archons-*
```

## Version Management

### Yanking (Deprecating) Versions

```bash
# Yank a version from PyPI (marks as deprecated but keeps available)
python yank_version.py 0.3.0

# Yank from TestPyPI
python yank_version.py 0.3.0 --test
```

### Adding Deprecation Notices

```bash
# Get guidance on adding deprecation notices
python deprecate_version.py 0.3.0 "Security issues"
```

## License

MIT License
selection 1.0.0
API to extract content from HTML & XML documents
Requires Python: >=2.7
Keywords: lxml, dom, html

# Selection Documenation

[![Tests](https://github.com/lorien/selection/actions/workflows/test.yml/badge.svg)](https://github.com/lorien/selection/actions/workflows/test.yml)
[![Code Quality](https://github.com/lorien/selection/actions/workflows/code_quality.yml/badge.svg)](https://github.com/lorien/selection/actions/workflows/code_quality.yml)
[![Typing](https://github.com/lorien/selection/actions/workflows/mypy.yml/badge.svg)](https://github.com/lorien/selection/actions/workflows/mypy.yml)
[![Test coverage](https://coveralls.io/repos/lorien/selection/badge.svg?branch=master)](https://coveralls.io/r/lorien/selection?branch=master)

API to query DOM tree of HTML/XML document.


## Usage Example

```
from selection import XpathSelector
from lxml.html import fromstring

html = '<div><h1>test</h1><ul id="items"><li>1</li><li>2</li></ul></div>'
sel = XpathSelector(fromstring(html))
print(sel.select('//h1')).text()
print(sel.select('//li').text_list()
print(sel.select('//ul').attr('id')
```


## Installation

Run: `pip install -U selection`


## Community

Telegram English chat: [https://t.me/grablab](https://t.me/grablab)

Telegram Russian chat: [https://t.me/grablab\_ru](https://t.me/grablab_ru)
fastapi-oidc-jwks 0.1.1
A FastAPI dependency used to verify a user's OAuth access token with JWKS.
Requires Python: >=3.9

# FastAPI OIDC JWKS

A FastAPI dependency used to verify a user's OAuth access token with JWKS.

## Installation

```bash
pip install fastapi-oidc-jwks
```

## Usage example

```python
from fastapi import FastAPI, APIRouter, Depends
from fastapi_oidc_jwks import AuthDependency

app = FastAPI()

auth = AuthDependency("Your OIDC provider's JWKS URI here")

router = APIRouter(dependencies=[Depends(auth)])

@router.get("/user")
async def handle(user: dict = Depends(auth)):
    return {"user": user}

app.include_router(router)
```
bcn-rainfall-core 1.0.7
Tools to load and manipulate rainfall data from the city of Barcelona, Catalunya.
Requires Python: >=3.12

# bcn-rainfall-core

[![PyPI version](https://badge.fury.io/py/bcn-rainfall-core.svg)](https://badge.fury.io/py/bcn-rainfall-core)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![coverage badge](coverage.svg)](https://github.com/nedbat/coveragepy)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
[![mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)

Tools to load and manipulate rainfall data from the city of Barcelona, Catalunya; it is the core of the Barcelona Rainfall project and is exposed through the Barcelona Rainfall API.

## Requirements

- Python 3.12
- Pip

## Usage

```python
from bcn_rainfall_core import Rainfall
from bcn_rainfall_core.utils import DataSettings

# With configuration file in default path `config.yml`
rainfall = Rainfall.from_config()

# With configuration file in other path
rainfall_with_path = Rainfall.from_config(path="new/path/to/config.yml")

# With your own configuration
rainfall_with_cfg = Rainfall.from_config(
    cfg=DataSettings(file_url="http://...", start_year=1955, rainfall_precision=2)
)

# With your own configuration from local file
rainfall_with_cfg_from_file = Rainfall.from_config(
    cfg=DataSettings(local_file_path="/dir/my_rainfall_data.csv", start_year=1955, rainfall_precision=2),
    from_file=True,
)


# Have fun with class!
from bcn_rainfall_core.utils import TimeMode, Season

rainfall_avg = rainfall.get_rainfall_average(
    TimeMode.SEASONAL,
    begin_year=1975, 
    end_year=1998, 
    season=Season.WINTER
)
print(rainfall_avg)
...
```

## Tests & Coverage

```commandline
uv run coverage run -m pytest
uv run coverage report
```

## Code quality

```commandline
uv tool run mypy --check-untyped-defs .
uv tool run ruff check
uv tool run ruff format
```
a816 1.1.0a2
65c816 patching assembler (Super Famicom)
Requires Python: >=3.10
Keywords: assembly, romhack, super famicom, supernes

# a816
Another 65c816 assembler

## Usage

### Command line
```
$ a816 --help
usage: x816 [-h] [--verbose] [-o OUTPUT_FILE] [-f FORMAT] [-m MAPPING] [--copier-header] [--dump-symbols] [-D KEY=VALUE [KEY=VALUE ...]] input_file

x816 usage

positional arguments:
  input_file            The asm file to assemble.

options:
  -h, --help            show this help message and exit
  --verbose             Displays all log levels.
  -o OUTPUT_FILE, --output OUTPUT_FILE
                        Output file
  -f FORMAT             Output format
  -m MAPPING            Address Mapping
  --copier-header       Adds 0x200 address delta corresponding to copier header in ips writer.
  --dump-symbols        Dumps symbol table
  -D KEY=VALUE [KEY=VALUE ...], --defines KEY=VALUE [KEY=VALUE ...]
                        Defines symbols.
```

or directly from python code:

### From python code

```python
from a816.program import Program

def build_patch(input, output):
    program = Program()
    program.assemble_as_patch(input, output)
    program.resolver.dump_symbol_map()
```

## Supported Syntax

### Memonics

```
adc, and, asl, bcc, bcs, beq, bit, bmi, bne, bpl, bra, brk, brl, bvc, bvs, clc, cld, cli, clv, cmp, cop, cpx, cpy, db, dec, dex, dey, eor, inc, inx, iny, jml, jmp, jsl, jsr, lda, ldx, ldy, lsr, mvn, mvp, nop, ora, pea, pei, per, pha, phb, phd, phk, php, phx, phy, pla, plb, pld, plp, plx, ply, rep, rol, ror, rti, rtl, rts, sbc, sec, sed, sei, sep, sta, stp, stx, sty, stz, tax, tay, tcd, tcs, tdc, trb, tsb, tsc, tsx, txa, txs, txy, tya, tyx, wai, xba, xce
```

## Macros

```ca65
; define a macro
.macro test(var_1, var_2) {
    lda.w var_1 << 16 + var_2
}

; use that macro
test(0x10, 0x10)

; should expand that way
lda.w 0x10 << 16 + 0x10

; code generated
lda.w 0x1010
```


## Code pointer relocation

```ca65
*=0x008000
    jsr.l _intro
```


## Scopes

```ca65
some_address = 0x54
{
    lda.b some_address
    beq no_action
    ; this label is only visible inside this scope
    no_action:
}
```

### Named scopes

```ca65
*=0x009000
named_scope {
   addr = 0x1234
   youhou_text:
   .text 'youhou'
   .db 0
   yaha_text:
   .text 'yaha'
   .db 0
}

*=0x019A52
	load_system_menu_text_pointer(named_scope.youhou_text)

*=0x019A80
	load_system_menu_text_pointer(named_scope.yaha_text)

```
nonsense-cli 1.4.1
A quirky command-line calculator
Requires Python: >=3.9

# Nonsense Calculator

**Nonsense** is a quirky command-line calculator that handles basic arithmetic, parentheses, exponentiation, and supports the `ans` keyword to reuse the last result. It's designed for fun and simplicity, perfect for quick calculations in the terminal.

## Features

- Handles `+`, `-`, `*`, `/`, `%`, `**/^` with correct operator precedence
- Supports floats and multi-digit numbers
- Parentheses supported: e.g., `(2+3)*4`
- Reuse the last answer with `ans`
- Colorful terminal output if `colorama` is installed

## Installation

```bash
pip install nonsense-cli
book-cataloguing 1.0.0
Correctly capitalize and sort the titles and authors of books.
Requires Python: >=3.9

Book Cataloguing
================

Correctly capitalize and sort the titles and authors of books.


Basic Usage
-----------

To capitalize the title of a book:

>>> from book_cataloguing import capitalize_title
>>> capitalize_title("the lord of the rings")
'The Lord of the Rings'
>>> capitalize_title("the hobbit: or, there and back again")
'The Hobbit: Or, There and Back Again'


To capitalize the author of a book:

>>> from book_cataloguing import capitalize_author
>>> capitalize_author("HILDA VAN STOCKUM")
'Hilda van Stockum'
>>> capitalize_author("pope john paul ii")
'Pope John Paul II'


To sort some book titles case-insensitively:

>>> from book_cataloguing import title_sort
>>> titles = [
...     "the restaurant at the end of the universe",
...     "so long, and thanks for all the fish",
...     "Mostly Harmless"
... ]
>>> title_sort(titles)
['Mostly Harmless', 'the restaurant at the end of the universe', 'so long, and thanks for all the fish']
>>> title_sort(titles, reverse=True)
['so long, and thanks for all the fish', 'the restaurant at the end of the universe', 'Mostly Harmless']

Please see the online documentation at http://book-cataloguing.readthedocs.io for complete details on these functions and many others.
modelsmith 0.7.0
Get Pydantic models and Python types as LLM responses from Anthropic, Google Vertex AI, and OpenAI models.
Requires Python: ~=3.10.0
Keywords: anthropic, openai, vertexai, pydantic, models, types, llm

<p align="center">
  <img src="modelsmith.png" style="width: auto; height: auto;"/>
</p>

# Modelsmith
### Modelsmith is a Python library that allows you to get structured responses in the form of Pydantic models and Python types from Anthropic, Google Gemini, and OpenAI models.

Currently it allows you to use the following classes of model:
- __AnthropicModel__ (used with Anthropic's full set of models)
- __OpenAIModel__ (used with OpenAI's full set of models)
- __GeminiModel__ (used with Google's full set of Gemini models)

Modelsmith provides a unified interface over all of these. It has been designed to be extensible and can adapt to other models in the future.

# Notable Features

- __Structured Responses__: Specify both Pydantic models and Python types as the outputs of your LLM responses.
- __Templating__: Use Jinja2 templating in your prompts to allow complex prompt logic.
- __Default and Custom Prompts__: A default prompt template is provided but you can also specify your own.
- __Retry Logic__: Number of retries is user configurable.
- __Validation__: Outputs from the LLM are validated against your requested response model. Errors are fed back to the LLM to try and correct any validation failures.

# Installation

Install Modelsmith using pip or your favourite python package manager.

`pip` example:
```bash
pip install modelsmith
```
# Documentation

For detailed documentation please have a look at [https://christo-olivier.github.io/modelsmith](https://christo-olivier.github.io/modelsmith)

# Get in touch

If you have any questions or suggestions, feel free to open an issue or start a discussion.

# License

This project is licensed under the terms of the MIT License.