diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 678fe95..b8a5ace 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,7 +44,7 @@ jobs: run: | docker version - - name: Setup Python + - name: Install Python uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} @@ -52,27 +52,31 @@ jobs: 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 - 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 diff --git a/.gitignore b/.gitignore index 8d9c962..5b127a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /.idea /.venv +/.mypy_cache __pycache__ *.pyc *.egg-info diff --git a/README.md b/README.md index 9e9da88..8352c04 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 ``` @@ -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 @@ -83,7 +77,6 @@ if __name__ == "__main__": asyncio.run(launch_blue()) ``` - ## Examples ### Introduction @@ -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 @@ -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, diff --git a/docs/backlog.md b/docs/backlog.md index 4023527..6627e2d 100644 --- a/docs/backlog.md +++ b/docs/backlog.md @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 81ba46f..83b141c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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 = [ @@ -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 @@ -131,36 +133,32 @@ 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 @@ -168,32 +166,30 @@ 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" ]