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

Support for pre-/post-hooks in Rye custom scripts #1243

Open
SamoylovMD opened this issue Jul 19, 2024 · 0 comments
Open

Support for pre-/post-hooks in Rye custom scripts #1243

SamoylovMD opened this issue Jul 19, 2024 · 0 comments

Comments

@SamoylovMD
Copy link

tool.rye.scripts looks promising as it helps to automate some parts of my development process.
However, I found it lacking pre-or post- hooks for commands.
For example, I want to run a test suite in my project, which depends on a local service which I run via Docker, and after the test suite succeeds or fails, I want to stop local services and clean up everything, keeping my development environment clean.
The catch is to perform post-hook in a separate shell/process to have a robust way to clean up regardless of how badly the main script failed.

This functionality could look like this:

[tool.rye.scripts]
pre_itest = { chain = [ "my_server:build", "my_server:run" ]
my_server:build = "docker build ..."
my_server:run = "docker run my_server"
itest = "pytest -s intg"
post_itest = "docker stop my_server"

so the whole process would be called by a single command rye run itest.

The similar functionality is present in PDM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant