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 example using incorrect string interpolation #1819

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
1 participant
@ghost
Copy link

ghost commented Jul 9, 2018

To work Properly, without "IndexError: tuple index out of range" Closes #1777

Antonio Feitosa
Update README.rst
To work Properly, without "IndexError: tuple index out of range" Closes #1777
@bitprophet

This comment has been minimized.

Copy link
Member

bitprophet commented Jul 10, 2018

This should already have been fixed (a11e747), can you post more details/output? Are you running this under Python 2.6 or something? (Which is sadly no longer supported!)

@ghost

This comment has been minimized.

Copy link
Author

ghost commented Jul 11, 2018

ubuntu@fabric2:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Codename:       bionic
ubuntu@fabric2:~$ uname -a
Linux fabric2 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Not overwriting existing python script /home/ubuntu/p2k/bin/python (you must use /home/ubuntu/p2k/bin/python2)
Installing setuptools, pkg_resources, pip, wheel...done.
Collecting fabric
    100% |████████████████████████████████| 194kB 4.0MB/s 
Collecting cryptography>=1.1 (from fabric)
  Downloading https://files.pythonhosted.org/packages/dd/c2/3a5bfefb25690725824ade71e6b65449f0a9f4b29702cce10560f786ebf6/cryptography-2.2.2-cp27-cp27mu-manylinux1_x86_64.whl (2.2MB)
    100% |████████████████████████████████| 2.2MB 4.9MB/s 
    100% |████████████████████████████████| 706kB 21.8MB/s 
Collecting pyasn1>=0.1.7 (from paramiko>=2.4->fabric)
  Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
    100% |████████████████████████████████| 61kB 12.7MB/s 
Collecting asn1crypto>=0.21.0 (from cryptography>=1.1->fabric)
  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting ipaddress; python_version < "3" (from cryptography>=1.1->fabric)
  Downloading https://files.pythonhosted.org/packages/fc/d0/7fc3a811e011d4b388be48a0e381db8d990042df54aa4ef4599a31d39853/ipaddress-1.0.22-py2.py3-none-any.whl
Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=1.1->fabric)
  Downloading https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz (245kB)
    100% |████████████████████████████████| 256kB 9.4MB/s 
Building wheels for collected packages: pycparser
  Running setup.py bdist_wheel for pycparser ... done
  Stored in directory: /home/ubuntu/.cache/pip/wheels/c0/a1/27/5ba234bd77ea5a290cbf6d675259ec52293193467a12ef1f46
Successfully built pycparser
Installing collected packages: invoke, pycparser, cffi, enum34, idna, asn1crypto, six, ipaddress, cryptography, pynacl, pyasn1, bcrypt, paramiko, fabric
Successfully installed asn1crypto-0.24.0 bcrypt-3.1.4 cffi-1.11.5 cryptography-2.2.2 enum34-1.1.6 fabric-2.1.3 idna-2.7 invoke-1.0.0 ipaddress-1.0.22 paramiko-2.4.1 pyasn1-0.4.3 pycparser-2.18 pynacl-1.2.1 six-1.11.0
(p2k) ubuntu@fabric2:~$ python
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from fabric import Connection
>>> result = Connection('localhost').run('uname -s')
Linux
>>> msg = "Ran {.command!r} on {.connection.host}, got stdout:\n{.stdout}"
>>> print(msg.format(result))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: tuple index out of range
>>> 
@bitprophet

This comment has been minimized.

Copy link
Member

bitprophet commented Jul 13, 2018

Hrm, yea I see it now. Weird. Thanks! This really needs to be doctested, so I need to expand the existing doctest stuff (or migrate it, might be thinking of another repo).

@bitprophet bitprophet added this to the 2.0.x milestone Jul 13, 2018

@bitprophet bitprophet changed the title Update README.rst README example using incorrect string interpolation Jul 13, 2018

@bitprophet

This comment has been minimized.

Copy link
Member

bitprophet commented Jul 25, 2018

Extended our doctest stuff from the API docs site to the WWW one and applied to this part of the README for starters. Found a bunch of other dumb mistakes, so, hooray for that!! May extend to rest of README or not, will merge soon regardless.

bitprophet added a commit that referenced this pull request Jul 25, 2018

@bitprophet

This comment has been minimized.

Copy link
Member

bitprophet commented Jul 25, 2018

Cherry-picked back to 2.0 and doctested rest of README. Only found one more embarrassing mistake 😁 Thanks again!

@bitprophet bitprophet closed this Jul 25, 2018

@bitprophet

This comment has been minimized.

Copy link
Member

bitprophet commented Jul 25, 2018

Grumble, laid low by our setup.py long description checker on Travis - which doesn't know about Sphinx, only vanilla ReST, I think. So it's mad about the doctest stuff 😠

https://travis-ci.org/fabric/fabric/jobs/408213027#L1475-L1556

Gotta see if there's a way around this cuz otherwise we're kinda hosed one way or another. Esp if this means it no longer renders correctly on PyPI. Might have to do something ugly like manually strip out the doctest blocks entirely when building packages...

@bitprophet

This comment has been minimized.

Copy link
Member

bitprophet commented Jul 25, 2018

Github also doesn't know what's up with these directives, so now our README on Github is also really ugly (the doctest setup blocks are printed literally). I hate everything about this.

@bitprophet

This comment has been minimized.

Copy link
Member

bitprophet commented Jul 25, 2018

Pretty sure the only workable solution is to make the README way simpler and punt all these code example blocks into index.rst or something. Ugh.

@bitprophet

This comment has been minimized.

Copy link
Member

bitprophet commented Jul 25, 2018

Removing the code blocks from the README itself just doesn't seem feasible, having those examples is core to the experience.

Tried something clever where we store the example blocks in their own files and .. include:: them into the README and another (orphaned) Sphinx page which has the doctest/testsetup/etc blocks. Unfortunately, since it's not possible to do an include inside another block this doesn't really fly...it'd work if I was willing to do some sort of template or parser based stitching as a step before running Sphinx, but...no. Just no.

The other option is to strip out the bad directives when packaging, which I see Invoke does already in its setup.py (here). Unfortunately, this doesn't help with Github level display, and I just looked and yea – Invoke's README on Github is a bit ugly too, which I only just noticed now. Ugh.

@bitprophet

This comment has been minimized.

Copy link
Member

bitprophet commented Jul 25, 2018

Maybe I can leverage .. include:'s start-after/end-before type features to pull in specific bits from a doctest-oriented orphaned file, into the README. Solves the issue on the doctest-oriented file's end (no more need to include on its side), gets us a possibly workable README (though idk how well Github's rendered handles includes, if at all...).

Main issue is having solid anchors for the start/end hints. If I'm lucky, I can use what are effectively ReST comments (.. something-with-no-trailing-commas) that would be no-ops on the Sphinx-oriented page. Still a tad fragile but at this point that's the best I can hope for.

If that fails I think I am going to suck it up and move example snippets into index.rst in these projects after all.

@bitprophet

This comment has been minimized.

Copy link
Member

bitprophet commented Jul 25, 2018

Wow @ today. Trying to do that and I run smack into https://bugs.python.org/issue31292 which has no solution/resolution.

This is definitely more trouble than it's worth. Time to go for the slimmed-down README + beefed-up Sphinx landing page.

@bitprophet

This comment has been minimized.

Copy link
Member

bitprophet commented Jul 25, 2018

Got that apparently working, tho I had some stupid problems with Python 2 and string representation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.