13

In Sphinx I know that you can do it:

.. raw:: html

    <div style="margin-top:10px;">
      <iframe width="560" height="315" src="http://www.youtube.com/embed/_EjisXtMy_Y" frameborder="0" allowfullscreen></iframe>
    </div>

In pypi, is there some way to do it?

How about a youtube video?

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
Goin
  • 3,856
  • 26
  • 44

3 Answers3

7

I don't think you can embbed random html on pypi and I'm glad you can't. Pypi should remain a Python Package Index, not a geocities clone.

If you really need to put a Youtube video on your package page you can put an image with a link to the Youtube video using standard restructured text:

.. image:: http://example.com/image-with-the-first-frame.png
   :target: http://www.youtube.com/your-video
lgs
  • 141
  • 4
  • I do not want a random html, if it is possible, could be possible something like this: ".. video:: http://example.com/my-video". I think that your solution is a cheater solution, and I like this. But I would prefer can set a video instead of a frame – Goin Jan 10 '12 at 17:21
6

The point of PyPI is a module package index for quick reference and access to Python modules and packages. It isn't intended to be a customizable media site. You can add a fair amount of information to the index page for your modules and packages you put onto it, but it isn't intended for anything more than an index site.

If you want to have more detailed documentation with a more customized feel, use http://packages.python.org which you can lupload content to through the package edit page: http://pypi.python.org/pypi?%3Aaction=pkg_edit&name=YOURPACKAGE where YOURPACKAGE is the name of the packaged you uploaded to PyPI.

Drahkar
  • 1,694
  • 13
  • 17
  • 1
    Thanks but it is not a solution. This may be impossible. – Goin Jan 17 '12 at 14:17
  • Its really the only option you have. The indexing site is not intended for a multimedia platform. They are nice enough to offer a documentation portal through packages.python.org. If you want something like to host multimedia content, use a service like 100webspace or something similar. – Drahkar Jan 20 '12 at 00:35
  • 2
    I don't want "something like to host multimedia content". – Goin Jan 20 '12 at 08:48
  • Well unfortunately your best bet to have any imagery from the video on your Index page at PyPI is to do as Igs suggested. I'd accept his answer and move on. PyPI just doesn't allow what you were trying to do. – Drahkar Jan 20 '12 at 10:12
  • I am more likely to download a package that has a good video tutorial on pypi or readthedocs. – nu everest Nov 30 '15 at 22:49
1

Restructured text specification is here:

http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html

I believe pypi uses a package called docutils to render the pages.

http://pypi.python.org/pypi/docutils/

raw directive should be supported, in theory, unless specifically disabled.

However, there might be many kind of issues why arbitary HTML is not wanted on PyPi: it would be potential XSS security hole allowing you to capture PyPi credentials from other users.

You can confirm this from PyPi source code: http://wiki.python.org/moin/CheeseShopDev

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
  • As you say raw directive should be supported, but this does not work. I think that is impossible to capture the credentials through XSS, if the login is through basic authentication – Goin Jan 18 '12 at 17:40
  • You could still make Javascript form posts to manipulate PyPi package registry of the owner? – Mikko Ohtamaa Jan 18 '12 at 23:04