Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,35 +44,39 @@ jobs:
run: |
docker version

- name: Setup Python
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
cache-dependency-path: 'pyproject.toml'

- name: Setup Node.js
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'package.json'

- name: Setup project
- name: Set up project
run: |
# Install package in editable mode.
pip install versioningit wheel
pip install --editable=.[test,develop]
pip install --upgrade versioningit wheel
pip install --upgrade --editable='.[test,develop]'

# TODO: This command should write a `package.json`, then invoke `npm install`.
node-blue setup
# TODO: Refactor to `node-blue setup`, see above.
npm install
Comment on lines +68 to 71
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve the manual installation procedure. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


- name: Check code style
if: ${{ matrix.python-version != '3.9' }}
run: |
poe lint

- name: Run tests
run: |
node-blue setup
poe test

- name: Upload coverage to Codecov
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.idea
/.venv
/.mypy_cache
__pycache__
*.pyc
*.egg-info
Expand Down
24 changes: 7 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ Write Node-RED user-defined functions in Python / Efficient test harnesses for N
True headless Node-RED / Improved development iteration times / Node-RED without needing
to take the red pill / Node-BLUE is Node-RED on rails / Now it all makes sense_

:::{todo}
This list should make it into the »Features« section.
:::

:::{attention}
Here be dragons.
:::


## About

The idea is to embed [Node-RED] into Python programs, in order to leverage it
Expand All @@ -29,16 +20,20 @@ The other idea is to extend the Node-RED ecosystem by leveraging other programmi
languages and their ecosystems natively, beyond what JavaScript/NPM can do. We made
a start with [Python], by using the excellent [JSPyBridge] package.


## Synopsis


### Command-line use

Install [Node-BLUE] and [HTTPie], and their prerequisites.
```shell
pip install httpie https://github.com/daq-tools/node-blue
pip install httpie node-blue
```

There is currently a little manual post-setup procedure.
```shell
node-blue setup
wget https://github.com/daq-tools/node-blue/raw/refs/heads/main/package.json
wget https://github.com/daq-tools/node-blue/raw/refs/heads/main/node.importmap
npm install
```

Expand All @@ -58,7 +53,6 @@ Launch a flow which defines a pipeline to converge data from [MQTT] to [CrateDB]
node-blue launch --flow=examples/flows/mqtt-to-cratedb.yaml
```


### Library use

```python
Expand All @@ -83,7 +77,6 @@ if __name__ == "__main__":
asyncio.run(launch_blue())
```


## Examples

### Introduction
Expand Down Expand Up @@ -211,13 +204,11 @@ node-blue launch --flow=examples/flows/mqtt-routing-python.yaml
]
```


## References

See also the IBM Data management article about [Implementing ETL flows with
Node-RED] by [Ondrej Lehota].


## Etymology

To use the name »Node-BLUE« for this project was obvious. However, we discovered
Expand All @@ -228,7 +219,6 @@ will not be much harm to reuse that name now.
- https://www.npmjs.com/package/node-blue
- https://github.com/node-blue/node-blue


## Acknowledgements

This project bundles a few significant pieces of software and technologies,
Expand Down
4 changes: 4 additions & 0 deletions docs/backlog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Node-BLUE backlog

## Iteration +0
- [o] Refactor `npm install` to `node-blue setup`
- [o] Enable code coverage uploading

## Iteration +1
- [o] What about calling Python functions?
- [o] Python functions, appsource, and appsink
Expand Down
70 changes: 33 additions & 37 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ requires = [

[project]
name = "node-blue"
description = "Node-RED without a mouse / Node-RED as a library / Write Node-RED flows in YAML / Efficient test harnesses for Node-RED / Headless Node-RED / Improved development cycle times / Now it all makes sense"
description = """\
Node-RED without a mouse / Node-RED as a library / Write Node-RED flows in YAML / Efficient test harnesses for \
Node-RED / Headless Node-RED / Improved development cycle times / Now it all makes sense\
"""
readme = "README.md"
keywords = [
"automation",
Expand Down Expand Up @@ -93,14 +96,13 @@ dependencies = [
optional-dependencies.develop = [
"munch<5",
"mypy<1.20",
"poethepoet<0.30",
"pyproject-fmt<2.6",
"poethepoet<1",
"pyproject-fmt<3",
"ruff<0.16",
"types-tabulate",
]
optional-dependencies.release = [
"build<2",
"minibump<1; python_version>='3.10'",
"twine<7",
]
optional-dependencies.test = [
Expand All @@ -116,8 +118,8 @@ urls.homepage = "https://github.com/daq-tools/node-blue"
urls.repository = "https://github.com/daq-tools/node-blue"
scripts.node-blue = "node_blue.cli:cli"

[tool.setuptools.packages.find]
namespaces = false
[tool.setuptools]
packages.find.namespaces = false

[tool.black]
line-length = 120
Expand All @@ -131,69 +133,63 @@ extend-exclude = [
# Temporary
"workbench.py",
]

lint.ignore = [
"E722", # Do not use bare `except`
]

[tool.pytest.ini_options]
minversion = "2.0"
addopts = "-rsfEX -p pytester --strict-markers --verbosity=3 --capture=no"
log_cli = true # Enable to receive way more log details on stdout.
log_cli_level = "DEBUG"
log_level = "DEBUG"
log_format = "%(asctime)-15s [%(name)-24s] %(levelname)-7s: %(message)s"
testpaths = [ "examples", "droste", "node_blue", "tests" ]
xfail_strict = true
markers = [
[tool.pytest]
ini_options.minversion = "2.0"
ini_options.addopts = "-rsfEX -p pytester --strict-markers --verbosity=3 --capture=no"
ini_options.log_cli = true # Enable to receive way more log details on stdout.
ini_options.log_cli_level = "DEBUG"
ini_options.log_level = "DEBUG"
ini_options.log_format = "%(asctime)-15s [%(name)-24s] %(levelname)-7s: %(message)s"
ini_options.testpaths = [ "examples", "droste", "node_blue", "tests" ]
ini_options.xfail_strict = true
ini_options.markers = [
"capmqtt_decode_utf8",
]

[tool.coverage.run]
branch = false
source = [ "droste", "node_blue" ]

[tool.coverage.report]
fail_under = 0
show_missing = true
[tool.coverage]
run.branch = false
run.source = [ "droste", "node_blue" ]
report.fail_under = 0
report.show_missing = true

[tool.mypy]
packages = [ "node_blue" ]
exclude = [
]
exclude = []
check_untyped_defs = true
ignore_missing_imports = true
implicit_optional = true
install_types = true
non_interactive = true

[tool.versioningit]
vcs.method = "git"
vcs.default-tag = "0.0.0"

[tool.versioningit.vcs]
method = "git"
default-tag = "0.0.0"

[tool.poe.tasks]
format = [
[tool.poe]
tasks.format = [
{ cmd = "ruff format" },
# Configure Ruff not to auto-fix (remove!):
# unused imports (F401), unused variables (F841), `print` statements (T201), and commented-out code (ERA001).
{ cmd = "ruff check --fix --ignore=ERA --ignore=F401 --ignore=F841 --ignore=T20 --ignore=ERA001 ." },
{ cmd = "pyproject-fmt --keep-full-version pyproject.toml" },
]
lint = [
tasks.lint = [
{ cmd = "ruff check ." },
{ cmd = "pyproject-fmt --check pyproject.toml" },
{ cmd = "mypy" },
]
test = [
tasks.test = [
{ cmd = "node-blue setup" },
{ cmd = "pytest" },
]
coverage = [
tasks.coverage = [
{ cmd = "coverage run pytest" },
{ cmd = "coverage xml" },
{ cmd = "coverage report" },
]
build = { cmd = "python -m build" }
check = [ "lint", "test" ]
tasks.build = { cmd = "python -m build" }
tasks.check = [ "lint", "test" ]