Skip to content

Commit

Permalink
fastnode pre-releasw
Browse files Browse the repository at this point in the history
  • Loading branch information
gitworkflows committed Aug 4, 2024
1 parent 8f9e786 commit 51106da
Show file tree
Hide file tree
Showing 27 changed files with 3,650 additions and 101 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# For more details, read the following article on GitHub: https://help.github.com/articles/about-codeowners/.

# These are the default owners for the whole content of this repository. The default owners are automatically added as reviewers when you open a pull request, unless different owners are specified in the file.
* @LukasMasuch @raethlein @JanKalkan
* @khulnasoft-bot @nxpkg @gitworkflows
3,506 changes: 3,506 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<a href="https://github.com/khulnasoft/fastnode/releases">Changelog</a>
</p>

Instantly turn your Python functions into production-ready microservices. Deploy and access your services via HTTP API or interactive UI. Seamlessly export your services into portable, shareable, and executable files or Docker images. Fastnode builds on open standards - OpenAPI, JSON Schema, and Python type hints - and is powered by FastAPI, Streamlit, and Pydantic. It cuts out all the pain for productizing and sharing your Python code - or anything you can wrap into a single Python function.
Instantly turn your Python functions into production-ready microservices. Deploy and access your services via HTTP API or interactive UI. Seamlessly export your services into portable, shareable, and executable files or Docker images. Fastnode builds on open standards - OpenAPI, JSON Schema, and Python type hints - and is powered by ReadyAPI, Streamlit, and Pydantic. It cuts out all the pain for productizing and sharing your Python code - or anything you can wrap into a single Python function.

<sup>Alpha Version: Only suggested for experimental usage.</sup>

Expand All @@ -43,7 +43,7 @@ Instantly turn your Python functions into production-ready microservices. Deploy
## Highlights

- 🪄&nbsp; Turn functions into production-ready services within seconds.
- 🔌&nbsp; Auto-generated HTTP API based on FastAPI.
- 🔌&nbsp; Auto-generated HTTP API based on ReadyAPI.
- 🌅&nbsp; Auto-generated Web UI based on Streamlit.
- 📦&nbsp; Save and share as self-contained executable file or Docker image.
- 🧩&nbsp; Reuse pre-defined components & combine with existing Fastnodes.
Expand Down Expand Up @@ -335,7 +335,7 @@ Visit http://localhost:8051 in your browser to access the UI of the demo. Use `l

## Support & Feedback

This project is maintained by [Benjamin Räthlein](https://twitter.com/raethlein), [Lukas Masuch](https://twitter.com/LukasMasuch), and [Jan Kalkan](https://www.linkedin.com/in/jan-kalkan-b5390284/). Please understand that we won't be able to provide individual support via email. We also believe that help is much more valuable if it's shared publicly so that more people can benefit from it.
This project is maintained by [Benjamin Räthlein](https://twitter.com/nxpkg), [Lukas Masuch](https://twitter.com/khulnasoft-bot), and [Jan Kalkan](https://www.linkedin.com/in/jan-kalkan-b5390284/). Please understand that we won't be able to provide individual support via email. We also believe that help is much more valuable if it's shared publicly so that more people can benefit from it.

| Type | Channel |
| ------------------------ | ------------------------------------------------------ |
Expand Down Expand Up @@ -365,7 +365,7 @@ With Fastnode, you can instantly launch a local HTTP (REST) API server for any [
fastnode launch-api my_fastnode:hello_world
```

This will launch a [FastAPI](https://fastapi.tiangolo.com/) server based on the [OpenAPI standard](https://swagger.io/specification) and with an automatic interactive documentation.
This will launch a [ReadyAPI](https://readyapi.tiangolo.com/) server based on the [OpenAPI standard](https://swagger.io/specification) and with an automatic interactive documentation.

<img style="width: 100%" src="https://raw.githubusercontent.com/khulnasoft/fastnode/main/docs/images/fastnode-hello-world-api.png"/>

Expand Down
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def main(args: dict) -> None:
if args.get(build_utils.FLAG_MAKE):
# Install pipenv dev requirements
build_python.install_build_env(exit_on_error=True)
# Create API documentation via lazydocs
# Create API documentation via docsai
build_python.generate_api_docs(
github_url=GITHUB_URL, main_package=MAIN_PACKAGE, exit_on_error=True
)
Expand Down
14 changes: 7 additions & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
## Modules

- [`fastnode.api`](./fastnode.api.md#module-fastnodeapi)
- [`fastnode.api.fastapi_app`](./fastnode.api.fastapi_app.md#module-fastnodeapifastapi_app)
- [`fastnode.api.fastapi_utils`](./fastnode.api.fastapi_utils.md#module-fastnodeapifastapi_utils): Collection of utilities for FastAPI apps.
- [`fastnode.api.readyapi_app`](./fastnode.api.readyapi_app.md#module-fastnodeapireadyapi_app)
- [`fastnode.api.readyapi_utils`](./fastnode.api.readyapi_utils.md#module-fastnodeapireadyapi_utils): Collection of utilities for ReadyAPI apps.
- [`fastnode.components`](./fastnode.components.md#module-fastnodecomponents)
- [`fastnode.components.outputs`](./fastnode.components.outputs.md#module-fastnodecomponentsoutputs)
- [`fastnode.components.types`](./fastnode.components.types.md#module-fastnodecomponentstypes)
Expand All @@ -32,10 +32,10 @@

## Functions

- [`fastapi_app.create_api`](./fastnode.api.fastapi_app.md#function-create_api)
- [`fastapi_app.launch_api`](./fastnode.api.fastapi_app.md#function-launch_api)
- [`fastapi_utils.as_form`](./fastnode.api.fastapi_utils.md#function-as_form): Adds an as_form class method to decorated models.
- [`fastapi_utils.patch_fastapi`](./fastnode.api.fastapi_utils.md#function-patch_fastapi): Patch function to allow relative url resolution.
- [`readyapi_app.create_api`](./fastnode.api.readyapi_app.md#function-create_api)
- [`readyapi_app.launch_api`](./fastnode.api.readyapi_app.md#function-launch_api)
- [`readyapi_utils.as_form`](./fastnode.api.readyapi_utils.md#function-as_form): Adds an as_form class method to decorated models.
- [`readyapi_utils.patch_readyapi`](./fastnode.api.readyapi_utils.md#function-patch_readyapi): Patch function to allow relative url resolution.
- [`core.get_callable`](./fastnode.core.md#function-get_callable): Import a callable from an string.
- [`core.get_input_type`](./fastnode.core.md#function-get_input_type): Returns the input type of a given function (callable).
- [`core.get_output_type`](./fastnode.core.md#function-get_output_type): Returns the output type of a given function (callable).
Expand Down Expand Up @@ -70,4 +70,4 @@

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
45 changes: 0 additions & 45 deletions docs/fastnode.api.fastapi_app.md

This file was deleted.

20 changes: 10 additions & 10 deletions docs/fastnode.api.fastapi_utils.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!-- markdownlint-disable -->

<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/fastapi_utils.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/readyapi_utils.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

# <kbd>module</kbd> `fastnode.api.fastapi_utils`
Collection of utilities for FastAPI apps.
# <kbd>module</kbd> `fastnode.api.readyapi_utils`
Collection of utilities for ReadyAPI apps.


---

<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/fastapi_utils.py#L10"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/readyapi_utils.py#L10"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `as_form`

Expand All @@ -18,26 +18,26 @@ as_form(cls: Type[BaseModel]) → Any

Adds an as_form class method to decorated models.

The as_form class method can be used with FastAPI endpoints
The as_form class method can be used with ReadyAPI endpoints


---

<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/fastapi_utils.py#L34"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/readyapi_utils.py#L34"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `patch_fastapi`
## <kbd>function</kbd> `patch_readyapi`

```python
patch_fastapi(app: FastAPI) → None
patch_readyapi(app: ReadyAPI) → None
```

Patch function to allow relative url resolution.

This patch is required to make fastapi fully functional with a relative url path. This code snippet can be copy-pasted to any Fastapi application.
This patch is required to make readyapi fully functional with a relative url path. This code snippet can be copy-pasted to any Readyapi application.




---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
6 changes: 3 additions & 3 deletions docs/fastnode.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

**Global Variables**
---------------
- **fastapi_utils**
- **fastapi_app**
- **readyapi_utils**
- **readyapi_app**




---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
45 changes: 45 additions & 0 deletions docs/fastnode.api.readyapi_app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!-- markdownlint-disable -->

<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/readyapi_app.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

# <kbd>module</kbd> `fastnode.api.readyapi_app`





---

<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/readyapi_app.py#L11"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `launch_api`

```python
launch_api(fastnode_path: str, port: int = 8501, host: str = '0') → None
```






---

<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/readyapi_app.py#L21"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `create_api`

```python
create_api(fastnode: Fastnode) → ReadyAPI
```








---

_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
43 changes: 43 additions & 0 deletions docs/fastnode.api.readyapi_utils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!-- markdownlint-disable -->

<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/readyapi_utils.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

# <kbd>module</kbd> `fastnode.api.readyapi_utils`
Collection of utilities for ReadyAPI apps.


---

<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/readyapi_utils.py#L10"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `as_form`

```python
as_form(cls: Type[BaseModel]) → Any
```

Adds an as_form class method to decorated models.

The as_form class method can be used with ReadyAPI endpoints


---

<a href="https://github.com/khulnasoft/fastnode/blob/main/src/fastnode/api/readyapi_utils.py#L34"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `patch_readyapi`

```python
patch_readyapi(app: ReadyAPI) → None
```

Patch function to allow relative url resolution.

This patch is required to make readyapi fully functional with a relative url path. This code snippet can be copy-pasted to any Readyapi application.




---

_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
2 changes: 1 addition & 1 deletion docs/fastnode.components.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
2 changes: 1 addition & 1 deletion docs/fastnode.components.outputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ render_output_ui(streamlit) → None

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
2 changes: 1 addition & 1 deletion docs/fastnode.components.types.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ validate(value: Any) → FileContent

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
2 changes: 1 addition & 1 deletion docs/fastnode.core.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ __init__(func: Union[Callable, str]) → None

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
2 changes: 1 addition & 1 deletion docs/fastnode.export.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ An enumeration.

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
2 changes: 1 addition & 1 deletion docs/fastnode.tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
2 changes: 1 addition & 1 deletion docs/fastnode.ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
2 changes: 1 addition & 1 deletion docs/fastnode.ui.schema_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,4 @@ is_object_list_property(property: Dict, references: Dict) → bool

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
2 changes: 1 addition & 1 deletion docs/fastnode.ui.streamlit_ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,4 @@ render_ui() → None

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
2 changes: 1 addition & 1 deletion docs/fastnode.ui.streamlit_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ clear() → None

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
2 changes: 1 addition & 1 deletion docs/fastnode.utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@

---

_This file was automatically generated via [lazydocs](https://github.com/khulnasoft/lazydocs)._
_This file was automatically generated via [docsai](https://github.com/khulnasoft/docsai)._
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
zip_safe=False,
install_requires=[
"typer",
"fastapi",
"readyapi",
"uvicorn",
"streamlit>=0.72",
"plotly",
Expand All @@ -73,7 +73,7 @@
"black",
"pydocstyle",
"isort",
"lazydocs",
"docsai",
],
},
include_package_data=True,
Expand Down
4 changes: 2 additions & 2 deletions src/fastnode/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def launch_api(
) -> None:
"""Start a HTTP API server for the fastnode.
This will launch a FastAPI server based on the OpenAPI standard and with an automatic interactive documentation.
This will launch a ReadyAPI server based on the OpenAPI standard and with an automatic interactive documentation.
"""
# Add the current working directory to the sys path
# This is required to resolve the fastnode path
sys.path.append(os.getcwd())

from fastnode.api.fastapi_app import launch_api # type: ignore
from fastnode.api.readyapi_app import launch_api # type: ignore

launch_api(fastnode, port, host)

Expand Down
2 changes: 1 addition & 1 deletion src/fastnode/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .fastapi_app import create_api
from .readyapi_app import create_api
Loading

0 comments on commit 51106da

Please sign in to comment.