semvec/pypi-packages huggingface dataset:
openapiipify 6.0.0
openapi-ipify
License: MIT
Requires Python: >=3.9
Keywords: OpenAPI, OpenAPI-Generator, openapi-ipify

# openapiipify
OpenAPI client for ipify, a simple public IP address API

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 6.0.0
- Package version: 6.0.0
- Generator version: 7.18.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
For more information, please visit [https://github.com/oapicf/openapi-ipify](https://github.com/oapicf/openapi-ipify)

## Requirements.

Python 3.9+

## Installation & Usage
### pip install

If the python package is hosted on a repository, you can install directly using:

```sh
pip install git+https://github.com/oapicf/openapi-ipify.git
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/oapicf/openapi-ipify.git`)

Then import the package:
```python
import openapiipify
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import openapiipify
```

### Tests

Execute `pytest` to run the tests.

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```python

import openapiipify
from openapiipify.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api64.ipify.org
# See configuration.py for a list of all supported configuration parameters.
configuration = openapiipify.Configuration(
    host = "https://api64.ipify.org"
)



# Enter a context with an instance of the API client
with openapiipify.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = openapiipify.DefaultApi(api_client)
    format = 'format_example' # str | Response format (optional)
    param_callback = 'param_callback_example' # str | JSONP callback function name (optional)

    try:
        # Get your public IP address
        api_response = api_instance.get_ip(format=format, param_callback=param_callback)
        print("The response of DefaultApi->get_ip:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling DefaultApi->get_ip: %s\n" % e)

```

## Documentation for API Endpoints

All URIs are relative to *https://api64.ipify.org*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**get_ip**](docs/DefaultApi.md#get_ip) | **GET** / | Get your public IP address


## Documentation For Models

 - [GetIp200Response](docs/GetIp200Response.md)


<a id="documentation-for-authorization"></a>
## Documentation For Authorization

Endpoints do not require authorization.


## Author

blah+oapicf@cliffano.com
cachelocal 0.2.0
Thread-safe in-process cache for Python with eviction policies and TTL
License: MIT
Requires Python: >=3.9
Keywords: cache, lru, fifo, ttl, in-process, eviction

# cachelocal

A thread-safe in-process cache for Python with multiple eviction policies and optional TTL support.

## Features

- Multiple eviciton policies: LRU, FIFO
- Optional per-entry TTL (lazy expiration)
- Thread-safe via a single lock
- O(1) get/set/delete operations
- Optional stats tracking (hits, misses, evictions)

## Installation

```bash
pip install cachelocal
```

## Quickstart

### LRU Cache

```python
from cachelocal import LRUCache

cache = LRUCache(capacity=2)

cache.set("a", 1)
cache.set("b", 2)

cache.get("a")          # -> 1 (refreshes recency)
cache.set("c", 3)       # evicts "b"

cache.get("b")          # -> None
```

### FIFO Cache

```python
from cachelocal import FIFOCache

cache = FIFOCache(capacity=2)

cache.set("a", 1)
cache.set("b", 2)

cache.get("a")          # -> 1 (does NOT refresh position)
cache.set("c", 3)       # evicts "a" (oldest insertion)

cache.get("a")          # -> None
```

## TTL

```python
cache.set("x", 42, ttl_seconds=1.0)
```

Expired entries are removed on access and may also be removed during eviction when capacity is exceeded.

## Stats Tracking

```python
cache = LRUCache(capacity=100, track_stats=True)

cache.set("a", 1)
cache.get("a")  # hit
cache.get("b")  # miss

stats = cache.get_stats()
print(f"Hits: {stats.hits}, Misses: {stats.misses}, Evictions: {stats.evictions}")
```

## Performance

Benchmarks on Apple M-series (100k operations):

### Read-Only Workload

| Implementation      | ops/sec | vs functools |
| ------------------- | ------- | ------------ |
| FIFOCache           | 3.7M    | 35%          |
| LRUCache            | 2.5M    | 24%          |
| functools.lru_cache | 10.6M   | baseline     |

### Mixed Workload (stats disabled)

| Implementation | Writes     | Reads      | Mixed      |
| -------------- | ---------- | ---------- | ---------- |
| FIFOCache      | 3.7M ops/s | 3.7M ops/s | 3.3M ops/s |
| LRUCache       | 2.3M ops/s | 2.7M ops/s | 2.4M ops/s |

**Key takeaways:**

- FIFO is ~48% faster than LRU (no recency updates on access)
- Stats tracking overhead: ~5-10%
- Both implementations handle millions of operations per second

Run benchmarks yourself:

```bash
python benchmarks/benchmark.py
```

## Semantics

### LRU Cache

- Eviction policy: Least Recently Used
- Access behavior: `get()` and `set()` refresh recency
- Best for: General-purpose caching with access-based eviction

### FIFO Cache

- Eviction policy: First In, First Out
- Access behavior: `get()` does NOT refresh position
- Best for: Time-windowed data, session caches

### Both

- TTL: Optional, checked on access (lazy eviction)
- Thread safety: Single lock guards hashmap and linked list
- Missing/expired keys: `get()` returns `None`

## Complexity

- `get()`: O(1)
- `set()`: O(1)
- `delete()`: O(1)

## Development

```bash
pip install -e ".[dev]"
pytest
```

## Roadmap

- Additional eviction policies (LFU, ARC)
- Optional sharding for reduced lock contention
- Async support