Metadata-Version: 2.1
Name: orchestrator-core
Version: 0.3.8rc1
Summary: This is the orchestrator workflow engine.
Home-page: https://github.com/workfloworchestrator/orchestrator-core
Author: SURF
Author-email: automation-beheer@surf.nl
Requires-Python: >=3.7,<3.11
Description-Content-Type: text/markdown
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development
Classifier: Typing :: Typed
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Telecommunications Industry
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Dist: aiocache==0.11.1
Requires-Dist: aioredlock==0.7.2
Requires-Dist: aioredis==1.3.1
Requires-Dist: alembic==1.5.4
Requires-Dist: broadcaster[redis]==0.2.0
Requires-Dist: click==8.0.3
Requires-Dist: deepmerge==0.1.0
Requires-Dist: deprecated==1.2.12
Requires-Dist: fastapi~=0.72.0
Requires-Dist: fastapi-etag==0.2.2
Requires-Dist: more-itertools~=8.7.0
Requires-Dist: itsdangerous==1.1.0
Requires-Dist: Jinja2==2.11.3
Requires-Dist: opentelemetry-api==1.9.1
Requires-Dist: opentelemetry-exporter-jaeger==1.9.1
Requires-Dist: opentelemetry-instrumentation-httpx==0.28b1
Requires-Dist: opentelemetry-instrumentation-fastapi==0.28b1
Requires-Dist: opentelemetry-instrumentation-psycopg2==0.28b1
Requires-Dist: opentelemetry-instrumentation-redis==0.28b1
Requires-Dist: opentelemetry-instrumentation-requests==0.28b1
Requires-Dist: opentelemetry-instrumentation-sqlalchemy==0.28b1
Requires-Dist: opentelemetry-instrumentation-wsgi==0.28b1
Requires-Dist: opentelemetry-sdk==1.9.1
Requires-Dist: psycopg2-binary==2.9.1
Requires-Dist: pydantic[email]==1.9.0
Requires-Dist: python-dateutil==2.8.2
Requires-Dist: python-rapidjson==1.0
Requires-Dist: pytz==2020.5
Requires-Dist: redis
Requires-Dist: schedule==1.0.0
Requires-Dist: sentry-sdk==1.3.0
Requires-Dist: SQLAlchemy==1.4.28
Requires-Dist: SQLAlchemy-Searchable==1.4.1
Requires-Dist: typer==0.4.0
Requires-Dist: uvicorn[standard]~=0.14.0
Requires-Dist: nwa-stdlib==1.3.0
Requires-Dist: oauth2-lib==1.0.12
Requires-Dist: markupsafe==2.0.1
Requires-Dist: bandit==1.7.2
Requires-Dist: toml ; extra == "dev"
Requires-Dist: bumpversion ; extra == "dev"
Requires-Dist: mypy_extensions ; extra == "dev"
Requires-Dist: pre-commit ; extra == "dev"
Requires-Dist: pydocstyle ; extra == "dev"
Requires-Dist: python-dotenv ; extra == "dev"
Requires-Dist: watchdog ; extra == "dev"
Requires-Dist: mkdocs ; extra == "doc"
Requires-Dist: mkdocs-material ; extra == "doc"
Requires-Dist: mkdocs-render-swagger-plugin ; extra == "doc"
Requires-Dist: mkdocs-include-markdown-plugin ; extra == "doc"
Requires-Dist: apache-license-check ; extra == "test"
Requires-Dist: black ; extra == "test"
Requires-Dist: blinker ; extra == "test"
Requires-Dist: deepdiff ; extra == "test"
Requires-Dist: flake8 ; extra == "test"
Requires-Dist: flake8-bandit ; extra == "test"
Requires-Dist: flake8-bugbear ; extra == "test"
Requires-Dist: flake8-comprehensions ; extra == "test"
Requires-Dist: flake8-docstrings ; extra == "test"
Requires-Dist: flake8-junit-report ; extra == "test"
Requires-Dist: flake8-logging-format ; extra == "test"
Requires-Dist: flake8-pep3101 ; extra == "test"
Requires-Dist: flake8-print ; extra == "test"
Requires-Dist: flake8-rst ; extra == "test"
Requires-Dist: flake8-rst-docstrings ; extra == "test"
Requires-Dist: flake8-tidy-imports ; extra == "test"
Requires-Dist: isort ; extra == "test"
Requires-Dist: structlog~=20.2.0 ; extra == "test"
Requires-Dist: jsonref ; extra == "test"
Requires-Dist: mypy==0.910 ; extra == "test"
Requires-Dist: pytest ; extra == "test"
Requires-Dist: pytest-cov ; extra == "test"
Requires-Dist: pytest-httpx ; extra == "test"
Requires-Dist: pytest-xdist ; extra == "test"
Requires-Dist: requests-mock ; extra == "test"
Requires-Dist: urllib3_mock ; extra == "test"
Requires-Dist: types-Deprecated ; extra == "test"
Requires-Dist: types-Jinja2 ; extra == "test"
Requires-Dist: types-aiofiles ; extra == "test"
Requires-Dist: types-certifi ; extra == "test"
Requires-Dist: types-click ; extra == "test"
Requires-Dist: types-itsdangerous ; extra == "test"
Requires-Dist: types-orjson ; extra == "test"
Requires-Dist: types-pkg_resources ; extra == "test"
Requires-Dist: types-python-dateutil ; extra == "test"
Requires-Dist: types-pytz ; extra == "test"
Requires-Dist: types-redis ; extra == "test"
Requires-Dist: types-requests ; extra == "test"
Requires-Dist: types-toml ; extra == "test"
Requires-Dist: types-ujson ; extra == "test"
Project-URL: Documentation, https://workfloworchestrator.org/orchestrator-core/
Provides-Extra: dev
Provides-Extra: doc
Provides-Extra: test

# Orchestrator-Core
[![Downloads](https://pepy.tech/badge/orchestrator-core/month)](https://pepy.tech/project/orchestrator-core)
[![codecov](https://codecov.io/gh/workfloworchestrator/orchestrator-core/branch/main/graph/badge.svg?token=5ANQFI2DHS)](https://codecov.io/gh/workfloworchestrator/orchestrator-core)
[![pypi_version](https://img.shields.io/pypi/v/orchestrator-core?color=%2334D058&label=pypi%20package)](https://pypi.org/project/orchestrator-core)

<p align="center"><em>Production ready Orchestration Framework to manage product lifecyle and workflows. Easy to use, Built on top of FastAPI</em></p>


## Documentation
Can be found [here](https://workfloworchestrator.org/orchestrator-core/)

## Usage
This project can be installed as follows:

#### Step 1:
Install the core.
```shell
pip install orchestrator-core
```

#### Step 2:
Create a postgres database:
```shell
createuser -sP nwa
createdb orchestrator-core -O nwa
```

#### Step 3 (optional):
When using multiple workers, you will need a redis server for live updates with websockets.

By default it will use memory which works with only one worker.
```shell
export WEBSOCKET_BROADCASTER_URL="memory://"
```

For the redis connection you need to set the env variable with the connection url.
```shell
export WEBSOCKET_BROADCASTER_URL="redis://localhost:6379"
```

Websockets can also be turned off with:
```shell
export ENABLE_WEBSOCKETS=False
```

more broadcaster info [here](https://pypi.org/project/broadcaster/)

#### Step 4:
Create a `main.py` file.

```python
from orchestrator import OrchestratorCore
from orchestrator.cli.main import app as core_cli
from orchestrator.settings import AppSettings

app = OrchestratorCore(base_settings=AppSettings())

if __name__ == "__main__":
    core_cli()
```

#### Step 5:
Initialize the migration environment.
```shell
PYTHONPATH=. python main.py db init
PYTHONPATH=. python main.py db upgrade heads
```

### Step 6:
Profit :)

```shell
uvicorn --reload --host 127.0.0.1 --port 8080 main:app
```

Visit [http://127.0.0.1:8080/api/redoc](http://127.0.0.1:8080/api/redoc) to view the api documentation.


## Setting up a development environment

To add features to the repository follow the following procedure to setup a working development environment.

### Installation (Development standalone)
Install the project and its dependencies to develop on the code.

#### Step 1 - install flit:

```shell
python3 -m venv venv
source venv/bin/activate
pip install flit
```

#### Step 2 - install the development code:
```shell
flit install --deps develop --symlink --python venv/bin/python
pip install redis
```

!!! danger
    Make sure to use the flit binary that is installed in your environment. You can check the correct
    path by running
    ```shell
    which flit
    ```

To be sure that the packages will be installed against the correct venv you can also prepend the python interpreter
that you want to use:

```shell
flit install --deps develop --symlink --python venv/bin/python
pip install redis
```


### Running tests
Run the unit-test suite to verify a correct setup.

#### Step 1 - Create a database

```shell
createuser -sP nwa
createdb orchestrator-core-test -O nwa
```

#### Step 2 - Run tests
```shell
pytest test/unit_tests
```
or with xdist:

```shell
pytest -n auto test/unit_tests
```

If you do not encounter any failures in the test, you should be able to develop features in the orchestrator-core.

### Installation (Development symlinked into orchestrator SURF)

If you are working on a project that already uses the `orchestrator-core` and you want to test your new core features
against it, you can use some `flit` magic to symlink the dev version of the core to your project. It will
automatically replace the pypi dep with a symlink to the development version
of the core and update/downgrade all required packages in your own orchestrator project.

#### Step 1 - install flit:

```shell
python - m venv venv
source venv/bin/activate
pip install flit
```

### Step 2 - symlink the core to your own project

```shell
flit install --deps develop --symlink --python /path/to/a/orchestrator-project/venv/bin/python
```

So if you have the core and your own orchestrator project repo in the same folder and the main project folder is
`orchestrator` and you want to use relative links, this will be last step:

```shell
flit install --deps develop --symlink --python ../orchestrator/venv/bin/python
```

