Skip to content
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

dev: add definitions.json generation script #772

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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