Skip to content

Egg-info location incorrect for modified package_dir in setup.py #464

@selimb

Description

@selimb

My Setup

My package lies inside an src directory. This decision was inspired by Ionel's blog post.
The parts of my config relevant to this issue are:
In setup.py

setup(
  packages=find_packages('src'),
  package_dir={'': 'src'},

tox.ini:

[testenv]
usedevelop=True

Problem

I noticed that develop-inst-nodeps was being run on every call to tox, even though the docs mention:

There is an optimization coded in to not bother re-running the command if $projectname.egg-info is newer than setup.py or setup.cfg.

This is because it only looks for the egg-info in the same directory as setup.py. However, it seems to me setup.py develop outputs egg-info to the package_dir, in my case src. Here is the relevant part of the tox code (in venv.py):

setup_py = setupdir.join('setup.py')
egg_info = setupdir.join('.'.join((name, 'egg-info')))

Suggestions

Of course, it could be I'm just missing something and that this is not the recommended approach. Assuming this is indeed a bug, here are my suggestions.

The best way would be to find out what package_dir is and look for egg-info in that directory. After a bit of digging it doesn't seem it can simply be extracted from the python setup.py command (like --name for instance). Then, one could either parse the setup.py file or the output of python setup.py develop, both of which I think are quite messy.

The other, much much simpler way, is to allow a package_dir key in tox.ini. This results in duplicated information...but how often is that setting likely to be changed?

I'd be up for submitting a PR for the latter approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions