ionelmc / tox-wheel

A Tox plugin that builds and installs wheels instead of sdist. Note that this plugin is obsolte as tox 4.0 already has wheel support.
BSD 2-Clause "Simplified" License
23 stars 10 forks source link

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

Open wkschwartz opened 3 years ago

wkschwartz commented 3 years ago

Problem description

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

https://github.com/ionelmc/tox-wheel/blob/97a9e898390c951a94d18d7c89132847e4c108df/src/tox_wheel/plugin.py#L146-L148

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:

https://github.com/ionelmc/tox-wheel/blob/97a9e898390c951a94d18d7c89132847e4c108df/src/tox_wheel/plugin.py#L152

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 commented 3 years ago

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

graingert commented 2 years ago

@wkschwartz was this fixed for you in https://github.com/ionelmc/tox-wheel/pull/9 (released in 0.6.0) ?