sjkingo / virtualenv-api

An API for virtualenv/pip
BSD 2-Clause "Simplified" License
130 stars 21 forks source link

Install in editable mode does not use name in setup.py #42

Open marskar opened 5 years ago

marskar commented 5 years ago

Using virtualenv-api version 2.1.17,

I can install my_package and then print the package name:

from virtualenvapi.manage import VirtualEnvironment
env = VirtualEnvironment('.')
env.install('.')
print(env.installed_package_names)

Result:

['pip', 'setuptools', 'my_package', 'wheel']

Nice!

But, doing the same in editable mode does not give me the package name in setup.py.

from virtualenvapi.manage import VirtualEnvironment
env = VirtualEnvironment('.')
env.install('-e .')
print(env.installed_package_names)

Result:

['pip', 'setuptools', '-e git+https://github.com/marskar/package_name.git@6e7d262c1d9ad5047ada8b8ad471f3f1852dad87#egg=try', 'wheel']

According to the method docstring, -e . is supported. https://github.com/sjkingo/virtualenv-api/blob/master/virtualenvapi/manage.py#L193 Is this the expected behavior?

sjkingo commented 5 years ago

Could you please paste the install_requires of your setup.py?

Thanks

marskar commented 5 years ago

Hi @sjkingo,

My setup.py did not have an install_requires.

I tried it again with an install_requires and got the same result.

I was just testing this so my setup.py was mostly empty:

import setuptools

with open("README.rst", "r") as f:
    long_desc = f.read()

setuptools.setup(
    name='try',
    version='0.0.3',
    description='Automate creation of figures, models, and plots with GNU Make.',
    long_description=long_desc,
    long_description_content_type="text/x-rst",
    author='Martin Skarzynski',
    url='https://www.github.com/marskar/try/',
    license='MIT',
    packages=setuptools.find_packages(where='src'),
    package_dir={"": "src"},
    install_requires=['jupyter'],
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
)
['appnope', 'backcall', 'bleach', 'decorator', 'defusedxml', 'entrypoints', 'ipykernel', 'ipython', 'ipython-genutils', 'ipywidgets', 'jedi', 'jinja2', 'jsonschema', 'jupyter', 'jupyter-client', 'jupyter-console', 'jupyter-core', 'markupsafe', 'mistune', 'nbconvert', 'nbformat', 'notebook', 'pandocfilters', 'parso', 'pexpect', 'pickleshare', 'pip', 'prometheus-client', 'prompt-toolkit', 'ptyprocess', 'pygments', 'python-dateutil', 'pyzmq', 'qtconsole', 'send2trash', 'setuptools', 'six', 'terminado', 'testpath', 'tornado', 'traitlets', '-e git+https://github.com/marskar/package_name.git@6e7d262c1d9ad5047ada8b8ad471f3f1852dad87#egg=try', 'wcwidth', 'webencodings', 'wheel', 'widgetsnbextension']
sjkingo commented 5 years ago

Ok, thanks - I will look into it and get back to you :)