4 ms·
I must admit I just gave up on all these tools. Instead I just do pip install -r requirements.txt -t .lib and I have import sys import os sy
by TigerTeamX 4y ago
I must admit I just gave up on all these tools. Instead I just do
pip install -r requirements.txt -t .lib
and I have
import sys
import os
sys.path.append(f"{os.getcwd()}/.lib")
in the top of my script. Some will tell me this is silly, but it just works. Rememer to at .lib to your .gitignore. Else you'll have lot of fun.
- TigerTeamX 4y agoThis is similar to how node is doing. I just basically copied that idea.
- thinker5555 4y agoI tinkered with this a little, and it's interesting. But what about using pip list or pip freeze? They don't show the packages in the .lib directory. Do you just add them by hand to the requirements.txt?
- TigerTeamX 4y agoI add them by hand to requirements.txt and I try to keep it as minimum as possible. Yes it makes it not 100% reproducible, but it forces me to think about each dependency and I can see in my git log why it was added.
- thinker5555 4y agoIt's funny how "pip help list" or "pip help freeze" works. :-) I found I can add --path .lib to list/freeze those. It's an extra step, but not too terrible.
- theacodes 4y agoAs the person who implemented the -t flag and knows the horrendously sharp edge cases that it fails on, all I can say is bless your heart.
- TigerTeamX 4y agoPlease do elaborate before digging my own grave, thanks :D
- thinker5555 4y agoI did some looking around, and it sounds like it fails to work correctly with namespace packages. Something about the way you have to add them to the path leads to them being later in the path, so there could be times where they don't get found because something earlier in the path gets used instead.
- thinker5555 4y agoI'd be curious to know what they are, as I'm interested in giving the -t flag a try myself.