From 2da6de67219ed86acf0e0835b5330ee3269b5011 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 4 Nov 2020 01:34:59 +0900 Subject: [PATCH 1/8] Fix #4606: autodoc: the location of the warning is incorrect for inherited method --- CHANGES | 2 ++ sphinx/ext/autodoc/__init__.py | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 99e5cdaf9..8ed105f9d 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,8 @@ Features added Bugs fixed ---------- +* #4606: autodoc: the location of the warning is incorrect for inherited method + Testing -------- diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 7343d41b6..968b483b7 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -543,9 +543,18 @@ class Documenter: yield from docstringlines def get_sourcename(self) -> str: + if (getattr(self.object, '__module__', None) and + getattr(self.object, '__qualname__', None)): + # Get the correct location of docstring from self.object + # to support inherited methods + fullname = '%s.%s' % (self.object.__module__, self.object.__qualname__) + else: + fullname = self.fullname + if self.analyzer: - return '%s:docstring of %s' % (self.analyzer.srcname, self.fullname) - return 'docstring of %s' % self.fullname + return '%s:docstring of %s' % (self.analyzer.srcname, fullname) + else: + return 'docstring of %s' % fullname def add_content(self, more_content: Any, no_docstring: bool = False) -> None: """Add content from docstrings, attribute documentation and user.""" From 155213c6c9fe96b0952f0f09fbed10d51b27c45c Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 5 Nov 2020 00:33:05 +0900 Subject: [PATCH 2/8] test: Send test-coverage data from GitHub Action --- .github/workflows/main.yml | 13 +++++++++++-- .travis.yml | 5 ----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a85e3c8fb..99c3c594c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - name: [py35, py36, py37] + name: [py35, py36, py37, py38] include: - name: py35 python: 3.5 @@ -19,6 +19,12 @@ jobs: - name: py37 python: 3.7 docutils: du14 + - name: py38 + python: 3.8 + docutils: du15 + coverage: "--cov ./ --cov-append --cov-config setup.cfg" + env: + PYTEST_ADDOPTS: ${{ matrix.coverage }} steps: - uses: actions/checkout@v2 @@ -31,9 +37,12 @@ jobs: - name: Install graphviz run: sudo apt-get install graphviz - name: Install dependencies - run: pip install -U tox + run: pip install -U tox codecov - name: Run Tox run: tox -e ${{ matrix.docutils }} -- -vv + - name: codecov + uses: codecov/codecov-action@v1 + if: matrix.coverage windows: runs-on: windows-latest diff --git a/.travis.yml b/.travis.yml index 4123ba6b5..d7162104f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,11 +11,6 @@ env: jobs: include: - - python: '3.8' - env: - - TOXENV=du15 - - PYTEST_ADDOPTS="--cov ./ --cov-append --cov-config setup.cfg" - - language: node_js node_js: '10.7' env: IS_PYTHON=false From 162a0048e525a8d5957a5e29b5e672ecebab5118 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 5 Nov 2020 01:00:54 +0900 Subject: [PATCH 3/8] tox.ini: Do not override $PYTEST_ADDOPTS forcedly --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index a61299979..316655d20 100644 --- a/tox.ini +++ b/tox.ini @@ -26,7 +26,7 @@ extras = test setenv = PYTHONWARNINGS = all,ignore::ImportWarning:importlib._bootstrap_external,ignore::DeprecationWarning:site,ignore::DeprecationWarning:distutils - PYTEST_ADDOPTS = --color yes + PYTEST_ADDOPTS = {env:PYTEST_ADDOPTS:} --color yes commands= pytest --durations 25 {posargs} From c85335941775dadf386bc13eda81e2dfb8b70c2a Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 5 Nov 2020 01:17:41 +0900 Subject: [PATCH 4/8] tox.ini: Clean up --- .travis.yml | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index d7162104f..4ce005276 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,11 @@ os: linux dist: xenial -language: python -cache: pip - -env: - global: - - PYTHONFAULTHANDLER=x - - SKIP_LATEX_BUILD=1 - - IS_PYTHON=true - -jobs: - include: - - language: node_js - node_js: '10.7' - env: IS_PYTHON=false - services: xvfb +language: node_js +node_js: '10.7' +services: xvfb install: - - "sudo apt-get install graphviz" - - if [ $IS_PYTHON = true ]; then pip install -U tox codecov; fi - - if [ $IS_PYTHON = false ]; then npm install; fi + - npm install script: - - if [ $IS_PYTHON = true ]; then tox -- -vv; fi - - if [ $IS_PYTHON = false ]; then npm test; fi - -after_success: - - if [[ -e .coverage ]]; then codecov -e $TOXENV; fi + - npm test From 6d522c5483c0cdea11c6008a4305eb10636c74dd Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 5 Nov 2020 01:33:00 +0900 Subject: [PATCH 5/8] test: Do "npm test" on GitHub Actions --- .github/workflows/nodejs.yml | 21 +++++++++++++++++++++ .travis.yml | 11 ----------- 2 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/nodejs.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 000000000..d7a7c95f1 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,21 @@ +name: CI (node.js) + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + env: + node-version: 10.7 + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ env.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.node-version }} + - run: npm install + - name: Run headless test + uses: GabrielBB/xvfb-action@v1 + with: + run: npm test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4ce005276..000000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -os: linux -dist: xenial -language: node_js -node_js: '10.7' -services: xvfb - -install: - - npm install - -script: - - npm test From f12451f304812c668f7409ec06161e958464ec8e Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 4 Nov 2020 02:42:59 +0900 Subject: [PATCH 6/8] test: Do test with py39 --- .github/workflows/main.yml | 5 ++++- setup.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 99c3c594c..0159ac34d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - name: [py35, py36, py37, py38] + name: [py35, py36, py37, py38, py39] include: - name: py35 python: 3.5 @@ -22,6 +22,9 @@ jobs: - name: py38 python: 3.8 docutils: du15 + - name: py39 + python: 3.9 + docutils: du16 coverage: "--cov ./ --cov-append --cov-config setup.cfg" env: PYTEST_ADDOPTS: ${{ matrix.coverage }} diff --git a/setup.py b/setup.py index 8505d2679..27bbb3ae0 100644 --- a/setup.py +++ b/setup.py @@ -203,6 +203,7 @@ setup( 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Framework :: Setuptools Plugin', From cad02e62e6e929d81a3f8040f9e60af7b6273118 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 5 Nov 2020 23:52:59 +0900 Subject: [PATCH 7/8] Fix #8375: URL of transifex project page --- doc/internals/contributing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/internals/contributing.rst b/doc/internals/contributing.rst index 1f4a31013..a52e6e72d 100644 --- a/doc/internals/contributing.rst +++ b/doc/internals/contributing.rst @@ -272,9 +272,9 @@ identifier and put ``sphinx.po`` in there. Don't forget to update the possible values for :confval:`language` in ``doc/usage/configuration.rst``. The Sphinx core messages can also be translated on `Transifex -`_. There ``tx`` client tool, which is -provided by the ``transifex_client`` Python package, can be used to pull -translations in ``.po`` format from Transifex. To do this, go to +`_. There ``tx`` client tool, +which is provided by the ``transifex_client`` Python package, can be used to +pull translations in ``.po`` format from Transifex. To do this, go to ``sphinx/locale`` and then run ``tx pull -f -l LANG`` where ``LANG`` is an existing language identifier. It is good practice to run ``python setup.py update_catalog`` afterwards to make sure the ``.po`` file has the canonical From fa8bec76e7fe38f1e99c70094b6db099f32dce31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Freitag?= Date: Sat, 7 Nov 2020 11:21:34 +0100 Subject: [PATCH 8/8] Drop Python 3.4 compatibility code Python 3.4 support was dropped in Sphinx 2.0. --- sphinx/util/inspect.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index f2cd8070b..66eac1c61 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -62,14 +62,6 @@ def getargspec(func: Callable) -> Any: methods.""" warnings.warn('sphinx.ext.inspect.getargspec() is deprecated', RemovedInSphinx50Warning, stacklevel=2) - # On 3.5+, signature(int) or similar raises ValueError. On 3.4, it - # succeeds with a bogus signature. We want a TypeError uniformly, to - # match historical behavior. - if (isinstance(func, type) and - is_builtin_class_method(func, "__new__") and - is_builtin_class_method(func, "__init__")): - raise TypeError( - "can't compute signature for built-in type {}".format(func)) sig = inspect.signature(func)