diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cb9721c..50185e9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -315,9 +315,10 @@ jobs: cd test_python_project uv venv --seed -p 3.11 uv run pip install -e ../apis/python/node + dora build dataflow.yml --uv + uv pip install ruff pytest # Check Compliancy - uv pip install -e ./*/ uv run ruff check . uv run pytest diff --git a/binaries/cli/src/template/python/README.md b/binaries/cli/src/template/python/README.md new file mode 100644 index 00000000..bc43ae54 --- /dev/null +++ b/binaries/cli/src/template/python/README.md @@ -0,0 +1,44 @@ +## Getting started + +- Install it with: + +```bash +uv venv -p 3.11 --seed +dora build dataflow.yml --uv +``` + +- Run it with: + +```bash +dora run dataflow.yml --uv +``` + +## Contribution Guide + +- Format with [ruff](https://docs.astral.sh/ruff/): + +```bash +uv pip install ruff +uv run ruff check . --fix +``` + +- Lint with ruff: + +```bash +uv run ruff check . +``` + +- Test with [pytest](https://github.com/pytest-dev/pytest) + +```bash +uv pip install pytest +uv run pytest . # Test +``` + +## YAML Specification + +## Examples + +## License + +Node Name's code are released under the MIT License diff --git a/binaries/cli/src/template/python/__node-name__/README.md b/binaries/cli/src/template/python/__node-name__/README.md index 93c23e83..a5a2519e 100644 --- a/binaries/cli/src/template/python/__node-name__/README.md +++ b/binaries/cli/src/template/python/__node-name__/README.md @@ -2,7 +2,7 @@ ## Getting started -- Install it with pip: +- Install it with uv: ```bash uv venv -p 3.11 --seed @@ -14,6 +14,7 @@ uv pip install -e . - Format with [ruff](https://docs.astral.sh/ruff/): ```bash +uv pip install ruff uv run ruff check . --fix ``` @@ -26,6 +27,7 @@ uv run ruff check . - Test with [pytest](https://github.com/pytest-dev/pytest) ```bash +uv pip install pytest uv run pytest . # Test ``` diff --git a/binaries/cli/src/template/python/dataflow-template.yml b/binaries/cli/src/template/python/dataflow-template.yml index 3797b98c..c941406c 100644 --- a/binaries/cli/src/template/python/dataflow-template.yml +++ b/binaries/cli/src/template/python/dataflow-template.yml @@ -1,5 +1,6 @@ nodes: - id: talker_1 + build: pip install -e talker-1 path: talker-1/talker_1/main.py inputs: tick: dora/timer/millis/100 @@ -7,6 +8,7 @@ nodes: - speech - id: talker_2 + build: pip install -e talker-2 path: talker-2/talker_2/main.py inputs: tick: dora/timer/secs/2 @@ -14,6 +16,7 @@ nodes: - speech - id: listener_1 + build: pip install -e listener-1 path: listener-1/listener_1/main.py inputs: speech-1: talker_1/speech diff --git a/binaries/cli/src/template/python/mod.rs b/binaries/cli/src/template/python/mod.rs index 9f15161d..b4dd92fd 100644 --- a/binaries/cli/src/template/python/mod.rs +++ b/binaries/cli/src/template/python/mod.rs @@ -100,6 +100,7 @@ fn create_custom_node( fn create_dataflow(name: String, path: Option) -> Result<(), eyre::ErrReport> { const DATAFLOW_YML: &str = include_str!("dataflow-template.yml"); + const WORKSPACE_README: &str = include_str!("README.md"); if name.contains('/') { bail!("dataflow name must not contain `/` separators"); @@ -118,6 +119,10 @@ fn create_dataflow(name: String, path: Option) -> Result<(), eyre::ErrR fs::write(&dataflow_yml_path, dataflow_yml) .with_context(|| format!("failed to write `{}`", dataflow_yml_path.display()))?; + let readme_path = root.join("README.md"); + fs::write(&readme_path, WORKSPACE_README) + .with_context(|| format!("failed to write `{}`", readme_path.display()))?; + create_custom_node("talker 1".into(), Some(root.join("talker-1")), TALKER_PY)?; create_custom_node("talker 2".into(), Some(root.join("talker-2")), TALKER_PY)?; create_custom_node(