Skip to content

Commit 90876c9

Browse files
authored
Initial commit
0 parents  commit 90876c9

23 files changed

+634
-0
lines changed

.github/workflows/build.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: [3.7, 3.8, 3.9]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Set env
24+
run: echo "PACKAGE=$(basename `git config --get remote.origin.url` | sed -e 's/\.git$//')" >> $GITHUB_ENV
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -e ".[dev]"
29+
- name: Test formatting
30+
run: |
31+
pip install black
32+
black --check $PACKAGE
33+
- name: Test documentation
34+
run: |
35+
cd doc
36+
make html
37+
cd ..
38+
- name: Test code
39+
run: |
40+
pip install pytest pytest-cov
41+
pytest --cov=$PACKAGE

.github/workflows/publish.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python
15+
uses: actions/setup-python@v1
16+
with:
17+
python-version: '3.x'
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install setuptools wheel twine pep517
22+
- name: Build and publish
23+
env:
24+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
25+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
26+
run: |
27+
python -m pep517.build .
28+
twine upload dist/*

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DS_Store
2+
.cache
3+
.pytest_cache
4+
__pycache__
5+
*.py[cod]
6+
*$py.class
7+
*.egg-info
8+
build/
9+
dist/
10+
.idea
11+
.coverage
12+
13+
doc/**

.readthedocs.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
formats:
3+
- pdf
4+
python:
5+
version: 3.8
6+
install:
7+
- method: pip
8+
path: .
9+
extra_requirements:
10+
- dev
11+
- method: setuptools
12+
path: .
13+
sphinx:
14+
fail_on_warning: true

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018, Pierre Clisson <pierre@clisson.net>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.rst

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
An example Timeflux plugin
2+
==========================
3+
4+
This is an example plugin that provides a few simple demonstration nodes. Use it as a template
5+
to develop your own plugins.
6+
7+
Installation
8+
------------
9+
10+
First, make sure that `Timeflux <https://github.com/timeflux/timeflux>`__ is installed.
11+
12+
You can then install this plugin in the `timeflux` environment:
13+
14+
::
15+
16+
$ conda activate timeflux
17+
$ pip install timeflux_example

examples/dynamic.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
graphs:
2+
3+
- id: DynamicIO
4+
5+
nodes:
6+
- id: node_1
7+
module: timeflux_example.nodes.dynamic
8+
class: Outputs
9+
params:
10+
seed: 1
11+
- id: node_2
12+
module: timeflux_example.nodes.dynamic
13+
class: Inputs
14+
- id: node_3
15+
module: timeflux.nodes.debug
16+
class: Display
17+
- id: node_4
18+
module: timeflux.nodes.debug
19+
class: Display
20+
21+
edges:
22+
- source: node_1:* # The magic happens here
23+
target: node_2
24+
- source: node_1
25+
target: node_3
26+
- source: node_2
27+
target: node_4

examples/dynamic_prefixed.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
graphs:
2+
3+
- id: DynamicIO
4+
5+
nodes:
6+
- id: node_1
7+
module: timeflux_example.nodes.dynamic
8+
class: Outputs
9+
params:
10+
seed: 1
11+
prefix: foo
12+
- id: node_2
13+
module: timeflux_example.nodes.dynamic
14+
class: Inputs
15+
params:
16+
prefix: bar
17+
- id: node_3
18+
module: timeflux.nodes.debug
19+
class: Display
20+
- id: node_4
21+
module: timeflux.nodes.debug
22+
class: Display
23+
24+
edges:
25+
- source: node_1:foo_* # Dynamic inputs can be prefixed
26+
target: node_2:bar # The same goes for outputs
27+
- source: node_1
28+
target: node_3
29+
- source: node_2
30+
target: node_4

examples/multi.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
graphs:
2+
3+
- id: multi
4+
nodes:
5+
- id: matrix_1
6+
module: timeflux.nodes.random
7+
class: Random
8+
params:
9+
columns: 2
10+
rows_min: 2
11+
rows_max: 2
12+
value_min: 1
13+
value_max: 1
14+
seed: 1
15+
- id: matrix_2
16+
module: timeflux.nodes.random
17+
class: Random
18+
params:
19+
columns: 2
20+
rows_min: 2
21+
rows_max: 2
22+
value_min: 2
23+
value_max: 2
24+
seed: 1
25+
- id: matrix_add
26+
module: timeflux_example.nodes.arithmetic
27+
class: MatrixAdd
28+
- id: display_matrix_1
29+
module: timeflux.nodes.debug
30+
class: Display
31+
- id: display_matrix_2
32+
module: timeflux.nodes.debug
33+
class: Display
34+
- id: display_matrix_add
35+
module: timeflux.nodes.debug
36+
class: Display
37+
38+
edges:
39+
- source: matrix_1
40+
target: matrix_add:m1
41+
- source: matrix_2
42+
target: matrix_add:m2
43+
- source: matrix_1
44+
target: display_matrix_1
45+
- source: matrix_2
46+
target: display_matrix_2
47+
- source: matrix_add
48+
target: display_matrix_add
49+
50+
rate: 0.1

examples/sine.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
graphs:
2+
- nodes:
3+
- id: sine
4+
module: timeflux_example.nodes.signal
5+
class: Sine
6+
params:
7+
frequency: 120
8+
amplitude: 1
9+
resolution: 44100
10+
- id: ui
11+
module: timeflux_ui.nodes.ui
12+
class: UI
13+
params:
14+
settings:
15+
monitor:
16+
millisPerPixel: 0.25
17+
lineWidth: 1
18+
interpolation: linear
19+
edges:
20+
- source: sine
21+
target: ui:sine
22+
rate: 10

examples/sinus.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
graphs:
2+
3+
- nodes:
4+
- id: sinus
5+
module: timeflux_example.nodes.sinus
6+
class: Sinus
7+
params:
8+
rate: 1
9+
amplitude: 1
10+
11+
- id: ui
12+
module: timeflux_ui.nodes.ui
13+
class: UI
14+
15+
edges:
16+
- source: sinus
17+
target: ui:sinus
18+
19+
rate: 100

examples/test.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
graphs:
2+
3+
- nodes:
4+
- id: node_1
5+
module: timeflux.nodes.random
6+
class: Random
7+
params:
8+
columns: 5
9+
rows_min: 1
10+
rows_max: 10
11+
value_min: 0
12+
value_max: 5
13+
seed: 1
14+
- id: node_2
15+
module: timeflux_example.nodes.arithmetic
16+
class: Add
17+
params:
18+
value: 1
19+
- id: node_3
20+
module: timeflux.nodes.debug
21+
class: Display
22+
23+
edges:
24+
- source: node_1
25+
target: node_2
26+
- source: node_2
27+
target: node_3

pyproject.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Enable version inference
2+
[tool.setuptools_scm]
3+
local_scheme = "no-local-version"
4+
5+
# Generate documentation shim
6+
[tool.docinit]
7+
8+
# https://setuptools.readthedocs.io/en/latest/build_meta.html
9+
[build-system]
10+
requires = ["setuptools>=62", "wheel", "setuptools_scm[toml]>=3.4", "docinit"]
11+
build-backend = "setuptools.build_meta"

setup.cfg

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[metadata]
2+
name = timeflux-example
3+
description = An example Timeflux plugin
4+
long_description = file: README.rst
5+
author = Pierre Clisson
6+
author-email = contact@timeflux.io
7+
license = MIT
8+
home-page = https://timeflux.io
9+
project_urls =
10+
Documentation = http://doc.timeflux.io/projects/timeflux-example/
11+
Source Code = https://github.com/timeflux/timeflux_example
12+
Bug Tracker = https://github.com/timeflux/timeflux_example/issues
13+
classifier =
14+
Development Status :: 4 - Beta
15+
Environment :: Console
16+
Intended Audience :: Developers
17+
Intended Audience :: Science/Research
18+
License :: OSI Approved :: MIT License
19+
Operating System :: OS Independent
20+
Programming Language :: Python
21+
keywords = timeflux
22+
23+
[options]
24+
packages = find:
25+
install_requires =
26+
timeflux>=0.5.3
27+
28+
[options.extras_require]
29+
dev =
30+
pytest>=5.3
31+
sphinx>=2.2
32+
sphinx_rtd_theme>=0.4
33+
setuptools_scm
34+
docinit
35+
36+
[docinit]
37+
name = Example plugin
38+
parent_url = https://doc.timeflux.io
39+
logo_url = https://github.com/timeflux/timeflux/raw/master/doc/static/img/logo.png
40+
41+
[build_sphinx]
42+
warning-is-error = 1

setup.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Required for editable installs
2+
# https://discuss.python.org/t/specification-of-editable-installation/1564/
3+
import setuptools; setuptools.setup()

test/conftest.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""Test configuration"""
2+
3+
import os
4+
import pytest
5+
6+
def pytest_configure(config):
7+
pytest.path = os.path.dirname(os.path.abspath(__file__))

0 commit comments

Comments
 (0)