semvec/pypi-packages huggingface dataset:
tileget 1.0.1
Tile download utility - easily download xyz-tile data
Requires Python: >=3.14

# tileget

![GitHub Release](https://img.shields.io/github/v/release/Kanahiro/tileget)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/Kanahiro/tileget/lint.yml?label=lint)

Tile download utility - easily download xyz-tile data.

## Requirements

- Python >= 3.14

## Installation

```sh
pip install tileget
```

## Usage

```plaintext
usage: tileget [-h] [-e OUTPUT_DIR] [-o OUTPUT_FILE] [--extent EXTENT EXTENT EXTENT EXTENT]
               [--geojson GEOJSON] [--minzoom MINZOOM] [--maxzoom MAXZOOM] [--rps RPS] [--overwrite]
               [--timeout TIMEOUT] [--tms] [--retries RETRIES] [--retry-delay RETRY_DELAY]
               tileurl

xyz-tile download tool

positional arguments:
  tileurl               xyz-tile url in {z}/{x}/{y} template

options:
  -h, --help            show this help message and exit
  -e, --output_dir OUTPUT_DIR
                        output dir
  -o, --output_file OUTPUT_FILE
                        output mbtiles file
  --extent EXTENT EXTENT EXTENT EXTENT
                        min_lon min_lat max_lon max_lat, whitespace delimited
  --geojson GEOJSON     path to geojson file of Feature or FeatureCollection
  --minzoom MINZOOM     default to 0
  --maxzoom MAXZOOM     default to 16
  --rps RPS             requests per second, must be positive, default to 1
  --overwrite           overwrite existing files
  --timeout TIMEOUT     wait response until this value in seconds, default to 5.0
  --tms                 if set, parse z/x/y as TMS
  --retries RETRIES     max retry count on error, default to 3
  --retry-delay RETRY_DELAY
                        base delay in seconds for exponential backoff, default to 1.0
```

### Examples

```sh
# basic usage
tileget http://path/to/tile/{z}/{x}/{y}.jpg -e output_dir --extent 141.23 40.56 142.45 43.78
tileget http://path/to/tile/{z}/{x}/{y}.jpg -o output.mbtiles --geojson input.geojson

# with rate limiting and retry options
tileget http://path/to/tile/{z}/{x}/{y}.jpg -e output_dir --extent 141.23 40.56 142.45 43.78 --minzoom 0 --maxzoom 16 --rps 5 --retries 5 --retry-delay 2.0 --timeout 10 --overwrite
```
vextra-utils 1.0.1
A collection of Python utilities for timing, concurrency control, thread safety, and design patterns.
Requires Python: >=3.13

# Vextra Utils

I built this because I use the following decorators or singletons in almost all of my code.

## Installation

```bash
uv add vextra_utils
```

## Decorators

### `with_timer`

Measures and logs execution time of sync or async functions.

```python
from vextra_utils import with_timer

@with_timer
def foo():
    return bar # logs: "foo took 1.2345s"

@with_timer
async def foo():
    return bar # logs: "foo took 0.5678s"
```

### `with_semaphore`

Limits concurrent execution of async functions using a semaphore.

```python
import asyncio
from vextra_utils import with_semaphore

semaphore = asyncio.Semaphore(3)  # max 3 concurrent

@with_semaphore(semaphore)
async def fetch_url(url: str) -> str:
    async with aiohttp.ClientSession() as session:
        async with session.get(url) as resp:
            return await resp.text()

# Only 3 requests run concurrently
await asyncio.gather(*[fetch_url(url) for url in urls])
```

### `synchronized`

Makes function execution thread-safe.

```python
from threading import Lock
from vextra_utils import synchronized

# With shared lock
shared_lock = Lock()

@synchronized(shared_lock)
def update_counter():
    # thread-safe critical section
    pass

# Without lock (creates RLock automatically)
@synchronized()
def another_safe_function():
    pass
```

## Metaclasses

### `SingletonMeta`

Thread-safe singleton pattern implementation.

```python
from vextra_utils import SingletonMeta

class Database(metaclass=SingletonMeta):
    def __init__(self, connection_string: str):
        self.connection = connect(connection_string)

db1 = Database("postgres://...")
db2 = Database("different://...")  # ignored, returns same instance

assert db1 is db2  # True
```

Clear instances for testing:

```python
SingletonMeta.clear_instances()
```

## API Reference

| Utility               | Type      | Description                                  |
| --------------------- | --------- | -------------------------------------------- |
| `with_timer`          | Decorator | Logs execution time for sync/async functions |
| `with_semaphore(sem)` | Decorator | Limits async concurrency with semaphore      |
| `synchronized(lock?)` | Decorator | Thread-safe execution with optional lock     |
| `SingletonMeta`       | Metaclass | Thread-safe singleton pattern                |

## Requirements

- Python 3.13+
- No runtime dependencies
- Optional: [loguru](https://github.com/Delgan/loguru) for enhanced logging (falls back to stdlib logging)

## License

[MIT](LICENSE)

---

_Tests generated by Claude xD_