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

Docs: ⬆️ Update sphinx + extensions versions #4470

Merged
merged 11 commits into from
Oct 20, 2020

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Oct 19, 2020

In, particular sphinx v2 -> v3

Also moved sphinxext testing to the official sphinx testing infrastructure

fixes #3689

Also moved sphinxext testing to the official sphinx testing infrastructure
@chrisjsewell chrisjsewell changed the title Docs: ⬆️ Updata sphinx version + extensions Docs: ⬆️ Update sphinx version + extensions Oct 19, 2020
@codecov
Copy link

codecov bot commented Oct 19, 2020

Codecov Report

Merging #4470 into develop will decrease coverage by 0.02%.
The diff coverage is 77.78%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4470      +/-   ##
===========================================
- Coverage    79.29%   79.27%   -0.01%     
===========================================
  Files          475      475              
  Lines        34835    34837       +2     
===========================================
- Hits         27618    27614       -4     
- Misses        7217     7223       +6     
Flag Coverage Δ
#django 73.12% <77.78%> (-0.01%) ⬇️
#sqlalchemy 72.34% <77.78%> (-<0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiida/tools/groups/paths.py 91.62% <ø> (ø)
aiida/orm/nodes/data/list.py 79.27% <50.00%> (-0.97%) ⬇️
aiida/sphinxext/calcjob.py 93.34% <66.67%> (-6.66%) ⬇️
aiida/sphinxext/workchain.py 93.34% <66.67%> (-6.66%) ⬇️
aiida/sphinxext/process.py 95.14% <90.00%> (-0.66%) ⬇️
aiida/engine/daemon/runner.py 79.32% <0.00%> (-3.44%) ⬇️
aiida/transports/plugins/local.py 82.57% <0.00%> (-0.25%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2174924...446d1a3. Read the comment docs.

@chrisjsewell
Copy link
Member Author

@csadorf can you review this, with respect to dependency changes ta. I updated the requirements as mentioned in: #4466 (comment)

@chrisjsewell
Copy link
Member Author

chrisjsewell commented Oct 19, 2020

@ltalirz and @greschd do you want to check the sphinx extension side of this PR

I will also have a look at #3300 and #3689 in a bit and see if they can be closed done

(I'm tempted to change the dropdown implementation to https://sphinx-panels.readthedocs.io/en/latest/#dropdown-usage, but I don't know if I'll have time right now)

@@ -27,8 +29,7 @@ class AiidaCalcJobDocumenter(AiidaProcessDocumenter):

@classmethod
def can_document_member(cls, member, membername, isattr, parent):
from aiida.engine import CalcJob
return issubclass(cls, CalcJob)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found your error @ltalirz 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks a lot Chris!

@greschd
Copy link
Member

greschd commented Oct 19, 2020

Also moved sphinxext testing to the official sphinx testing infrastructure

Is there an easy way to manually check the HTML output with the official testing infra? That was the reason for that Makefile.

@chrisjsewell
Copy link
Member Author

Is there an easy way to manually check the HTML output with the official testing infra? That was the reason for that Makefile.

I generally use beautifulsoup + pytest-regressions: https://github.com/executablebooks/MyST-Parser/blob/750ea18db6e7eccc147e3bf45921ac4eb6715ab5/tests/test_sphinx/conftest.py#L80

@greschd
Copy link
Member

greschd commented Oct 19, 2020

Not sure if that answers my question (maybe I'm just being dense): Can I create the HTML output of the "test documentations" without changing the test code?

@chrisjsewell
Copy link
Member Author

Gah-damn, now that #3689 is fixed, you need to reference the processes with their new object types e.g. :py:process: or :process:, not :py:class: or :class:

ltalirz
ltalirz previously approved these changes Oct 19, 2020
Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot @chrisjsewell !

Just a couple of comments & minor questions.

@greschd Please also let us know whether you're happy with this solution.

@@ -77,15 +77,18 @@ def remove(self, value):
del self[value]

def pop(self, **kwargs): # pylint: disable=arguments-differ
"""Remove and return item at index (default last)."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That function does not seem to return anything or am I wrong?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yeh good point it should actually return; thats a bug in the code I would say.

Its a bit out of scope of this PR, so perhaps we should fix in another small PR.
(I only actually made this change to fix a warning by sphinx about the inherited docstring)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you - in any case, the docstring should be consistent and if you prefer not to fix it here, we should open an issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I've fixed it here then 446d1a3

@@ -257,7 +257,7 @@ def walk_nodes(

:param filters: filters to apply to the node query
:param node_class: return only nodes of a certain class (or list of classes)
:param int batch_size: The size of the batches to ask the backend to batch results in subcollections.
:param query_batch: The size of the batches to ask the backend to batch results in subcollections.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

batch_size might actually be the better name; anyhow it's fine to adapt the docs instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeh it probably should be, but thats outside the scope of this PR

docs/source/conf.py Show resolved Hide resolved
tests/sphinxext/sources/workchain/conf.py Show resolved Hide resolved
tests/sphinxext/reference_results/workchain.xml Outdated Show resolved Hide resolved
@ltalirz
Copy link
Member

ltalirz commented Oct 19, 2020

Sorry, that should have been "request changes" ;-)

@ltalirz
Copy link
Member

ltalirz commented Oct 19, 2020

Is there a links to the docs that we can check?

@chrisjsewell
Copy link
Member Author

chrisjsewell commented Oct 19, 2020

you just click on details:

image

then artifacts/html/index.html

image

https://1443-77234579-gh.circle-artifacts.com/0/html/index.html

@chrisjsewell
Copy link
Member Author

@ltalirz @greschd I've rolled back (i.e. commented out) the autodoc writer, because it doesn't work with referencing. From the current implementation, I'm pretty sure that has never worked.

As I mention in #3300 (comment), I think the whole extension needs a bit of a re-write to fix this.
But I'm definitely not doing it in this PR, since the point was really only to upgrade to sphinx 3 and now I've already wasted enough time messing around with it 😒

Copy link
Contributor

@csadorf csadorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@csadorf can you review this, with respect to dependency changes ta. I updated the requirements as mentioned in: #4466 (comment)

I have one question, but generally fine w.r.t. the updates to the dependency specification.

setup.json Show resolved Hide resolved
@greschd
Copy link
Member

greschd commented Oct 20, 2020

@ltalirz @greschd I've rolled back (i.e. commented out) the autodoc writer, because it doesn't work with referencing. From the current implementation, I'm pretty sure that has never worked.

Can you revert this? There are existing plugins using automodule - and I think referencing being broken isn't as bad as regressing to a "plain" Sphinx class.

@chrisjsewell
Copy link
Member Author

Can you revert this? There are existing plugins using automodule - and I think referencing being broken isn't as bad as regressing to a "plain" Sphinx class.

@greschd Unfortunately no. When I say revert, I mean revert from earlier in this PR. automodule has already regressed to plain sphinx classes (for about a year!) and turning it on breaks 116 references in the aiida-core documentation, with no fix until the whole extension is basically re-wrote.

@chrisjsewell chrisjsewell changed the title Docs: ⬆️ Update sphinx version + extensions Docs: ⬆️ Update sphinx + extensions versions Oct 20, 2020
@chrisjsewell chrisjsewell merged commit eed1917 into aiidateam:develop Oct 20, 2020
@chrisjsewell chrisjsewell deleted the docs/update-versions branch October 20, 2020 08:37
@greschd
Copy link
Member

greschd commented Oct 20, 2020

Ah yeah now I remember, that was #3689. I'm not sure referencing ever worked (although I think I was following some guide when writing the directive). Out of curiosity, why does the extension need to be rewritten for referencing to work?

@chrisjsewell
Copy link
Member Author

Basically we need to "integrate" it into the "py" domain, a bit like sphinx/domains/python::PyClasslike does, such that it also provides an XRefRole and stores an object in the py domain.
The actual creation of the doctree is generally fine though, its just the stuff around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sphinx directives are no longer hooked into sphinx.ext.autodoc
5 participants