-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from SubstrateLabs/hwwu/toolchain-update
update the python toolchain to support both Rye and Poetry
- Loading branch information
Showing
17 changed files
with
227 additions
and
846 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# python generated files | ||
__pycache__/ | ||
*.py[oc] | ||
build/ | ||
dist/ | ||
wheels/ | ||
*.egg-info | ||
|
||
# venv | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Substrate Example Templates in Python | ||
|
||
This is a Substrate example template written in Python. To run this example, | ||
|
||
```bash | ||
# Set your API key as an environment variable. | ||
# Get one here https://www.substrate.run/dashboard/keys if this is your first time. | ||
export SUBSTRATE_API_KEY=<your Substrate API key> | ||
|
||
# Navigate to the python example directory. | ||
cd python | ||
``` | ||
|
||
To run the example with Poetry (default), run the following. | ||
|
||
```bash | ||
poetry install | ||
poetry run main | ||
``` | ||
|
||
To run the example with Rye, comment out the Poetry sections and uncomment the Rye sections in `pyproject.toml` and run the following. | ||
|
||
```bash | ||
rye sync | ||
rye run main | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[virtualenvs] | ||
in-project = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
[project] | ||
name = "template" | ||
version = "0.1.0" | ||
description = "" | ||
authors = [{ name = "Hanwen Wu", email = "[email protected]" }] | ||
readme = "README.md" | ||
|
||
requires-python = ">= 3.9" | ||
dependencies = ["substrate"] | ||
|
||
[project.scripts] | ||
main = "python.example:main" | ||
|
||
[tool.ruff] | ||
line-length = 120 | ||
output-format = "grouped" | ||
target-version = "py310" | ||
|
||
[tool.pyright] | ||
venvPath = "." | ||
venv = ".venv" | ||
|
||
############################## | ||
# Uncomment for Poetry support | ||
############################## | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry] | ||
name = "template" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Hanwen Wu <[email protected]>"] | ||
readme = "README.md" | ||
|
||
packages = [{ include = "python", from = "src" }] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.9" | ||
substrate = "220240617.*" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
ruff = "^0.6.1" | ||
marimo = "^0.8.0" | ||
|
||
[tool.poetry.scripts] | ||
main = "python.example:main" | ||
|
||
|
||
########################### | ||
# Uncomment for Rye support | ||
########################### | ||
|
||
# [build-system] | ||
# requires = ["hatchling"] | ||
# build-backend = "hatchling.build" | ||
|
||
# [tool.rye] | ||
# managed = true | ||
# dev-dependencies = ["ruff>=0.6.1", "marimo>=0.8.0"] | ||
|
||
# [tool.hatch.metadata] | ||
# allow-direct-references = true | ||
|
||
# [tool.hatch.build.targets.wheel] | ||
# packages = ["src/python"] |
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Substrate GenerateText Examples | ||
|
||
To run this example, | ||
|
||
```bash | ||
# Set your API key as an environment variable. | ||
# Get one here https://www.substrate.run/dashboard/keys if this is your first time. | ||
export SUBSTRATE_API_KEY=<your Substrate API key> | ||
|
||
# Navigate to the python example directory. | ||
cd python | ||
``` | ||
|
||
To run the example with Poetry (default), | ||
|
||
```bash | ||
poetry install | ||
poetry run example | ||
poetry run example-multi | ||
``` | ||
|
||
To run the example with Rye, comment out the Poetry sections and uncomment the Rye sections in `pyproject.toml` and run the following. | ||
|
||
```bash | ||
rye sync | ||
rye run example | ||
rye run example-multi | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[virtualenvs] | ||
in-project = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
[project] | ||
name = "example-generate-text" | ||
version = "0.1.0" | ||
description = "" | ||
authors = [{ name = "Ben Guo", email = "[email protected]" }] | ||
readme = "README.md" | ||
|
||
requires-python = ">= 3.9" | ||
dependencies = ["substrate"] | ||
|
||
[project.scripts] | ||
example = "generatetext.example:main" | ||
example-multi = "generatetext.example_multi:main" | ||
|
||
[tool.ruff] | ||
line-length = 120 | ||
output-format = "grouped" | ||
target-version = "py310" | ||
|
||
[tool.pyright] | ||
venvPath = "." | ||
venv = ".venv" | ||
|
||
############################## | ||
# Uncomment for Poetry support | ||
############################## | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry] | ||
name = "example-generate-text" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Ben Guo <[email protected]>"] | ||
readme = "README.md" | ||
|
||
packages = [{ include = "generatetext", from = "src" }] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.9" | ||
substrate = "220240617.*" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
ruff = "^0.6.1" | ||
marimo = "^0.8.0" | ||
|
||
[tool.poetry.scripts] | ||
example = "generatetext.example:main" | ||
example-multi = "generatetext.example_multi:main" | ||
|
||
########################### | ||
# Uncomment for Rye support | ||
########################### | ||
|
||
# [build-system] | ||
# requires = ["hatchling"] | ||
# build-backend = "hatchling.build" | ||
|
||
# [tool.rye] | ||
# managed = true | ||
# dev-dependencies = ["ruff>=0.6.1", "marimo>=0.8.0"] | ||
|
||
# [tool.hatch.metadata] | ||
# allow-direct-references = true | ||
|
||
# [tool.hatch.build.targets.wheel] | ||
# packages = ["src/generatetext"] |
Empty file.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.