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

add: run pre- and post- tasks #24

Closed
2 tasks
metaist opened this issue Jul 24, 2024 · 2 comments
Closed
2 tasks

add: run pre- and post- tasks #24

metaist opened this issue Jul 24, 2024 · 2 comments

Comments

@metaist
Copy link
Owner

metaist commented Jul 24, 2024

  • add pre[-_]?{name} and post[-_]?{name} tasks
  • add cli options: -s, --skip-prepost to skip both pre- and post-tasks

Later consider:

  • options to skip just pre- or post-tasks (--skip-pre, --skip-post)
  • whether to read this behavior from a project-specific or global configuration file

History
Lots of tools (npm, yarn, pnpm, pdm, etc.) look for task names that run before and after a particular task.

  • node tools use pre{name} and post{name}
  • python tools use pre_{name} and post_{name}
  • tools have some way of skipping these types of tasks
    • some tools let you choose whether to skip just the pre-tasks or just the post-tasks (e.g., pdm
@metaist
Copy link
Owner Author

metaist commented Jul 24, 2024

At first I was just going to implement this the way npm does. But on reflection, this actually contradicts the principle of visibility. npm does lifecycle things because it has all kinds of special situations in which it runs pre- and post-hooks.

Also package.json doesn't make it easy to have composite tasks so having pre- and post- hooks makes defining things a little easier.

We can be more explicit:

clean = "rm -rf build/"
pre-build = ["clean"]
build_wheel = "python -m build"
build = ["pre-build", "build_wheel"]

This way you can specify what needs to happen in what order exactly with minimal magic. I'll revisit this in the future if it seems necessary.

@metaist metaist closed this as completed Jul 24, 2024
@metaist metaist reopened this Aug 27, 2024
@metaist
Copy link
Owner Author

metaist commented Aug 27, 2024

My thoughts on this have changed. Going to add --pre and --post args as experimental.

This issue was closed.
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