pypa / readme_renderer

Safely render long_description/README files in Warehouse
Apache License 2.0
158 stars 88 forks source link

Add CLI option to render package README. #271

Closed tillahoffmann closed 1 year ago

tillahoffmann commented 1 year ago

This PR adds an option --package to the CLI such that the README of a package can be rendered as it would on pypi.org. Using this option, package authors can preview READMEs in addition to checking their validity using twine check. Rendering the README based on the package metadata is important because a number of packages strip out roles and directives that are not supported by pypi.org in their setup.py. Publishing to test.pypi.org, as discussed in pypa/twine#875, is an alternative, but having a local preview would be desirable (at least for myself). This PR also adds tests for the existing CLI.

miketheman commented 1 year ago

@tillahoffmann Thanks! We removed the documented example of using the CLI in https://github.com/pypa/readme_renderer/pull/197 - since the interface doesn't currently render Markdown. Before introducing a CLI that we'd expect to support, would you consider adding that behavior?

Please also update your branch from main as it includes some test fixes.

tillahoffmann commented 1 year ago

Hm, interesting, any idea why pypy might fail while the others succeed? I can also mock out writing to the file rather than using a temporary directory.

tillahoffmann commented 1 year ago

Thanks for working through this!

Thanks for the speedy review!