pypa / flit

Simplified packaging of Python modules
https://flit.pypa.io/
BSD 3-Clause "New" or "Revised" License
2.16k stars 134 forks source link

Unexpected behavior with virtualenvs #424

Open dougransom opened 3 years ago

dougransom commented 3 years ago

On windows, flit install flit install --symlink flit install --env flit install --python = c:\users\dougr\onedrive\doug\codingprojects\dt\nl\scripts\python.exe

All install in the base python instead of the virtual environment.

The workaround is

 flit build --no-setup-py
 pip install .\dist\natlink-0.0.0.1.8-py3-none-any.whl

which is rather cumbersome.

More information on python (from the [pyenvutils](https://pypi.org/project/pyenvutils/ module also packaged with flit).

Platform: "win32"
Python version: "3.8"
Current installation scheme: "nt"

Paths:
        data = "c:\users\dougr\onedrive\doug\codingprojects\dt\nl"
        include = "C:\Python38-32\Include"
        platinclude = "C:\Python38-32\Include"
        platlib = "c:\users\dougr\onedrive\doug\codingprojects\dt\nl\Lib\site-packages"
        platstdlib = "c:\users\dougr\onedrive\doug\codingprojects\dt\nl\Lib"
        purelib = "c:\users\dougr\onedrive\doug\codingprojects\dt\nl\Lib\site-packages"
        scripts = "c:\users\dougr\onedrive\doug\codingprojects\dt\nl\Scripts"
        stdlib = "C:\Python38-32\Lib"

Variables:
        BINDIR = "C:\Users\dougr\OneDrive\doug\codingprojects\dt\nl\Scripts"
        BINLIBDEST = "c:\users\dougr\onedrive\doug\codingprojects\dt\nl\Lib"
        EXE = ".exe"
        EXT_SUFFIX = ".cp38-win32.pyd"
        INCLUDEPY = "C:\Python38-32\Include"
        LIBDEST = "C:\Python38-32\Lib"
        SO = ".cp38-win32.pyd"
        VERSION = "38"
        abiflags = ""
        base = "c:\users\dougr\onedrive\doug\codingprojects\dt\nl"
        exec_prefix = "c:\users\dougr\onedrive\doug\codingprojects\dt\nl"
        installed_base = "C:\Python38-32"
        installed_platbase = "C:\Python38-32"
        platbase = "c:\users\dougr\onedrive\doug\codingprojects\dt\nl"
        prefix = "c:\users\dougr\onedrive\doug\codingprojects\dt\nl"
        projectbase = "C:\Users\dougr\OneDrive\doug\codingprojects\dt\nl\Scripts"
        py_version = "3.8.10"
        py_version_nodot = "38"
        py_version_short = "3.8"
        srcdir = "C:\Users\dougr\OneDrive\doug\codingprojects\dt\nl\Scripts"
        userbase = "C:\Users\dougr\AppData\Roaming\Python"
(nl) PS C:\users\dougr\OneDrive\doug\codingprojects\dt\natlinkkb100\natlink>
takluyver commented 3 years ago

Hmm. I've got a feeling I remember that there's something odd about the way virtualenvs work on Windows, but I don't remember what it is. :confused:

Does pip install . work? That should now automatically make a wheel and then install it for you. One day, flit install will probably go away in favour of using pip directly.

dougransom commented 3 years ago

If flit install goes away, will we be able to still use the simlink trick so that we can develop inner development space and run in site-packages?

Our would I be better just to add my project to the Python path?

From: Thomas Kluyver @.> Sent: Saturday, July 31, 2021 12:22 PM To: takluyver/flit @.> Cc: Doug Ransom @.>; Author @.> Subject: Re: [takluyver/flit] Unexpected behavior with virtualenvs (#424)

Hmm. I've got a feeling I remember that there's something odd about the way virtualenvs work on Windows, but I don't remember what it is. šŸ˜•

Does pip install . work? That should now automatically make a wheel and then install it for you. One day, flit install will probably go away in favour of using pip directly.

ā€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftakluyver%2Fflit%2Fissues%2F424%23issuecomment-890393594&data=04%7C01%7C%7Ca3377d5e2acc45cdbe9d08d9545877d0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637633561202147420%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=IC6nGShB4gGbbtBuQgouXYH87aE9OzNIZFeOgss9KqY%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA262UVRASWFQU7B3OVR3P3T2RENLANCNFSM5A3CMT3A&data=04%7C01%7C%7Ca3377d5e2acc45cdbe9d08d9545877d0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637633561202147420%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=CUVXSodOyRD9HTIodX6R7tjKPqxN6sbxYPq6%2FswVmic%3D&reserved=0.

takluyver commented 3 years ago

There's work towards a standardised mechanism for editable installs, so pip install -e . will work - this is PEP 660, and PR #400 here.

That said, I may still keep the symlink trick around, so long as it's not too much work to maintain, because it appeals to me more than the .pth files we'll use for the standardised hook.

dougransom commented 3 years ago

Interesting.

Are you aware of a took that can take the data from an existing (non-flit generates) setup.py to make a pyroject.toml, to facilitate the switch to flit?

Get Outlook for iOShttps://aka.ms/o0ukef


From: Thomas Kluyver @.> Sent: Friday, August 6, 2021 5:27:50 AM To: takluyver/flit @.> Cc: Doug Ransom @.>; Author @.> Subject: Re: [takluyver/flit] Unexpected behavior with virtualenvs (#424)

There's work towards a standardised mechanism for editable installs, so pip install -e . will work - this is PEP 660https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.python.org%2Fdev%2Fpeps%2Fpep-0660%2F&data=04%7C01%7C%7C4fcffb1babda4e75392b08d958d59ca2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637638496749017645%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kDIqxxy1NcbfHvNAOHIVoOY682fAU0lxkfAzIkgJSpg%3D&reserved=0, and PR #400https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftakluyver%2Fflit%2Fpull%2F400&data=04%7C01%7C%7C4fcffb1babda4e75392b08d958d59ca2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637638496749017645%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3d6HgjEHZUaCGny2RIWmN%2Bp9qMzYGXDckVzMkNh8MNg%3D&reserved=0 here.

That said, I may still keep the symlink trick around, so long as it's not too much work to maintain, because it appeals to me more than the .pth files we'll use for the standardised hook.

ā€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftakluyver%2Fflit%2Fissues%2F424%23issuecomment-894225709&data=04%7C01%7C%7C4fcffb1babda4e75392b08d958d59ca2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637638496749027600%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=XpJWadgn%2Ffa4Coevyt1ugaO%2B3ZhNToBbjdW8998k%2B1I%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA262UWL2UQ7POLW5U32MKLT3PIMNANCNFSM5A3CMT3A&data=04%7C01%7C%7C4fcffb1babda4e75392b08d958d59ca2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637638496749027600%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=u7PL6NyR3XyQYafWLs%2BMr6iwszUr9yaIu2ZGnMERs6M%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7C%7C4fcffb1babda4e75392b08d958d59ca2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637638496749037553%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=1WTavTk80HQgHxU%2FBblXPLoXvRdM2T9ypoPqRwBPMoI%3D&reserved=0 or Androidhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26utm_campaign%3Dnotification-email&data=04%7C01%7C%7C4fcffb1babda4e75392b08d958d59ca2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637638496749037553%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kPkCSAJvJZfwEs3NPLhqJ9HEdf13udHibFNxDrqg1aU%3D&reserved=0.

takluyver commented 3 years ago

I'm not aware of anything like that; let me know if you find/make one. :slightly_smiling_face:

dougransom commented 3 years ago

I'm not aware of anything like that; let me know if you find/make one. šŸ™‚

Hm. I think most if the information for a published package on pypi is available through this api:

https://warehouse.readthedocs.io/api-reference/json.html#project