Skip to content

test_Tutorial.py doctest extractor from RST files - #2188

Closed
anilbey wants to merge 10 commits into
biopython:sphinxfrom
anilbey:sphinx
Closed

anilbey wants to merge 10 commits into
biopython:sphinxfrom
anilbey:sphinx

Conversation

@anilbey

@anilbey anilbey commented Jul 27, 2019

Copy link
Copy Markdown
Contributor

Part of work at the BOSC 2019 CoFest towards issue #907

  • I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • I have read the CONTRIBUTING.rst file, have run flake8 locally, and
    understand that AppVeyor and TravisCI will be used to confirm the Biopython unit
    tests and style checks pass with these changes.

  • I have added my name to the alphabetical contributors listings in the files
    NEWS.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

peterjc and others added 9 commits July 27, 2019 17:06
$ for f in *.tex; do pandoc -f latex -t rst -o ${f%.*}.rst $f; done
(A) Initial approach:

$ for f in *.tex; do pandoc -f latex -t rst -o ../${f%.*}.rst $f; done

This does not handle the references (e.g. to chapters) properly.

(B) However, this does - it just needs cutting up again:

$ pandoc -f latex -t rst -o Tutorial.rst Tutorial.tex

Wrote a simple script to do this (after earlier standardising the
chapter labels to help):

$ pandoc -f latex -t rst Tutorial.tex | ../.github/rst_chunk.py

Fixes the chapter numbers, but dumps the references to the
end of the appendix (poorly formatted anyway).

This then fixes links to other chapters (since pandoc was writing
a single large RST file, it made all the links internal HTML style
starting with hash):

$ sed -i.bak "s/<#chapter:/<chapter:/g" chapter_*.rst

(C) Wrote a script to convert the links to :ref: style instead,
First, run pandoc on each LaTeX file one-by-one

$ for f in *.tex; do pandoc -f latex -t rst -o ../${f%.*}.rst $f; done

Then fix links:

$ ../.github/ref_fix.py chapter_*.rst
@codecov

codecov Bot commented Jul 27, 2019

Copy link
Copy Markdown

Codecov Report

Merging #2188 into sphinx will increase coverage by 1.37%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           sphinx    #2188      +/-   ##
==========================================
+ Coverage   83.25%   84.62%   +1.37%     
==========================================
  Files         316      317       +1     
  Lines       51222    51453     +231     
==========================================
+ Hits        42644    43543     +899     
+ Misses       8578     7910     -668
Impacted Files Coverage Δ
Bio/SearchIO/_model/query.py 91.5% <0%> (-0.93%) ⬇️
Bio/PDB/mmtf/DefaultParser.py 100% <0%> (ø)
Bio/SearchIO/HHsuiteIO/hhsuite2_text.py 97.03% <0%> (+0.02%) ⬆️
Bio/Align/__init__.py 87.43% <0%> (+0.03%) ⬆️
Bio/GenBank/Scanner.py 82.8% <0%> (+0.04%) ⬆️
Bio/SeqIO/InsdcIO.py 93.08% <0%> (+0.04%) ⬆️
Bio/AlignIO/MafIO.py 92.92% <0%> (+0.04%) ⬆️
Bio/Phylo/Consensus.py 83.1% <0%> (+0.05%) ⬆️
Bio/GenBank/__init__.py 93.76% <0%> (+0.06%) ⬆️
Bio/Phylo/NewickIO.py 83.33% <0%> (+0.09%) ⬆️
... and 37 more

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 03223e0...7c2c978. Read the comment docs.

peterjc pushed a commit to peterjc/biopython that referenced this pull request Jan 3, 2024
Original commit from Anil Tuncel, 27 July 2019,
on pull request biopython#2188.

Cherry-picked, conflicts fixed, path assumptions
updated, documentation and error messages updated,
by Peter Cock.
peterjc pushed a commit to peterjc/biopython that referenced this pull request Jan 3, 2024
Original commit from Anil Tuncel, 27 July 2019,
on pull request biopython#2188.

Cherry-picked, conflicts fixed, path assumptions
updated, documentation and error messages updated,
by Peter Cock.
peterjc pushed a commit to peterjc/biopython that referenced this pull request Jan 3, 2024
Original commit from Anil Tuncel, 27 July 2019,
on pull request biopython#2188.

Cherry-picked, conflicts fixed, path assumptions
updated, documentation and error messages updated,
by Peter Cock.
peterjc pushed a commit to peterjc/biopython that referenced this pull request Jan 3, 2024
Original commit from Anil Tuncel, 27 July 2019,
on pull request biopython#2188.

Cherry-picked, conflicts fixed, path assumptions
updated, documentation and error messages updated,
by Peter Cock.
peterjc pushed a commit that referenced this pull request Jan 4, 2024
Original commit from Anil Tuncel, 27 July 2019,
on pull request #2188.

Cherry-picked, conflicts fixed, path assumptions
updated, documentation and error messages updated,
by Peter Cock.
@peterjc

peterjc commented Jan 4, 2024

Copy link
Copy Markdown
Member

Hi @anilbey - your work was included as part of #4371, just merged. Thank you.

Would you like to be listed in the NEWS and CONTRIB files?

@peterjc peterjc closed this Jan 4, 2024
@anilbey

anilbey commented Jan 4, 2024

Copy link
Copy Markdown
Contributor Author

Hi @peterjc I am happy to see the doctest extractor became useful :).

Would you like to be listed in the NEWS and CONTRIB files?

Thanks, yes that would be good.

@peterjc

peterjc commented Jan 4, 2024

Copy link
Copy Markdown
Member

I'll do that along with adding a NEWS entry for the changes themselves.

Note commits 9b103c0 and f9ec516 to drop blank lines within doctests. This might be a limitation of the current RST doctest extraction code, but those tests broke - I think because the second part was not included.

That might be an easy fix, or we might at a later date want to experiment with parsing the RST files via docutils - but what we have now seems to work otherwise 👍

@peterjc peterjc mentioned this pull request Jan 4, 2024
3 tasks done
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.

2 participants