Skip to content
This repository has been archived by the owner on Jan 22, 2023. It is now read-only.

Commit

Permalink
First release of pyconduit
Browse files Browse the repository at this point in the history
  • Loading branch information
ysfchn committed Jun 22, 2021
0 parents commit 979dfd9
Show file tree
Hide file tree
Showing 50 changed files with 4,626 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patreon: ysfchn
20 changes: 20 additions & 0 deletions .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Publish Mkdocs
on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel wrapt pydantic mkdocs mkdocs-material mkdocstrings
- name: Mkdocs GitHub publish
run: |
git pull
mkdocs gh-deploy -v
23 changes: 23 additions & 0 deletions .github/workflows/python-debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Python Package
on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Upload package to artifacts
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/*
36 changes: 36 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
131 changes: 131 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
_legacy/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Yusuf Cihan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<p align="center">
<img src="https://pyconduit.ysfchn.com/images/main.png" width="800">
</p>

# pyconduit

A simple workflow manager that executes pre-defined functions from user-defined workflow files. You ("developer") create the functions, and they ("users") will able to call the functions by typing its name and pass the required parameters.

It can be used to provide a "custom code evaluation" / "safe eval" feature to your users in your app. So they will only able to access functions that you allow. Users can also reference to other steps, set variables, and use standard functions in their workflow files.

pyconduit comes with Text, Math, Dictionary, List and Variable blocks like in Python's standard built-in functions. So you don't need to reinvent the wheel by writing these functions again.

It **does not** execute multiple functions in the same time. It executes functions _step by step_ (because that's a how "workflow" works), so next function will only execute **after** previous function has finished execution. Even if they are asynchronous / coroutines.

## Features

* Prevent access to a block for specific user. For example, if you have a block that makes a HTTP request, you can add a label to it, and pyconduit will not allow your users to use the function if job doesn't have that label too.

* Add step limits, max usage limit for a block per workflow (it can be changed for a specific job too).

* If you install [`pydantic` library](https://github.com/samuelcolvin/pydantic/) in your environment, pyconduit will use it automatically to enforce type hints / annotations in function parameters, so users won't able to send invalid type of values when parameter expects a specific type of value.

* Use [Context Tags](https://pyconduit.ysfchn.com/context_values) in the workflows to access variables, get the return value of previous steps and read object values with dotted path. For example, users can type `{: my_step_id :}` in the workflow to get the return value of `my_step_id` dynamically.

## Warning

As pyconduit can be used as "isolated space", you should be careful about functions that you enabled to user. (for example, you shouldn't make a function that allows users to get a global value in the runtime from their input). Also, even pyconduit blocks access to keys that starts or ends with underscore, there is no 100% warranty about security.

## Install

```
python -m pip install pyconduit
```

## Links

* [Quick Start](https://pyconduit.ysfchn.com/quick_start)
* [Documentation](https://pyconduit.ysfchn.com/)

## License

Source code is licensed under MIT license. You must include the license notice in all copies or substantial uses of the work.
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyconduit.ysfchn.com
1 change: 1 addition & 0 deletions docs/api/block.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.block.ConduitBlock
1 change: 1 addition & 0 deletions docs/api/category.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.category.ConduitCategory
1 change: 1 addition & 0 deletions docs/api/conduit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.conduit.Conduit
1 change: 1 addition & 0 deletions docs/api/extras/scoped_object.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.other.ScopedObject
1 change: 1 addition & 0 deletions docs/api/extras/utils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.utils
1 change: 1 addition & 0 deletions docs/api/partial_block.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.block.ConduitPartialBlock
1 change: 1 addition & 0 deletions docs/api/step.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.step.ConduitStep
1 change: 1 addition & 0 deletions docs/blocks/dictionary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.categories.dictionary.Dictionary
1 change: 1 addition & 0 deletions docs/blocks/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.categories.lists.Lists
1 change: 1 addition & 0 deletions docs/blocks/logic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.categories.logic.Logic
1 change: 1 addition & 0 deletions docs/blocks/math.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.categories.math.Math
1 change: 1 addition & 0 deletions docs/blocks/object.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.categories.object.Object
1 change: 1 addition & 0 deletions docs/blocks/text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.categories.text.Text
1 change: 1 addition & 0 deletions docs/blocks/variable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: pyconduit.categories.variable.Variable
Loading

0 comments on commit 979dfd9

Please sign in to comment.