Skip to main content

geniface

geniface turns plain Python functions into small, portable interfaces:

  • a command-line runner
  • a built-in HTTP server with a browser UI
  • generated adapter code such as FastAPI

It stays close to the function signature and uses standard library tooling where possible.

Installation

geniface is intended to be installed from PyPI:

pip install geniface

Requirements:

  • Python 3.10+

Optional packages:

  • For development and tests:
pip install "geniface[dev]"
  • For generated FastAPI adapters, install FastAPI and a server:
pip install fastapi python-multipart uvicorn

Quick Example

Create a module with a function:

# demo.py
from pathlib import Path


def greet(name: str, excited: bool = False) -> str:
    return f"hello {name}!" if excited else f"hello {name}"


def read_file(path: Path) -> str:
    return path.read_text(encoding="utf-8")

Run

Run a function directly from the command line:

python -m geniface.run demo:greet Ada --excited true

Output:

hello Ada!

Rules:

  • required parameters are positional
  • parameters with defaults are passed as flags
  • supported primitive CLI types are str, int, float, bool, and pathlib.Path

Examples:

python -m geniface.run demo:greet Ada
python -m geniface.run demo:read_file ./notes.txt

Serve

Start the built-in HTTP server:

python -m geniface.serve --host 127.0.0.1 --port 8000 demo:greet

When the server is ready it prints the bound address:

Serving on http://127.0.0.1:8000

Available endpoints:

  • POST /<function_name> executes the function
  • GET /ui serves a browser form generated from the function signature

For the greet example, send JSON to:

curl -X POST http://127.0.0.1:8000/greet \
  -H "Content-Type: application/json" \
  -d '{"name":"Ada","excited":true}'

The response shape is always:

{"result": "hello Ada!"}

Browser UI

Open:

http://127.0.0.1:8000/ui

The UI:

  • builds a form from the function signature
  • supports str, int, float, bool, and pathlib.Path
  • uses file inputs for Path parameters
  • submits multipart/form-data automatically when file inputs are present

Generate

Generate adapter code from a function:

python -m geniface.generate demo:greet --target fastapi --output generated_api.py

Currently supported targets:

  • fastapi

This writes a Python file that imports the target function and exposes a FastAPI app with a single POST endpoint at /<function_name>.

For functions without file inputs, the generated adapter accepts JSON.

For functions with pathlib.Path parameters, the generated adapter:

  • exposes file uploads with UploadFile = File(...)
  • uses Form(...) for non-file parameters
  • writes uploaded files to temporary files
  • passes Path objects into the target function

Run the generated FastAPI app with:

uvicorn generated_api:app --reload

Notes

  • geniface does not validate beyond the underlying Python call and parser behavior.
  • Uploaded files are written to temporary files and are not deleted automatically.
  • The package is licensed under the MIT License. See LICENSE.

Metadata

Release files for geniface 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geniface 0.1.0
File Size Uploaded Provenance
geniface-0.1.0.tar.gz 16.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for geniface 0.1.0
File Interpreter ABI Platform
geniface-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.7 kB

Release files / geniface-0.1.0.tar.gz

Download URL geniface-0.1.0.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2daaa77daebc25982bd55fd69fc33e5d160a0c51455ef744e0b432cbe17341c8
BLAKE2b-256 checksum
How to use checksums
b567f699387ce3b8c97aed6b20cc654b6e3f9004b5c160522161e11594b650fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / geniface-0.1.0-py3-none-any.whl

Download URL geniface-0.1.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0171653e54a97b9604d07e816fc47119c59f96a8629381befdd7bc0343e22b90
BLAKE2b-256 checksum
How to use checksums
07cdf13d36b00537200361c5c35dee79df53465907182792749653437098da88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for geniface 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page