-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
disable buidling/deployment of python wheels #583
Conversation
all the other python versions are being built and tested on https://github.com/google/brotli-wheels/blob/d571d63/appveyor.yml
…ilds All the other python versions for OSX are being built/tested on: https://github.com/google/brotli-wheels/blob/d571d63/.travis.yml Also, there's no need to build and deploy wheels here, as that's done in the separate repository.
I noticed that we were re-building the extension module three times before actually running the tests... It turns out
|
if we run 'python setup.py built test', the setuptools 'test' command will forcibly re-run the build_ext subcommand because it wants to pass the --inplace option (it ignores whether it's up to date, just re-runs it all the time). with this we go from running built_ext twice, to running it only once per build
ok.. We went from running With the last commit we call the compiler only once (384f8b6), by simply doing |
linux python 2.7 build went down from 3m 40s to 2m 12s. nice |
…target The 'develop' command is like 'install' in the sense that it modifies the user's python environment. The default make target should be less intrusive, i.e. just building the extension module in-place without modify anything in the user's environment. We don't need to tell make about the dependency between 'test' and 'build' target as that is baked in the `python setup.py test` command.
setup.py
Outdated
@@ -53,6 +55,21 @@ def get_source_files(self): | |||
return filenames | |||
|
|||
def build_extension(self, ext): | |||
if ext.sources is None or not isinstance(ext.sources, (list, tuple)): | |||
from distutils.errors import DistutilsSetupError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's okay to move this import to the top
setup.py
Outdated
@@ -15,6 +15,8 @@ | |||
from distutils.core import Extension | |||
from distutils.core import setup | |||
from distutils.command.build_ext import build_ext | |||
from distutils.dep_util import newer_group |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to import packages/modules instead of functions:
https://google.github.io/styleguide/pyguide.html#Imports
setup.py
Outdated
|
||
ext_path = self.get_ext_fullpath(ext.name) | ||
depends = ext.sources + ext.depends | ||
if not (self.force or newer_group(depends, ext_path, 'newer')): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are your thoughts on "newer"
vs the default "error"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't know.. I just copied from the default distutils build_ext
module. I thought it'd be better to keep the default behavior. But I see that with "error" we could have avoided issues like the missing comma..
python/README.md
Outdated
@@ -24,7 +24,7 @@ able to edit the source files. | |||
|
|||
For convenience, you may run the following commands from this directory: | |||
|
|||
$ make # Deploy the module in "development mode" | |||
$ make # Build the module in-place |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe leave something about "development mode" here since it's described in the paragraph right before this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I see now, sorry.. I can actually add an additional make develop
, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that sounds good to me, though perhaps we should remove the references to "development mode" in the README if the in-place build is the default.
@nicksay FYI I have modified the Makefile in 44b5e66 so that the default Also, we don't need to tell |
`make test` is good enough
This will work even if setuptools is not installed, which is unlikely nowadays but still our `setup.py` works with plain distutils, so we may well have our tests work without setuptools.
@nicksay I added the I noticed also that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the new "develop" make target as .PHONY at the top of the file? Otherwise, LGTM
remove 'tests' from .PHONY
We don't need to install custom python versions, we are using the pre-installed ones on Appveyor.
The last Travis failure is just random and unrelated, this is good to go now. |
Still LGTM 👍 |
* [appveyor] remove 'deploy' stage; only test python 2.7 and 3.6 all the other python versions are being built and tested on https://github.com/google/brotli-wheels/blob/d571d63/appveyor.yml * remove terrify submodule as not needed any more * [travis] just test py2.7 and 3.6 on linux; remove extra osx python builds All the other python versions for OSX are being built/tested on: https://github.com/google/brotli-wheels/blob/d571d63/.travis.yml Also, there's no need to build and deploy wheels here, as that's done in the separate repository. * [setup.py] only rebuild if dependency are newer; fix typo in list of 'depends' https://github.com/python/cpython/blob/v3.6.2/Lib/distutils/command/build_ext.py#L485-L500 * [ci] only run 'python setup.py test' if we run 'python setup.py built test', the setuptools 'test' command will forcibly re-run the build_ext subcommand because it wants to pass the --inplace option (it ignores whether it's up to date, just re-runs it all the time). with this we go from running built_ext twice, to running it only once per build * [Makefile] run 'build_ext --inplace' instead of 'develop' as default target The 'develop' command is like 'install' in the sense that it modifies the user's python environment. The default make target should be less intrusive, i.e. just building the extension module in-place without modify anything in the user's environment. We don't need to tell make about the dependency between 'test' and 'build' target as that is baked in the `python setup.py test` command. * [Makefile] add 'develop' target; remove unnecessary 'tests' target `make test` is good enough * [Makefile] `setup.py test` requires setuptools; run `python -m unittest` This will work even if setuptools is not installed, which is unlikely nowadays but still our `setup.py` works with plain distutils, so we may well have our tests work without setuptools. * [python/README.md] add ref to 'develop' target; remove 'tests', just 'make test' * [setup.py] import modules as per nicksay's comment google#583 (comment) * [Makefile] add 'develop' to .PHONY targets remove 'tests' from .PHONY * [appveyor] remove unused setup scripts We don't need to install custom python versions, we are using the pre-installed ones on Appveyor. * [appveyor] remove unneeded setup code
Since this is now done in a separate https://github.com/google/brotli-wheels, it makes sense remove that from the upstream brotli's Travis and Appveyor setup.
We still run
python setup.py test
on both 2.7 and 3.6 on linux and windows, as well as on the system's python on macOS.