-
Notifications
You must be signed in to change notification settings - Fork 46
Support Markdown for readmes #148
Comments
Original comment by Will McKenzie (Bitbucket: kmd_willmckenzie, GitHub: Unknown): I'll second this! Much prefer Markdown syntax and it's a pain having to convert before uploading a package. |
Original comment by Donald Stufft (Bitbucket: dstufft, GitHub: dstufft): This is unlikely to happen in the near term. Warehouse (PyPI 2.0) is organized so that eventually we can support multiple markdown selections. The primary problem is we don't have any way to know if we should be rendering in markdown or rST. One way around that would be to render Markdown if rST fails, however some markdown is valid rST but it renders incorrectly in that case and looks really bad. It's also not a very particularly elegant solution especially if people want to do something else like asciidoc or some other formatting method. Likely the metadata 2.0 stuff will (eventually maybe?) support saying what markup your description is in and then we can render it using the appropriate renderer. It will also enable us to actually reject and upload if a package doesn't render correctly instead of just falling back to plaintext, because we'll know if it's supposed to be able to render or not. |
Original comment by Hickford (Bitbucket: hickford, GitHub: hickford): Really? I understand PyPI's current algorithm to be
Here's a backwards compatible algorithm that would elate markdown authors:
If you're concerned about projects with a |
Original comment by Will McKenzie (Bitbucket: kmd_willmckenzie, GitHub: Unknown): A potential interim solution (until the metadata stuff that will let a package maintainer specify the format) could be to have a developer leave the long_description field blank and have a README.(md|markdown) file to be rendered in it's stead? I know with my packages I'm basically just reading the README.txt file and assigning it to the long description field (I didn't know how the algorithm worked). |
Original comment by Hickford (Bitbucket: hickford, GitHub: hickford): I had a go! Here's a pull request https://bitbucket.org/pypa/pypi/pull-request/33/support-markdown-for-readmes/diff |
Original comment by Marc Abramowitz (Bitbucket: msabramo, GitHub: msabramo): I like Will's idea. Many, many Python projects have boilerplate in setup.py to set long_description to the contents of their README. That's because people want to have the best chance of their description getting picked up but almost everyone prefers editing a description in a separate file over something embedded in setup.py, plus the file extension tells you what format it's in. I think it would be great if PyPI/warehouse scanned for a README.rst, README.md, README.markdown and used that as the priority for the description to show. Perhaps setuptools could be modified to warn you in the unlikely event that your long_description has different data than your README (@jaraco: What do you think?). I think in the next version of the metadata standard I would drop long_description and instead offer something like long_description_filename. Maybe not a bad idea to add long_description_filename to setuptools now. Then package maintainers could start setting that and PyPI/Warehouse could use that in preference to long_description. That would let the server instantly know the format language from the extension and package maintainers could set it and remove lines from their setup.py to populate long_description from a file. |
Original comment by Jason R. Coombs (Bitbucket: jaraco, GitHub: jaraco): @msabramo I'm not sure your suggestion makes sense in the general case. What you and Will are suggesting is to create a new field in the metadata that references content outside the metadata. In particular, long_description_filename references a file that exists in one of the uploaded distribution packages, but which one? What if the distribution package is a wheel or egg or Windows installer? What if there are multiple distributions (Python version specific)? What if the metadata has been uploaded (e.g. through the register command) but no distribution has been uploaded? I see value in having the long description inline with the metadata in all cases, because that means that all metadata is represented in one entity and doesn't require steps to assemble it (and the complication that entails). |
Original comment by Krisztian Fekete (Bitbucket: krisztianfekete, GitHub: Unknown): What about a new field: Lifting a |
Original comment by Marc Abramowitz (Bitbucket: msabramo, GitHub: msabramo): @jaraco: Those are good points - I hadn't considered that there could be multiple distributions or even no distribution if the user registered but did not upload. Maybe the idea from @krisztianfekete is a better one? |
Original comment by Jason R. Coombs (Bitbucket: jaraco, GitHub: jaraco): I have no objection to supporting markdown or even moving toward preferring markdown. This poses a larger question of what should the metadata reflect to support this ability? Also, does the tool chain that renders documentation support markdown (namely Sphinx or Warehouse)? I'd recommend getting some feedback from pypa-dev on a change of this scope. |
Original comment by Marc Abramowitz (Bitbucket: msabramo, GitHub: msabramo): @hickford's patch would add Markdown to legacy PyPI. I'm thinking it could be tweaked a bit to look for a Then we could make a setuptools extension to add that property to package metadata (use an extension so we don't have to modify setuptools unless it proves to be wildly popular). |
Original comment by illume NA (Bitbucket: illume, GitHub: illume): Added an issue to devpi https://bitbucket.org/hpk42/devpi/issue/193/support-markdown-for-readmes |
Original comment by Jason R. Coombs (Bitbucket: jaraco, GitHub: jaraco): I'm slighly -1 on adding another metadata field to specify the content type of an existing metadata field (i.e. long_description/long_description_format). If we did adopt that, I would recommend using MIME types (so something like "text/x-markdown; charset=utf-8" for markdown) to encourage alignment with other standards. Rather than storing the metadata for the long description in another field, perhaps the format could be inferred by a heuristic and specified for cases where the heuristic fails using out-of-band features of the format (i.e. comments). For example, the following two snippets could represent a way to specify the content type of the document:
In this way, the long_description field becomes content-agnostic, but the tools now can infer the content type and users would have a means to force a content type. This approach would not require any changes to tooling except for those that render package metadata. |
Original comment by Richard Jones (Bitbucket: r1chardj0n3s, GitHub: r1chardj0n3s): Merged in hickford/pypi/markdown-readme (pull request #33) Support Markdown for readmes (fixes #148) |
1 similar comment
Original comment by Richard Jones (Bitbucket: r1chardj0n3s, GitHub: r1chardj0n3s): Merged in hickford/pypi/markdown-readme (pull request #33) Support Markdown for readmes (fixes #148) |
Original comment by Eugene Yunak (Bitbucket: yunake, GitHub: yunake): @r1chardj0n3s, can you maybe reopen this issue since you reverted the merge? |
Original comment by Richard Jones (Bitbucket: r1chardj0n3s, GitHub: r1chardj0n3s): Needs more thought on the security front. |
Original comment by Donald Stufft (Bitbucket: dstufft, GitHub: dstufft): I'm of the opinion that a fallback on Markdown isn't very good.
Overall I'd really like not to add more implementation defined stuff to the packaging toolchain. The processes for doing things should be documented in a PEP and someone should be able to replace each part of the toolchain by reading those PEPs and implementing them. It shouldn't require having to inspect the various implementations to figure things out. |
Original comment by digitalvapor (Bitbucket: digitalvapor, GitHub: digitalvapor): Markdown support would be very appreciated! thanks |
Original comment by Femto Trader (Bitbucket: FemtoTrader, GitHub: FemtoTrader): +1 I'm also looking for Markdown support! |
Original comment by Marc Abramowitz (Bitbucket: msabramo, GitHub: msabramo): For folks looking for Markdown support, have a look at https://pypi.python.org/pypi/setuptools-markdown which I uploaded to PyPI last night. This is very, very experimental. Make sure to test thoroughly before you put a package on PyPI that uses it. E.g.: I wouldn't want for folks who install your packages to have to install |
Original comment by agh1973 (Bitbucket: agh1973, GitHub: Unknown): +1 coming from http://stackoverflow.com/questions/4384796/readme-extension-for-python-projects I'll give the setuptools-markdown stuff a try. |
Original comment by Skuli Arnlaugsson (Bitbucket: arnlaugsson, GitHub: arnlaugsson): This would be a lovely addition, Markdown is a much nicer format imo. |
Original comment by anatoly techtonik (Bitbucket: techtonik, GitHub: techtonik): This was an official position on any features a year ago:
http://comments.gmane.org/gmane.comp.python.distutils.devel/20041 |
Original comment by Hickford (Bitbucket: hickford, GitHub: hickford): That's unwelcoming :( I am not going to read any further or say any more, because quarrels between people who should be working together make me sad. Happily I've been fortunate in open source, everyone has been most helpful to me. Whether Markdown support is added to current PyPI or the new site (https://warehouse.python.org/ ), Markdown support is an important issue to many people. I'm sure we can work it out eventually. |
Original comment by Donald Stufft (Bitbucket: dstufft, GitHub: dstufft): There's no way to do auto discovery like Github does because we're not reading from a file (in some cases we are, but not generally), the description gets passed into the long_description field in the setup.py as a string and that gets sent as a POST argument when the file gets uploaded to PyPI. As a way of trying to find something PyPI will also, in the absence of that field, look for a README file in the archive but I personally feel that shouldn't be encouraged as it lives outside the metadata and instead we should focus on a reasonable way to represent it within the metadata. |
Original comment by anatoly techtonik (Bitbucket: techtonik, GitHub: techtonik):
The good way would be to render README file from archive if the Description field in PKG-INFO (long_description in |
Original comment by Nicholas Chammas (Bitbucket: nickchammas, GitHub: Unknown): For people looking for an interim solution, you can use pandoc to convert your Here's an example:
It's straightforward and should work for most projects. You can add a fallback like in the Stack Overflow answer I linked to so that people running |
Some people don't like this solution Pinging also : |
@femtotrader - If by "this solution" you are referring to my suggestion just above, I don't see how it is a problem. The users in the discussion you linked to are complaining that they have to install Pandoc just to install your library. However, at the end of my comment I noted:
In other words, only the maintainer who is uploading a package to PyPI will need Pandoc installed. Perhaps I should have included that in my code sample, rather than just referring to it on Stack Overflow via a link. But to spell things out, if you have something like this in your try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except ImportError:
long_description = open('README.md').read() And then you have Pandoc listed as a separate requirement only for maintainers, perhaps in a That's how I do it in my project: It's not the solution we all ultimately want, but I think it's good enough for the time being. |
I understand this correctly. Sorry for being not clear enough... |
PyPI doesn't render markdown, it parses README.md assuming reST rules: pypi/legacy#148 which currently causes joined lines on https://pypi.python.org/pypi/manageiq-api-client-python/ Using README.rst with reST syntax is the simplest workaround.
I also think pypi should just support markdown. |
Since this is a new feature and implementing it is not easy as calling |
Originally reported by: Hickford (Bitbucket: hickford, GitHub: hickford)
If you write your readme in Restructured Text, PyPI will render it on your project's page (eg. https://pypi.python.org/pypi/requests ). It should be possible to write your readme in Markdown too. Markdown is a pervasive format used on GitHub and StackOverflow. It shouldn't be necessary to learn a new markup language or rewrite your project's documentation to publish a Python package.
This is common frustration. The Python community suffers because it's a barrier to publishing packages and writing documentation . Please consider supporting Markdown!
Update 2014: Here's a pull request! https://bitbucket.org/pypa/pypi/pull-request/59/support-markdown-for-readmes-fixes-148/diff
The text was updated successfully, but these errors were encountered: