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

CLI: Allow watching custom include / exclude patterns [feature-request] #594

Closed
nhairs opened this issue Dec 13, 2023 · 2 comments · Fixed by #598
Closed

CLI: Allow watching custom include / exclude patterns [feature-request] #594

nhairs opened this issue Dec 13, 2023 · 2 comments · Fixed by #598

Comments

@nhairs
Copy link
Contributor

nhairs commented Dec 13, 2023

First of all, great project :)

Currently the CLI reloader only allows specifying the base path path to watch for changes (--watch path/to/watch). However the watcher is configured so that it only listens to changes on *.py files (source code).

I would like to be able to use the reloader with changes to other files such as configuration files.

It might look like the following:

        # cli.py
        parser.add_argument(
            "-i",
            "--watch-include",
            action="append",
            dest="include_patterns",
            help="Additional patterns to watch for changes",
        )

        parser.add_argument(
            "-x",
            "--watch-exclude",
            action="append",
            dest="exclude_patterns",
            help="Patterns to ignore for changes",
        )

Which would then be used like:

dramatiq [...] --watch path/to/watch -i *.yml -i templates/*.html -x templates/*.png

Aside: in documentation / help strings it might be worth noting that prior to Python 3.13 these patterns only support multiple name (**) globbing at the start of the pattern (ref)

@Bogdanp
Copy link
Owner

Bogdanp commented Dec 17, 2023

Sounds like a good idea to me. Are you willing to send a PR?

@nhairs
Copy link
Contributor Author

nhairs commented Dec 18, 2023

Honestly not a big fan of handing over copyright of my code to a company which is releasing the code under a restrictive licence like LGPL.

Even for a small amount of code that would be required for this sort of PR, this is code I've already written in my own projects - which by handing over copyright and then receiving the code under LGPL means I can no longer use the code I've written (the code is not some internal patch for Dramatiq but a different project).

I'd be less concerned if it was released under a permissive licence like MIT, Apache 2.0, BSD 2/3 Clause, but ideally I'd prefer to retain ownership of any contributions and instead ensure that the contribution is made under a permissive licence.

nhairs added a commit to nhairs/dramatiq that referenced this issue Jan 11, 2024
@nhairs nhairs mentioned this issue Jan 11, 2024
Bogdanp pushed a commit that referenced this issue Jan 13, 2024
* CLI watcher support include, exclude patterns.

Fixes: #594

* Update contributors

* Fix accidental change to CONTRIBUTORS
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

Successfully merging a pull request may close this issue.

2 participants