# Forge Python SDK
[![PyPi version](https://img.shields.io/pypi/v/forgeapp-sdk?style=flat)](https://pypi.org/project/forgeapp-sdk) [![Documentation](https://img.shields.io/badge/documentation-informational)](https://docs.forgeapp.io/) [![Discord](https://img.shields.io/badge/discord-join-blueviolet)](https://forgeapp.io/discord)
[Forge](https://forgeapp.io) is a low code internal tooling platform built on top of [Forge](https://interval.com) that allows developer to build internal tools that integrate directly with their APIs. Forge provides a JavaScript SDK to allow developers to quickly develop Forge apps.
## Why choose Forge?
With Forge, **all of the code for generating your web UIs lives within your app's codebase.** Forge apps are just asynchronous functions that run in your service. Because these are just functions, you can access the complete power of your existing services. When you need to request input or display output, `await` any of our I/O methods to present a form to the user and your script will pause execution until input is received.
## Getting started
To get started with building your first Forge app, all you have to do is define an action. An Action represents a Forge app, which users can define inline or imported. Forge apps can run as a separate background process within your service or as a standalone service. You can get started and create a Forge app in just a few lines of code.
```python
from forgeapp_sdk import Forge, IO
# Initialize Forge
forge = Forge(api_key="<YOUR API KEY>", endpoint: 'wss://<YOUR FORGE SERVER WEBSOCKET URL>/websocket')
@forge.action
async def refund_customer_order(io: IO):
name = await io.input.text("Order ID")
return f"Successfully refunded order ID: {orderID}"
# Synchronously listen, blocking forever
forge.listen()
```
To not block, forge can also be run asynchronously using
`forge.listen_async()`. You must provide your own event loop.
The task will complete as soon as connection to Forge completes, so you
likely want to run forever or run alongside another permanent task.
```python
import asyncio, signal
loop = asyncio.get_event_loop()
task = loop.create_task(forge.listen_async())
def handle_done(task: asyncio.Task[None]):
try:
task.result()
except:
loop.stop()
task.add_done_callback(handle_done)
for sig in {signal.SIGINT, signal.SIGTERM}:
loop.add_signal_handler(sig, loop.stop)
loop.run_forever()
```
Forge:
- Allows you create forge apps as code which integrates directly with your existing functions.
- Makes creating full-stack apps as easy as writing CLI scripts.
- Can scale from a handful of scripts to robust multi-user dashboards.
With Forge, you do not need to:
- Deploy and maintain additional endpoint and/or services to support your forge apps.
- Give Forge write access to your database or secrets (or give us _any_ of your credentials, for that matter).
- Work in an external IDE. Integrate directly with your developer environment.
## More about Forge
- 📖 [Documentation](https://docs.forgeapp.io/)
- 🌐 [Forge website](https://forgeapp.io)
- 💬 [Discord community](https://forgeapp.io/discord)
## Local Development
This project uses [Poetry](https://python-poetry.org/) for dependency
management
1. `poetry install` to install dependencies
2. `poetry shell` to activate the virtual environment
Tasks are configured using [poethepoet](https://github.com/nat-n/poethepoet)
(installed as a dev dependency).
- `poe demo [demo_name]` to run a demo (`basic` by default if `demo_name` omitted)
- `poe test` to run `pytest` (can also run `pytest` directly in virtual env)
Code is formatted using [Black](https://github.com/psf/black). Please configure
your editor to format on save using Black, or run `poe format` to format the
code before committing changes.
## Tests
_Note:_ Tests currently require a local instance of the Forge backend.
Tests use [pytest](https://docs.pytest.org/en/7.1.x/) and
[playwright](https://playwright.dev/python/).
Currently assumes the `test-runner@forgeapp.io` user exists already.
Run `yarn test` in the `web` directory at least once to create it before
running these.
Raw data
{
"_id": null,
"home_page": "https://forgeapp.io",
"name": "forgeapp-sdk",
"maintainer": "Rambo",
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": "rambo@forgeapp.io",
"keywords": "internal tool, app, ui, ui builder",
"author": "Rambo",
"author_email": "rambo@forgeapp.io",
"download_url": "https://files.pythonhosted.org/packages/51/8b/0a373a0e2dd6d3bb9724b1d913b2cf73cacf7018722e6dd3d32b97cc7661/forgeapp_sdk-0.1.3.tar.gz",
"platform": null,
"description": "# Forge Python SDK\n\n[![PyPi version](https://img.shields.io/pypi/v/forgeapp-sdk?style=flat)](https://pypi.org/project/forgeapp-sdk) [![Documentation](https://img.shields.io/badge/documentation-informational)](https://docs.forgeapp.io/) [![Discord](https://img.shields.io/badge/discord-join-blueviolet)](https://forgeapp.io/discord)\n\n[Forge](https://forgeapp.io) is a low code internal tooling platform built on top of [Forge](https://interval.com) that allows developer to build internal tools that integrate directly with their APIs. Forge provides a JavaScript SDK to allow developers to quickly develop Forge apps.\n\n## Why choose Forge?\n\nWith Forge, **all of the code for generating your web UIs lives within your app's codebase.** Forge apps are just asynchronous functions that run in your service. Because these are just functions, you can access the complete power of your existing services. When you need to request input or display output, `await` any of our I/O methods to present a form to the user and your script will pause execution until input is received.\n\n## Getting started\n\nTo get started with building your first Forge app, all you have to do is define an action. An Action represents a Forge app, which users can define inline or imported. Forge apps can run as a separate background process within your service or as a standalone service. You can get started and create a Forge app in just a few lines of code.\n\n```python\nfrom forgeapp_sdk import Forge, IO\n\n# Initialize Forge\nforge = Forge(api_key=\"<YOUR API KEY>\", endpoint: 'wss://<YOUR FORGE SERVER WEBSOCKET URL>/websocket')\n\n@forge.action\nasync def refund_customer_order(io: IO):\n name = await io.input.text(\"Order ID\")\n return f\"Successfully refunded order ID: {orderID}\"\n\n\n# Synchronously listen, blocking forever\nforge.listen()\n```\n\nTo not block, forge can also be run asynchronously using\n`forge.listen_async()`. You must provide your own event loop.\n\nThe task will complete as soon as connection to Forge completes, so you\nlikely want to run forever or run alongside another permanent task.\n\n```python\nimport asyncio, signal\n\nloop = asyncio.get_event_loop()\ntask = loop.create_task(forge.listen_async())\ndef handle_done(task: asyncio.Task[None]):\n try:\n task.result()\n except:\n loop.stop()\n\ntask.add_done_callback(handle_done)\nfor sig in {signal.SIGINT, signal.SIGTERM}:\n loop.add_signal_handler(sig, loop.stop)\nloop.run_forever()\n```\n\nForge:\n\n- Allows you create forge apps as code which integrates directly with your existing functions.\n- Makes creating full-stack apps as easy as writing CLI scripts.\n- Can scale from a handful of scripts to robust multi-user dashboards.\n\nWith Forge, you do not need to:\n\n- Deploy and maintain additional endpoint and/or services to support your forge apps.\n- Give Forge write access to your database or secrets (or give us _any_ of your credentials, for that matter).\n- Work in an external IDE. Integrate directly with your developer environment.\n\n## More about Forge\n\n- \ud83d\udcd6 [Documentation](https://docs.forgeapp.io/)\n- \ud83c\udf10 [Forge website](https://forgeapp.io)\n- \ud83d\udcac [Discord community](https://forgeapp.io/discord)\n\n## Local Development\n\nThis project uses [Poetry](https://python-poetry.org/) for dependency\nmanagement\n\n1. `poetry install` to install dependencies\n2. `poetry shell` to activate the virtual environment\n\nTasks are configured using [poethepoet](https://github.com/nat-n/poethepoet)\n(installed as a dev dependency).\n\n- `poe demo [demo_name]` to run a demo (`basic` by default if `demo_name` omitted)\n- `poe test` to run `pytest` (can also run `pytest` directly in virtual env)\n\nCode is formatted using [Black](https://github.com/psf/black). Please configure\nyour editor to format on save using Black, or run `poe format` to format the\ncode before committing changes.\n\n## Tests\n\n_Note:_ Tests currently require a local instance of the Forge backend.\n\nTests use [pytest](https://docs.pytest.org/en/7.1.x/) and\n[playwright](https://playwright.dev/python/).\n\nCurrently assumes the `test-runner@forgeapp.io` user exists already.\nRun `yarn test` in the `web` directory at least once to create it before\nrunning these.\n",
"bugtrack_url": null,
"license": null,
"summary": "Forge python SDK",
"version": "0.1.3",
"project_urls": {
"Documentation": "https://docs.forgeapp.io/",
"Homepage": "https://forgeapp.io"
},
"split_keywords": [
"internal tool",
" app",
" ui",
" ui builder"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a46daa4c6fb28070be41d35b53bacdbc72066e4cf370ff4c3ccd156221e5c8af",
"md5": "395842133f3fe124ed26621250e0510c",
"sha256": "670c0382a88b433b2be6f0c5a4a54e85f29edbf2fc3818dfd074495541d761f5"
},
"downloads": -1,
"filename": "forgeapp_sdk-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "395842133f3fe124ed26621250e0510c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 61640,
"upload_time": "2024-10-29T21:59:58",
"upload_time_iso_8601": "2024-10-29T21:59:58.604745Z",
"url": "https://files.pythonhosted.org/packages/a4/6d/aa4c6fb28070be41d35b53bacdbc72066e4cf370ff4c3ccd156221e5c8af/forgeapp_sdk-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "518b0a373a0e2dd6d3bb9724b1d913b2cf73cacf7018722e6dd3d32b97cc7661",
"md5": "1e2f829a5fe0fa4f6752a8ee30e2ceb1",
"sha256": "5d012d61ec0d8b2a02a5b97b2c7ba16dac7888d1e42148f182ae373f15601e9d"
},
"downloads": -1,
"filename": "forgeapp_sdk-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "1e2f829a5fe0fa4f6752a8ee30e2ceb1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 53881,
"upload_time": "2024-10-29T21:59:59",
"upload_time_iso_8601": "2024-10-29T21:59:59.738326Z",
"url": "https://files.pythonhosted.org/packages/51/8b/0a373a0e2dd6d3bb9724b1d913b2cf73cacf7018722e6dd3d32b97cc7661/forgeapp_sdk-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-29 21:59:59",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "forgeapp-sdk"
}