Open zacharymostowsky opened 3 years ago
Hi! Thanks for the suggestion. I think this is generally better handled by your terminals own globbing. What shell/OS are you running?
Would something like this work?:
sort-requirements requirements/**/requirements*.txt
Hey thanks for the quick response. I am using bash shell on a mixture of ubuntu and Windows (use Git Bash in Windows). We can certainly use find
or another utility to glob on command line and that works well for a CI pipeline or some other script. But, I was hoping to make life a little easier for developers where the functionality would work in a manner similar to pylama
and black
. These tools recursively search a given path for python files. I thought we could do something similar where by default the tool searches for *requirements.txt
but a user could override to provide any glob you want essentially.
This worked for me btw, in case others are interested.
find . -iname 'requirements*.txt' -exec sort-requirements {} +
Let me take some time to explore how black
and pylama
handle this. I assume they use something like --include
and --exclude
options to specify pattern matching?
I think I want to come up with a spec that feels consistent with out Python CLI tools so that the functionality is more intuitive.
My other concern is making sure I can do this easily in Python without adding dependencies. My goal with this tool was to have it be free from dependence on other libraries. I think Python's built-in glob
should work but I need to poke around and find out for certain.
In the meanwhile (and at the risk of shameless self promotion) another solution that could give your developers a more consistent easy interface is to use this tool my other project: https://github.com/rehandalal/therapist
Thanks, @rehandalal. I will check out therapist as well. If you didn't want to change the default functionality of sort-requirements, maybe just an optional flag you can provide a ,
separated list of globs to or something like that. Agreed about dependencies. I think the glob
module would work fine for this.
Hello,
Thanks a bunch for this library. I have a use case where there are many
requirements.txt
(andrequirements-devel.txt
) in my repo. I was was wondering if you would be open to functionality for recursively searching a directory tree, finding the files that match the glob, and then do the checks on those?Thanks, Zach