Browse Source

Fix dependency installation on template

tags/v0.3.10-rc3
haixuantao haixuanTao 10 months ago
parent
commit
45a4b76f12
5 changed files with 57 additions and 2 deletions
  1. +2
    -1
      .github/workflows/ci.yml
  2. +44
    -0
      binaries/cli/src/template/python/README.md
  3. +3
    -1
      binaries/cli/src/template/python/__node-name__/README.md
  4. +3
    -0
      binaries/cli/src/template/python/dataflow-template.yml
  5. +5
    -0
      binaries/cli/src/template/python/mod.rs

+ 2
- 1
.github/workflows/ci.yml View File

@@ -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



+ 44
- 0
binaries/cli/src/template/python/README.md View File

@@ -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

+ 3
- 1
binaries/cli/src/template/python/__node-name__/README.md View File

@@ -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
```



+ 3
- 0
binaries/cli/src/template/python/dataflow-template.yml View File

@@ -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


+ 5
- 0
binaries/cli/src/template/python/mod.rs View File

@@ -100,6 +100,7 @@ fn create_custom_node(

fn create_dataflow(name: String, path: Option<PathBuf>) -> 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<PathBuf>) -> 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(


Loading…
Cancel
Save