Skip to content

dev: add definitions.json generation script #772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
906cb05
add definitions.json generation script
mvadari Nov 14, 2024
4474908
fix model generation
mvadari Nov 20, 2024
65658f8
Merge branch 'main' into definitions-generation
mvadari Dec 11, 2024
c58cd8e
Merge branch 'main' into definitions-generation
mvadari Dec 20, 2024
76897e9
fix Hash192
mvadari Dec 20, 2024
738601e
Merge branch 'main' into definitions-generation
mvadari Jan 2, 2025
fe906c6
update script to follow server_definitions format
mvadari Feb 6, 2025
5ab6aad
oops wrong branch
mvadari Feb 6, 2025
8efdc44
add basic Github support
mvadari Feb 6, 2025
b31251f
pipe automatically to file
mvadari Feb 6, 2025
a072e49
add Github support to model generation
mvadari Feb 6, 2025
98c267d
add poe script
mvadari Feb 6, 2025
63aface
Merge branch 'main' into definitions-generation
mvadari Feb 6, 2025
1dda243
clean up
mvadari Feb 6, 2025
e6c1742
more cleanup
mvadari Feb 7, 2025
df302ca
Merge branch 'main' into definitions-generation
mvadari Feb 11, 2025
201820b
respond to comments
mvadari Feb 12, 2025
b059f44
remove unneeded rename
mvadari Feb 12, 2025
b6ba563
change wording
mvadari Feb 12, 2025
9cfae18
Merge branch 'main' into definitions-generation
mvadari Feb 12, 2025
561c388
fix wording
mvadari Feb 12, 2025
ee68c0a
respond to comments
mvadari Feb 13, 2025
be569fc
Merge branch 'main' into definitions-generation
mvadari Feb 18, 2025
685cbf6
Merge branch 'main' into definitions-generation
mvadari Mar 18, 2025
2fad0c3
update contributing
mvadari Mar 19, 2025
4a26858
Merge branch 'main' into definitions-generation
mvadari Mar 19, 2025
29b058b
Merge branch 'main' into definitions-generation
mvadari May 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,19 @@ In order to test how a change in docs configuration looks like on ReadTheDocs be

Examples can be found in subfolders of [tests/integrations](https://github.com/XRPLF/xrpl-py/tree/main/tests/integration)

## Updating `definitions.json`
## Updating `definitions.json` and models

This should almost always be done using the [`xrpl-codec-gen`](https://github.com/RichardAH/xrpl-codec-gen) script - if the output needs manual intervention afterwards, consider updating the script instead.
To update just the `definitions.json` file:
```bash
poetry run poe definitions https://github.com/XRPLF/rippled/tree/develop
```

1. Clone / pull the latest changes from [rippled](https://github.com/XRPLF/rippled) - Specifically the `develop` branch is usually the right one.
2. Clone / pull the latest changes from [`xrpl-codec-gen`](https://github.com/RichardAH/xrpl-codec-gen)
3. From the `xrpl-codec-gen` tool, follow the steps in the `README.md` to generate a new `definitions.json` file.
4. Replace the `definitions.json` file in the `ripple-binary-codec` with the newly generated file.
5. Verify that the changes make sense by inspection before submitting, as there may be updates required for the `xrpl-codec-gen` tool depending on the latest amendments we're updating to match.
Any Github branch link or local path to rippled will work here.

To update the models as well:
```bash
poetry run poe generate https://github.com/XRPLF/rippled/tree/develop
```

## Release process

Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,20 @@ precision = 2
test_unit = "coverage run -m unittest discover tests/unit"
test_integration = "coverage run -m unittest discover tests/integration"
lint = "poetry run flake8 xrpl tests snippets"
definitions = "poetry run python3 tools/generate_definitions.py"

[tool.poe.tasks.test]
cmd = "python3 -m unittest ${FILE_PATHS}"
args = [{ name = "FILE_PATHS", positional = true, multiple = true }]

[tool.poe.tasks.generate]
help = "Generate the models and definitions for a new amendment"
sequence = [
{ cmd = "python3 tools/generate_definitions.py ${FILE_OR_GITHUB_PATH}" },
{ cmd = "python3 tools/generate_tx_models.py ${FILE_OR_GITHUB_PATH}" },
]
args = [{ name = "FILE_OR_GITHUB_PATH", positional = true, required = true }]

[tool.poe.tasks.test_coverage]
sequence = [
{ cmd = "coverage run -m unittest discover" },
Expand Down
Loading