Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't erase {toxinidir}/build before building wheels #11

Open
wkschwartz opened this issue Oct 28, 2020 · 2 comments
Open

Don't erase {toxinidir}/build before building wheels #11

wkschwartz opened this issue Oct 28, 2020 · 2 comments

Comments

@wkschwartz
Copy link

Problem description

Currently tox-wheel erases {toxinidir}/build before building each wheel:

if not (session.config.option.wheel_dirty or venv.envconfig.wheel_dirty):
action.setactivity("wheel-make", "cleaning up build directory ...")
ensure_empty_dir(config.setupdir.join("build"))

Reason why it's a problem

First, this is surprising because tox-wheel doesn't even use {toxinidir}/build for building the wheel, but rather, as far as I can tell, a temporary directory. Below is an excerpt from my project, where I've replaced path names with Tox's default replacement strings (both for clarity and privacy), and $PROJECT expands to the name of my repo/python package.

py37 wheel-make: cleaning up build directory ...
py37 wheel-make: commands[0] | pip wheel {toxinidir} --no-deps --use-pep517 --wheel-dir {distdir}
Processing {toxinidir}
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: $PROJECT
  Building wheel for $PROJECT (PEP 517) ... done
  Created wheel for $PROJECT: filename=$PROJECT-0.2.1a2-cp37-cp37m-macosx_10_15_x86_64.whl size=309868 sha256=76841ab8e13429d01f6202837d68f40c41bbab0a55595749e2e025437edbf67d
  Stored in directory: $TMPDIR/pip-ephem-wheel-cache-ohcb3mrr/wheels/f0/c9/6f/94a5b198d43f57591a66ce6b5b8e653c5b2d8710935b7af19e
Successfully built $PROJECT
py37 inst-nodeps: {toxworkdir}/.tmp/package/12/$PROJECT-0.2.1a2-cp37-cp37m-macosx_10_15_x86_64.whl

And here is the relevant line of code:

commands=[["pip", "wheel", config.setupdir, "--no-deps", "--use-pep517", "--wheel-dir", config.distdir]],

Second, this behavior is upsetting because I had been building my documentation in {toxinidir}/build/docs—perhaps foolishly—but it means that in my current set up, every time I run my tests, navigating in my documentation in the browser causes the documentation to disappear since the file isn't there anymore.

Expected behavior

I understand building a wheel in a clean directory is helpful, but that should take place in the same places that Tox itself builds sdists, which I think is {toxworkdir}, or perhaps the {envtmpdir} for which the wheel is being built. This avoid stomping on "user visible" directories outside the {toxworkdir} (.tox/).

@ionelmc
Copy link
Owner

ionelmc commented Oct 28, 2020

The build dir cleaning was done for non-pep517 building - yes, it's only necessary there. I'll fix this.

@graingert
Copy link
Contributor

@wkschwartz was this fixed for you in #9 (released in 0.6.0) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants