Metadata-Version: 2.4
Name: capture-pkg
Version: 0.2.1
Summary: A modular capture package for integration with x-ray application and PyPI distribution.
Author-email: wisnubaldas <wisnubaldas@gmail.com>
License-Expression: MIT
Keywords: capture,x-ray,hyfetch,imaging
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: license.json
Requires-Dist: hyfetch>=1.4.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# capture-pkg

[![PyPI Version](https://img.shields.io/pypi/v/capture-pkg.svg)](https://pypi.org/project/capture-pkg/)
[![Python Version](https://img.shields.io/pypi/pyversions/capture-pkg.svg)](https://pypi.org/project/capture-pkg/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A modular Python package providing capture capabilities and HyFetch console branding for the **x-ray** application and standalone Python services.

---

## ✨ Features

- **HyFetch Console Branding**: Automatic system fetch console banner with custom `xenogender` preset and `fastfetch` / `neofetch` backend.
- **Non-Blocking Auto Configuration**: Auto-generates `hyfetch.json` when missing to ensure non-interactive servers (FastAPI/Uvicorn) never hang on setup wizards.
- **FastAPI / Server Ready**: Provides helper functions (`print_banner()`, `get_info()`, `process_capture()`) ready for API consumption.
- **CLI Executable**: Pre-configured terminal command `capture-pkg`.

---

## 🚀 Quick Start

### 1. Installation from PyPI

```bash
pip install capture-pkg
```

### 2. Run CLI Command

Execute directly in your terminal to see the HyFetch banner and package status:

```bash
capture-pkg
```

---

## 💻 Usage in Python & FastAPI (`x-ray`)

### Import in FastAPI App / Routes

```python
from fastapi import APIRouter
import capture_pkg

router = APIRouter()

# Display HyFetch banner at server startup (Non-blocking)
capture_pkg.print_banner()

@router.get("/api/v1/capture/info")
def get_capture_info():
    return capture_pkg.get_info()

@router.post("/api/v1/capture/process")
def trigger_capture(bl_number: str, camera_id: int = 1):
    return capture_pkg.process_capture(source_id=bl_number, camera_id=camera_id)
```

---

## 🛠️ Local Development (Editable Mode)

When developing or modifying `capture-pkg` locally, install in **editable mode**:

```bash
cd capture_pkg
pip install -e .[dev]
```

> **Note**: In editable mode (`pip install -e .`), any code changes made in `capture_pkg/` take effect **immediately** without needing to reinstall!

---

## 📦 Package Publishing & Update Workflow

PyPI package releases are immutable. Whenever you update code and want to publish a new release:

### 1. Configure PyPI Token Credentials
Create a `.env` file in the project root:

```env
TWINE_USERNAME=__token__
TWINE_PASSWORD=pypi-AgEIcHlwaS5vcmcC...
```

### 2. Bump Version Number
Update the version in both `pyproject.toml` and `capture_pkg/__init__.py`:

```toml
# pyproject.toml
version = "0.1.1"
```

### 3. Build Distribution Packages
Clean previous artifacts and build new `.whl` and `.tar.gz` archives:

```bash
python -m build
```

### 4. Upload to PyPI
Publish the new version using Twine:

```bash
python -m twine upload dist/*
```

### 5. Upgrade Client Installation
On client servers or inside your `x-ray` virtual environment, update to the latest release:

```bash
pip install --upgrade capture-pkg
```

---

## 📄 License

Distributed under the [MIT License](LICENSE).
