News for hackers. Stuff that matters.
Re:How to improve Python packaging, or why 14 tools are at l... by TigerTeamX on Sunday January 15, 2023 @05:28PM (#34394297)
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.
Re:How to improve Python packaging, or why 14 tools are at l... by TigerTeamX on Sunday January 15, 2023 @05:29PM (#34394305)
This is similar to how node is doing. I just basically copied that idea.
Re:How to improve Python packaging, or why 14 tools are at l... by thinker5555 on Sunday January 15, 2023 @09:44PM (#34396209)
I 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?
Re:How to improve Python packaging, or why 14 tools are at l... by TigerTeamX on Monday January 16, 2023 @04:59AM (#34398867)
I 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.
Re:How to improve Python packaging, or why 14 tools are at l... by thinker5555 on Monday January 16, 2023 @06:44AM (#34399666)
It'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.
Re:How to improve Python packaging, or why 14 tools are at l... by theacodes on Sunday January 15, 2023 @10:54PM (#34396601)
As 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.
Re:How to improve Python packaging, or why 14 tools are at l... by TigerTeamX on Monday January 16, 2023 @04:58AM (#34398858)
Please do elaborate before digging my own grave, thanks :D
Re:How to improve Python packaging, or why 14 tools are at l... by thinker5555 on Tuesday January 17, 2023 @03:01PM (#34417968)
I 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.
Re:How to improve Python packaging, or why 14 tools are at l... by thinker5555 on Monday January 16, 2023 @06:45AM (#34399675)
I'd be curious to know what they are, as I'm interested in giving the -t flag a try myself.