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

enable isolated build (PEP-517 for tox) #6175

Merged
merged 1 commit into from Feb 26, 2019
Merged

Conversation

@gaborbernat
Copy link
Contributor

@gaborbernat gaborbernat commented Jan 10, 2019

https://tox.readthedocs.io/en/latest/example/package.html#packaging 👍

pyproject.toml Outdated Show resolved Hide resolved
@msullivan
Copy link
Collaborator

@msullivan msullivan commented Jan 11, 2019

I don't have a super clear understanding of what this actually changes?

@gaborbernat
Copy link
Contributor Author

@gaborbernat gaborbernat commented Jan 11, 2019

@msullivan you would need to read the PEP-517 and PEP-518 to understand clearly, but simply put ensures that the package build dependencies specified in pyproject.toml are satisfied before packaging the library.

@gaborbernat
Copy link
Contributor Author

@gaborbernat gaborbernat commented Jan 26, 2019

Any chance of a merge on this?

@gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Jan 27, 2019

@gaborbernat
Copy link
Contributor Author

@gaborbernat gaborbernat commented Jan 27, 2019

Without this, the tox packaging build will silently ignore the pyproject.toml and use whatever the tox host environment has, so for users who have an old wheel/setuptools laying around the tox builds might possibly fail.

In parallel, although pip, for now, does default to using setuptools with PEP-517 if the key is not specified we should note that in the PEP-517 this default is not mandated, so it's not guaranteed to work with all build frontends (and pip itself can decide to not activate PEP-517 if this key is missing). This is in the spirit of explicit is better than implicit, in the true spirit of the Python zen.

Long story short while this might not be a must have, it's definitely a should have.

@gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Jan 27, 2019

I'm sorry, I still don't follow. If you're asking us to read and understand PEP 517/518, you will have to wait forever, so please bear with us and help us understand, and hopefully we'll feel comfortable that this PR solves a problem for more people than just you yourself.

For context, while I am an avid pip user, I don't understand much about what it does under the covers any more, and I don't understand at all what tox does or why. (At some point someone convinced us to use it in our .travis.yml and appyeyor.yml files, but I don't recall why.)

Given that context, can you explain what a "tox packaging build" is? I see our pyproject.toml but I don't know what it means -- like so much in the packaging world, it looks like pure cargo-cult to me: "don't ask questions, just put this there else 'things' won't work". Also, what is the "key" you are referring to? And what is a "build frontend"?

Finally, don't go quoting the Zen of Python to me. Following rules without understanding was never meant to be part of it.

@gaborbernat
Copy link
Contributor Author

@gaborbernat gaborbernat commented Jan 27, 2019

I'm sorry, my bad, I assumed you would be more familiar with the PEP-517/518.
I'll write up a short-ish summary of what the problems without PEP-517/518 and get back to you in a few days. Thanks for your patience and understanding!

@gaborbernat
Copy link
Contributor Author

@gaborbernat gaborbernat commented Feb 7, 2019

Hello, thanks for being patient with me on this, I wrote a blog post explaining what happens more in detail: https://www.bernat.tech/pep-517-518/ Hope this clears up things. Thanks!

@msullivan
Copy link
Collaborator

@msullivan msullivan commented Feb 8, 2019

Hm, it seems like this will break pip install from the source directory, right?

@gaborbernat
Copy link
Contributor Author

@gaborbernat gaborbernat commented Feb 8, 2019

Not if we ammend to prepend the sys path at the start of setup.py 😎

@msullivan
Copy link
Collaborator

@msullivan msullivan commented Feb 8, 2019

OK, can you update this PR to do that?

@gaborbernat
Copy link
Contributor Author

@gaborbernat gaborbernat commented Feb 8, 2019

yeah will do 😊

@gaborbernat gaborbernat force-pushed the isolated branch 2 times, most recently from b502f1e to 5af06ce Feb 11, 2019
@gaborbernat
Copy link
Contributor Author

@gaborbernat gaborbernat commented Feb 11, 2019

@msullivan addressed, ready for review 👍

Copy link
Collaborator

@msullivan msullivan left a comment

Alright, we can take this.

You tested pip install from a source directory?

@msullivan
Copy link
Collaborator

@msullivan msullivan commented Feb 14, 2019

@gaborbernat I tried a pip install . from the mypy directory and it is still busted.

(asdf) msullivan@enki:~/src/mypy [isolated+]
$ pip install .
Processing /home/msullivan/src/mypy
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  Complete output from command /home/msullivan/src/mypy/asdf/bin/python3.7 /home/msullivan/src/mypy/asdf/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp439qg31b:
  Traceback (most recent call last):
    File "/home/msullivan/src/mypy/asdf/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
      main()
    File "/home/msullivan/src/mypy/asdf/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/msullivan/src/mypy/asdf/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 54, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-f4k7nrmc/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 130, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-f4k7nrmc/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 112, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-f4k7nrmc/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 126, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 20, in <module>
      from mypy.version import __version__ as version
  ModuleNotFoundError: No module named 'mypy'
  
  ----------------------------------------
Command "/home/msullivan/src/mypy/asdf/bin/python3.7 /home/msullivan/src/mypy/asdf/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp439qg31b" failed with error code 1 in /tmp/pip-req-build-d22a3xxy

Copy link
Collaborator

@msullivan msullivan left a comment

Doesn't work from pip install .

@gaborbernat gaborbernat force-pushed the isolated branch 2 times, most recently from 4ed35a5 to 3026120 Feb 20, 2019
@gaborbernat
Copy link
Contributor Author

@gaborbernat gaborbernat commented Feb 20, 2019

@msullivan indeed, fixed now 👍

@msullivan msullivan merged commit d8202c3 into python:master Feb 26, 2019
1 check passed
@msullivan msullivan mentioned this pull request Feb 27, 2019
msullivan added a commit that referenced this issue Feb 27, 2019
PR #6175 broke travis with some bogus indentation.
Fix that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants