generated from timeflux/timeflux_example
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 90876c9
Showing
23 changed files
with
634 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.7, 3.8, 3.9] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Set env | ||
run: echo "PACKAGE=$(basename `git config --get remote.origin.url` | sed -e 's/\.git$//')" >> $GITHUB_ENV | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e ".[dev]" | ||
- name: Test formatting | ||
run: | | ||
pip install black | ||
black --check $PACKAGE | ||
- name: Test documentation | ||
run: | | ||
cd doc | ||
make html | ||
cd .. | ||
- name: Test code | ||
run: | | ||
pip install pytest pytest-cov | ||
pytest --cov=$PACKAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: publish | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine pep517 | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python -m pep517.build . | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.DS_Store | ||
.cache | ||
.pytest_cache | ||
__pycache__ | ||
*.py[cod] | ||
*$py.class | ||
*.egg-info | ||
build/ | ||
dist/ | ||
.idea | ||
.coverage | ||
|
||
doc/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 2 | ||
formats: | ||
python: | ||
version: 3.8 | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- dev | ||
- method: setuptools | ||
path: . | ||
sphinx: | ||
fail_on_warning: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018, Pierre Clisson <pierre@clisson.net> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
An example Timeflux plugin | ||
========================== | ||
|
||
This is an example plugin that provides a few simple demonstration nodes. Use it as a template | ||
to develop your own plugins. | ||
|
||
Installation | ||
------------ | ||
|
||
First, make sure that `Timeflux <https://github.com/timeflux/timeflux>`__ is installed. | ||
|
||
You can then install this plugin in the `timeflux` environment: | ||
|
||
:: | ||
|
||
$ conda activate timeflux | ||
$ pip install timeflux_example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
graphs: | ||
|
||
- id: DynamicIO | ||
|
||
nodes: | ||
- id: node_1 | ||
module: timeflux_example.nodes.dynamic | ||
class: Outputs | ||
params: | ||
seed: 1 | ||
- id: node_2 | ||
module: timeflux_example.nodes.dynamic | ||
class: Inputs | ||
- id: node_3 | ||
module: timeflux.nodes.debug | ||
class: Display | ||
- id: node_4 | ||
module: timeflux.nodes.debug | ||
class: Display | ||
|
||
edges: | ||
- source: node_1:* # The magic happens here | ||
target: node_2 | ||
- source: node_1 | ||
target: node_3 | ||
- source: node_2 | ||
target: node_4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
graphs: | ||
|
||
- id: DynamicIO | ||
|
||
nodes: | ||
- id: node_1 | ||
module: timeflux_example.nodes.dynamic | ||
class: Outputs | ||
params: | ||
seed: 1 | ||
prefix: foo | ||
- id: node_2 | ||
module: timeflux_example.nodes.dynamic | ||
class: Inputs | ||
params: | ||
prefix: bar | ||
- id: node_3 | ||
module: timeflux.nodes.debug | ||
class: Display | ||
- id: node_4 | ||
module: timeflux.nodes.debug | ||
class: Display | ||
|
||
edges: | ||
- source: node_1:foo_* # Dynamic inputs can be prefixed | ||
target: node_2:bar # The same goes for outputs | ||
- source: node_1 | ||
target: node_3 | ||
- source: node_2 | ||
target: node_4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
graphs: | ||
|
||
- id: multi | ||
nodes: | ||
- id: matrix_1 | ||
module: timeflux.nodes.random | ||
class: Random | ||
params: | ||
columns: 2 | ||
rows_min: 2 | ||
rows_max: 2 | ||
value_min: 1 | ||
value_max: 1 | ||
seed: 1 | ||
- id: matrix_2 | ||
module: timeflux.nodes.random | ||
class: Random | ||
params: | ||
columns: 2 | ||
rows_min: 2 | ||
rows_max: 2 | ||
value_min: 2 | ||
value_max: 2 | ||
seed: 1 | ||
- id: matrix_add | ||
module: timeflux_example.nodes.arithmetic | ||
class: MatrixAdd | ||
- id: display_matrix_1 | ||
module: timeflux.nodes.debug | ||
class: Display | ||
- id: display_matrix_2 | ||
module: timeflux.nodes.debug | ||
class: Display | ||
- id: display_matrix_add | ||
module: timeflux.nodes.debug | ||
class: Display | ||
|
||
edges: | ||
- source: matrix_1 | ||
target: matrix_add:m1 | ||
- source: matrix_2 | ||
target: matrix_add:m2 | ||
- source: matrix_1 | ||
target: display_matrix_1 | ||
- source: matrix_2 | ||
target: display_matrix_2 | ||
- source: matrix_add | ||
target: display_matrix_add | ||
|
||
rate: 0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
graphs: | ||
- nodes: | ||
- id: sine | ||
module: timeflux_example.nodes.signal | ||
class: Sine | ||
params: | ||
frequency: 120 | ||
amplitude: 1 | ||
resolution: 44100 | ||
- id: ui | ||
module: timeflux_ui.nodes.ui | ||
class: UI | ||
params: | ||
settings: | ||
monitor: | ||
millisPerPixel: 0.25 | ||
lineWidth: 1 | ||
interpolation: linear | ||
edges: | ||
- source: sine | ||
target: ui:sine | ||
rate: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
graphs: | ||
|
||
- nodes: | ||
- id: sinus | ||
module: timeflux_example.nodes.sinus | ||
class: Sinus | ||
params: | ||
rate: 1 | ||
amplitude: 1 | ||
|
||
- id: ui | ||
module: timeflux_ui.nodes.ui | ||
class: UI | ||
|
||
edges: | ||
- source: sinus | ||
target: ui:sinus | ||
|
||
rate: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
graphs: | ||
|
||
- nodes: | ||
- id: node_1 | ||
module: timeflux.nodes.random | ||
class: Random | ||
params: | ||
columns: 5 | ||
rows_min: 1 | ||
rows_max: 10 | ||
value_min: 0 | ||
value_max: 5 | ||
seed: 1 | ||
- id: node_2 | ||
module: timeflux_example.nodes.arithmetic | ||
class: Add | ||
params: | ||
value: 1 | ||
- id: node_3 | ||
module: timeflux.nodes.debug | ||
class: Display | ||
|
||
edges: | ||
- source: node_1 | ||
target: node_2 | ||
- source: node_2 | ||
target: node_3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Enable version inference | ||
[tool.setuptools_scm] | ||
local_scheme = "no-local-version" | ||
|
||
# Generate documentation shim | ||
[tool.docinit] | ||
|
||
# https://setuptools.readthedocs.io/en/latest/build_meta.html | ||
[build-system] | ||
requires = ["setuptools>=62", "wheel", "setuptools_scm[toml]>=3.4", "docinit"] | ||
build-backend = "setuptools.build_meta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[metadata] | ||
name = timeflux-example | ||
description = An example Timeflux plugin | ||
long_description = file: README.rst | ||
author = Pierre Clisson | ||
author-email = contact@timeflux.io | ||
license = MIT | ||
home-page = https://timeflux.io | ||
project_urls = | ||
Documentation = http://doc.timeflux.io/projects/timeflux-example/ | ||
Source Code = https://github.com/timeflux/timeflux_example | ||
Bug Tracker = https://github.com/timeflux/timeflux_example/issues | ||
classifier = | ||
Development Status :: 4 - Beta | ||
Environment :: Console | ||
Intended Audience :: Developers | ||
Intended Audience :: Science/Research | ||
License :: OSI Approved :: MIT License | ||
Operating System :: OS Independent | ||
Programming Language :: Python | ||
keywords = timeflux | ||
|
||
[options] | ||
packages = find: | ||
install_requires = | ||
timeflux>=0.5.3 | ||
|
||
[options.extras_require] | ||
dev = | ||
pytest>=5.3 | ||
sphinx>=2.2 | ||
sphinx_rtd_theme>=0.4 | ||
setuptools_scm | ||
docinit | ||
|
||
[docinit] | ||
name = Example plugin | ||
parent_url = https://doc.timeflux.io | ||
logo_url = https://github.com/timeflux/timeflux/raw/master/doc/static/img/logo.png | ||
|
||
[build_sphinx] | ||
warning-is-error = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Required for editable installs | ||
# https://discuss.python.org/t/specification-of-editable-installation/1564/ | ||
import setuptools; setuptools.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""Test configuration""" | ||
|
||
import os | ||
import pytest | ||
|
||
def pytest_configure(config): | ||
pytest.path = os.path.dirname(os.path.abspath(__file__)) |
Oops, something went wrong.