Skip to content

Commit 18272a4

Browse files
committed
update the existing example to use the new toolchain
1 parent 7127932 commit 18272a4

File tree

9 files changed

+103
-830
lines changed

9 files changed

+103
-830
lines changed

basics/generate-text/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ ts-node example-multi.ts # Run the MultiComputeText example
1515

1616
# Run the Python example
1717
# Note: First install dependencies in the root examples directory.
18-
cd python # Navigate to the python example
19-
poetry run python example.py # Run the ComputeText example
20-
poetry run python example-multi.py # Run the MultiComputeText example
18+
cd python # Navigate to the python example
19+
poetry install # Install dependencies and build the example
20+
poetry run example # Run the ComputeText example
21+
poetry run example-multi # Run the MultiComputeText example
2122
```
2223

2324
</details>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Substrate GenerateText Examples
2+
3+
To run this example,
4+
5+
```bash
6+
# Set your API key as an environment variable.
7+
# Get one here https://www.substrate.run/dashboard/keys if this is your first time.
8+
export SUBSTRATE_API_KEY=<your Substrate API key>
9+
10+
# Navigate to the python example directory.
11+
cd python
12+
```
13+
14+
To run the example with Poetry, uncomment the Poetry sections in `pyproject.toml` and run the following.
15+
16+
```bash
17+
poetry install
18+
poetry run example
19+
poetry run example-multi
20+
```
21+
22+
To run the example with Rye, uncomment the Rye sections in `pyproject.toml` and run the following.
23+
24+
```bash
25+
rye sync
26+
rye run example
27+
rye run example-multi
28+
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[virtualenvs]
2+
in-project = true
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[project]
2+
name = "example-generate-text"
3+
version = "0.1.0"
4+
description = ""
5+
authors = [{ name = "Ben Guo", email = "[email protected]" }]
6+
readme = "README.md"
7+
8+
requires-python = ">= 3.9"
9+
dependencies = ["substrate"]
10+
11+
[project.scripts]
12+
example = "generatetext.example:main"
13+
example-multi = "generatetext.example_multi:main"
14+
15+
[tool.ruff]
16+
line-length = 120
17+
output-format = "grouped"
18+
target-version = "py310"
19+
20+
[tool.pyright]
21+
venvPath = "."
22+
venv = ".venv"
23+
24+
##############################
25+
# Uncomment for Poetry support
26+
##############################
27+
28+
# [build-system]
29+
# requires = ["poetry-core"]
30+
# build-backend = "poetry.core.masonry.api"
31+
32+
# [tool.poetry]
33+
# name = "example-generate-text"
34+
# version = "0.1.0"
35+
# description = ""
36+
# authors = ["Ben Guo <[email protected]>"]
37+
# readme = "README.md"
38+
39+
# packages = [{ include = "generatetext", from = "src" }]
40+
41+
# [tool.poetry.dependencies]
42+
# python = "^3.9"
43+
# substrate = "220240617.*"
44+
45+
# [tool.poetry.group.dev.dependencies]
46+
# ruff = "^0.6.1"
47+
# marimo = "^0.8.0"
48+
49+
# [tool.poetry.scripts]
50+
# example = "generatetext.example:main"
51+
# example-multi = "generatetext.example_multi:main"
52+
53+
###########################
54+
# Uncomment for Rye support
55+
###########################
56+
57+
# [build-system]
58+
# requires = ["hatchling"]
59+
# build-backend = "hatchling.build"
60+
61+
# [tool.rye]
62+
# managed = true
63+
# dev-dependencies = ["ruff>=0.6.1", "marimo>=0.8.0"]
64+
65+
# [tool.hatch.metadata]
66+
# allow-direct-references = true
67+
68+
# [tool.hatch.build.targets.wheel]
69+
# packages = ["src/generatetext"]

basics/generate-text/python/src/generatetext/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)