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

README.rst: Syntax highlight Python examples #4

Merged
merged 2 commits into from
Dec 15, 2014

Conversation

msabramo
Copy link
Contributor

No description provided.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
For comfortable reading on mobile devices.
@ionelmc
Copy link
Owner

ionelmc commented Dec 15, 2014

Hey, thanks. It seems I've messed up the tests myself :)

I have a question tho, when running setup.py register I get this warning:

running register
running egg_info
writing requirements to src/pytest_benchmark.egg-info/requires.txt
writing src/pytest_benchmark.egg-info/PKG-INFO
writing top-level names to src/pytest_benchmark.egg-info/top_level.txt
writing dependency_links to src/pytest_benchmark.egg-info/dependency_links.txt
writing entry points to src/pytest_benchmark.egg-info/entry_points.txt
reading manifest file 'src/pytest_benchmark.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no directories found matching 'examples'
warning: no files found matching '.isort.cfg'
warning: no files found matching '.pylintrc'
warning: no previously-included files matching '__pycache__' found anywhere in distribution
writing manifest file 'src/pytest_benchmark.egg-info/SOURCES.txt'
running check
warning: check: Could not finish the parsing.

Registering pytest-benchmark to http://pypi.python.org/pypi
Server response (200): OK

Any idea what's the deal with that?

Also, when running python setup.py check --restructuredtext --strict --metadata:

running check
warning: check: Could not finish the parsing.

error: Please correct your package.

Do you also get these or there's something wrong with my installation?

@ionelmc ionelmc merged commit 1a4c5c0 into ionelmc:master Dec 15, 2014
@msabramo
Copy link
Contributor Author

$ python setup.py check --restructuredtext --strict --metadata
running check

@msabramo
Copy link
Contributor Author

I tried introducing a minor error:

$ python setup.py check --restructuredtext --strict --metadata
running check
warning: check: Title underline too short. (line 57)

error: Please correct your package.

@msabramo
Copy link
Contributor Author

The above was with:

[marca@marca-mac2 pytest-benchmark]$ pip freeze | grep docutils
docutils==0.12
[marca@marca-mac2 pytest-benchmark]$ python -c 'import setuptools; print(setuptools.__version__)'
5.4.2

I also tried it with a newer version of setuptools:

[marca@marca-mac2 pytest-benchmark]$ pip freeze | grep docutils
docutils==0.12
[marca@marca-mac2 pytest-benchmark]$ python -c 'import setuptools; print(setuptools.__version__)'
8.0.2
[marca@marca-mac2 pytest-benchmark]$ python setup.py check --restructuredtext --strict
running check
warning: check: Title underline too short. (line 57)

error: Please correct your package.

Let me know if you need more info.

@msabramo
Copy link
Contributor Author

Oh wait, now I'm getting the problem when I checkout my commit.

[marca@marca-mac2 pytest-benchmark]$ git checkout 1a4c5c0
Note: checking out '1a4c5c0'.
...

[marca@marca-mac2 pytest-benchmark]$ python setup.py check --restructuredtext --strict
running check
warning: check: Could not finish the parsing.

error: Please correct your package.

@msabramo
Copy link
Contributor Author

Hmmm.

[marca@marca-mac2 pytest-benchmark]$ rst2html.py --halt=2 README.rst > /dev/null && echo "RST was OK."
RST was OK.

OK, now I understand why you reverted the commit and why you were saying that the PyPA needs to fix something.

@msabramo
Copy link
Contributor Author

Here's where that Could not finish the parsing error is coming from:

https://github.com/python/cpython/blob/master/Lib/distutils/command/check.py#L142

@msabramo
Copy link
Contributor Author

Did a little hacking in that file and got some more info:

[marca@marca-mac2 pytest-benchmark]$ python setup.py check --restructuredtext --strict --metadata
running check
warning: check: Could not finish the parsing: Values instance has no attribute 'syntax_highlight'.

error: Please correct your package.

@msabramo
Copy link
Contributor Author

And here's the stack trace:

[marca@marca-mac2 pytest-benchmark]$ python setup.py check --restructuredtext --strict --metadata
running check
Traceback (most recent call last):
  File "setup.py", line 63, in <module>
    "benchmark = pytest_benchmark.plugin"
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/check.py", line 73, in run
    self.check_restructuredtext()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/check.py", line 117, in check_restructuredtext
    for warning in self._check_rst_data(data):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/check.py", line 144, in _check_rst_data
    parser.parse(data, document)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/__init__.py", line 172, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 170, in run
    input_source=document['source'])
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/statemachine.py", line 239, in run
    context, state, transitions)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2961, in text
    self.section(title.lstrip(), source, style, lineno + 1, messages)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 395, in new_subsection
    node=section_node, match_titles=True)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 282, in nested_parse
    node=node, match_titles=match_titles)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 195, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/statemachine.py", line 239, in run
    context, state, transitions)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2726, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 395, in new_subsection
    node=section_node, match_titles=True)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 282, in nested_parse
    node=node, match_titles=match_titles)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 195, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/statemachine.py", line 239, in run
    context, state, transitions)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2299, in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2311, in explicit_construct
    return method(self, expmatch)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2054, in directive
    directive_class, match, type_name, option_presets)
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2103, in run_directive
    result = directive_instance.run()
  File "/Users/marca/python/virtualenvs/pytest-benchmark/lib/python2.7/site-packages/docutils/parsers/rst/directives/body.py", line 149, in run
    self.state.document.settings.syntax_highlight)
AttributeError: Values instance has no attribute 'syntax_highlight'

@ionelmc
Copy link
Owner

ionelmc commented Dec 15, 2014

That error handling is very bad.

Anyway, I fixed the check env now (835dbe8) and reverted the revert.

@msabramo
Copy link
Contributor Author

Yeah, it's bad that it fails to validate and the error it outputs is horrible too.

You might be interested in a ticket (with patch) that I created for docutils:

https://sourceforge.net/p/docutils/bugs/270/

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.

None yet

2 participants