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
The great tox-ification #4105
The great tox-ification #4105
Conversation
It's 'py:mod', not 'py:module'. I don't know why this wasn't caught by Sphinx itself. Signed-off-by: Stephen Finucane <stephen@that.guru>
Shuffle things around in order of most importance. The 'py27' target is removed as its completely unnecessary. Signed-off-by: Stephen Finucane <stephen@that.guru>
This isn't enabled by default because it throws so many damn errors. Perhaps we should simply remove this? Signed-off-by: Stephen Finucane <stephen@that.guru>
There is value in examining coverage for something like Sphinx. Start doing this by default, in anticipation of increasing coverage over time. Signed-off-by: Stephen Finucane <stephen@that.guru>
Nobody seems to be using this, probably because of the 'flake8' target, and it hasn't been touched, some Python/flake8 updates aside in years. Just remove it. Signed-off-by: Stephen Finucane <stephen@that.guru>
We're going to be doing some surgery on this function, so first clean it up before we do anything else. Signed-off-by: Stephen Finucane <stephen@that.guru>
cc41102
to
442daef
Compare
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.
It seems this PR includes many changes. I can accept some, but I feel worries for some. So please separate to multiple PRs if possible.
Thanks,
env: | ||
global: | ||
- TEST='-v --durations 25' | ||
- PYTHONFAULTHANDLER=x | ||
- PYTHONWARNINGS=all | ||
- SKIP_LATEX_BUILD=1 | ||
matrix: | ||
- DOCUTILS=0.13.1 | ||
- DOCUTILS=0.14 |
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.
How do you go these matrix tests?
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.
We get these and more via the du*
tests in (du11
, du12
, du13
, du14
). These are run automatically via tox. If you check the Travis log, you'll see 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.
Where can I see the result of them? It seems no du*
tasks are not executed.
https://travis-ci.org/sphinx-doc/sphinx/builds/282468735?utm_source=github_status&utm_medium=notification
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, damn - I was mistaken. Turns out you need to use Advanced Configuration to enable this. I've fixed this now.
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.
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.
Okay, I confirmed. But it seems testing time has been increased. both total time and throughput become long. Why?
Result for this: https://travis-ci.org/sphinx-doc/sphinx/builds/283292020
master branch: https://travis-ci.org/sphinx-doc/sphinx/builds/283254206
In addition, I noticed --durations 25
option for pytest has been disabled. To know which testcases are slow, I need to enable it.
@@ -1,44 +1,9 @@ | |||
PYTHON ?= python | |||
|
|||
.PHONY: all style-check type-check clean clean-pyc clean-patchfiles clean-backupfiles \ | |||
clean-generated pylint reindent test covertest build |
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.
why removing these one? we are using some targets on release process manually.
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.
This is a mistake. I'll fix this now.
EDIT: Wait - I'm removing four targets: pylint
, covertest
, style-check
and reindent
. The first three of these are now covered via tox targets while I considered the latter one, reindent
useless because we're catching things like hard tabs with flake8 already. Did I miss something?
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.
make style-check
is used on our release-checklist. So please update utils/release-checklist
also.
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.
@shimizukawa do you use these commands locally? I don't use them locally, so I don't object to remove them, but I worry about somebody uses it.
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.
@tk0miya I've updated the utils/release-checklist
document now.
@shimizukawa Please note, as mentioned above, that all but one of the targets I've removed has a (superior) replacement option in tox, and only the useless reindent
tool is removed. Hopefully if you do you use these, migrating will be possible
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.
Note: we need to notify removing these targets to all developers. I don't know who uses them. The maintainers are not only shimizukawa.
sphinx/checks.py
Outdated
@@ -0,0 +1,104 @@ | |||
# -*- coding: utf-8 -*- |
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.
Why are you moving this to under sphinx package? This file will be installed to all users' environment. I feel very strange. Is that really needed?
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 didn't think it mattered, to be honest. I know in OpenStack projects keep everything, tests and all, in the one project. Do I need to make changes here?
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 just checked and it seems this file need to be in a module. I can either make utils
a module, but that seems silly. Alternatively we can just distribute this. I don't imagine it would be any harm, to be honest.
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.
Sure, I understand this does not harm anybody. But, personally, I don't like to export meaningless packages to users. I believe this is only used for maintenance.That means it does not bring worth to users. So I'd like not to include it to the release package.
Could you move this outside of package?
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 can exclude it from the package via MANIFEST.in
. Before I do this whoever, I should point out that we package both the tests
and utils
folders. If we are packaging these, is there any reason not to package this file?
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.
Sorry, my words are wrong. It should be packaged as tarball, but not be installed as python package (sphinx.checks
).
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.
Done now
sphinx/util/smartypants.py
Outdated
See the LICENSE file and the original docutils code for details. | ||
|
||
:copyright: Copyright 2003-2010 by Günter Milde, John Gruber, | ||
Chad Miller. |
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'm not good at license and copyright. Is this modification allowed?
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.
Yup, I'm retaining the copyright and given that the license is the same as the main code, we don't need to explicitly call this out.
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.
Could you explain for clarification which "main code" you are referring too?
And how does this change relate to the general purpose of the PR?
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.
Could you explain for clarification which "main code" you are referring too?
I'm referring to the bulk of the Sphinx code: this file is licensed as BSD 2-Clause, and Sphinx itself is licensed as BSD 2-Clause. It's not possible for the latter to change without getting permission from every contributor to Sphinx, which means it's never going to happen. We're safe here.
And how does this change relate to the general purpose of the PR?
In this commit, I move a custom header check to a flake8 plugin. Previously we were able to skip this particular file from that check because it doesn't fit the standard format. However, we're not able to do this in flake8 without skipping the entire file or inserting a special check for this file in the plugin. Personally, I'd rather modify the header a small bit than do one of those two things.
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.
Thanks for explanation. For the header check, you mean flake8 compliance entailed removing all lines starting at 505e148#diff-148ee4b7705bb41cbeae2ac61d69e1d5L14 (about 12 lines)? there was no way to amend them in some less drastic way? Perhaps indeed they are redundant. Regarding copyright, the copyright notice in its original formulation is the one of the full Docutils docutils/utils/smartquotes.py
. The Sphinx smartypants.py
is a small portion of this, which is only included to backport from Docutils 0.14 some features to Sphinx users with earlier Docutils. I think most if not all of this code was contribued by Günter Milde. Thus I am not sure about the way the copyright notice is set-up here. But the previous paragraph explains the situation to some extent.
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 am a bit worried that flake8 normalization goes far here, but I am in no way knowledgeable about copyright, so I don't think this is blocking.
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.
arrggh...I meant to write: I don't know enough to argue in anyway this could be blocking.
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've just gone and skipped the file. You're right - it is taking flake8 normalization a bit far
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 only worried about merging three copyright entries to one. It seems like they are team, and worked until 2010.
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've reverted this change now and simply skipped the file. We can re-evaluate this later
I can, but these PRs need to be submitted sequentially to prevent merge conflicts (they touch pretty much the same code). Any chance you could look at the individual commits instead? |
442daef
to
79d7acd
Compare
If we want to check style, we run 'tox -e flake8': it shouldn't be necessary to run some obscure 'make' command too. Make this possible by moving the sole useful test from the target of this make command to a flake8 plugin. This includes a fix for a header that was previously excluded from checks, but is now included. Signed-off-by: Stephen Finucane <stephen@that.guru>
There are still a couple of checks here but all of them can be removed now: - Check if using valid Python syntax - Check if line length too long - Check if using 'x == None/True/False' - Check if using old HTML 3 tags The first three are already handled by default by the 'flake8' tool. The last one isn't replaced by anything, but it really isn't worth worrying about now because the tags it checks for have been dead for a really long time and would not be used by anyone writing HTML in the last 10 years. Combined, it means we can remove the entire file. The release-checklist document is update to reflect the removal of the 'style-check' target. Signed-off-by: Stephen Finucane <stephen@that.guru>
Less top-level files = winning [1]. [1] https://mypy.readthedocs.io/en/stable/config_file.html Signed-off-by: Stephen Finucane <stephen@that.guru>
While there are already some skips included here, they clearly aren't doing their job and the test fail locally. Resolve this. Signed-off-by: Stephen Finucane <stephen@that.guru>
This allows us to greatly simplify the '.travis.yml' file and eventually remove even more Makefile targets. This involves adding two new targets to the list of default targets run by tox - docs and mypy - and adding an addition 'travis' section per the 'tox-travis' docs [1] [1] https://tox-travis.readthedocs.io/en/stable/toxenv.html#advanced-configuration Signed-off-by: Stephen Finucane <stephen@that.guru>
79d7acd
to
40f320e
Compare
OK, I've pushed some further changes (GitHub Pull Requests really don't work well with rebase):
I note that the @tk0miya Anything else needed? |
-1: This PR has multiple purposes and can not be validated. Please make individual PR. |
@@ -3,7 +3,7 @@ Release checklist | |||
|
|||
* open https://travis-ci.org/sphinx-doc/sphinx/branches and check stable branch is green | |||
* Check `git status` | |||
* Run `make style-check` | |||
* Run `tox`, which will run style checks, type checks, unit tests and doc tests |
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.
Really? Did you mean our release manager should run all tests on local before release?
All tests takes very long time (see Travis, it takes a hour!).
Sigh. I blame the GitHub Pull Request model entirely for this: it completely abstracts the idea of a commit and thus both encourages poor practices (like not writing well formatted commit messages, adding extra commits to fix previously broken ones) and discourages good ones (one change per commit, using rebase and squashing fixes into previous patches). Torvalds called it right on this one. However 😄, I can split this into multiple patches. They should be incoming shortly. |
Splitting into multiple PRs. Sigh... |
Subject: Start making more use of tox in our testing infrastructure.
Feature or Bugfix
Purpose
To paraphrase the Zen of Python (
import this
):Start modernizing the test infrastructure that's using
make
and other hand-crafted tools by replacing them with tox-based derivatives.Detail
This is a multi-step process, and this PR covers the first four of these steps:
reindent
?)check_fileheader
test)There's still some other stuff left to do, which will be done in a separate PR (this one is getting pretty big):
CONTRIBUTING
document to recommend the use of toxRelates