From 3bbe710899ae2e61cdd47268e9012af6500e598f Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Fri, 27 Aug 2021 16:29:40 -0400 Subject: [PATCH] Switch example reading Markdown to use pathlib Co-authored-by: Zachary Blackwood --- source/guides/making-a-pypi-friendly-readme.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/guides/making-a-pypi-friendly-readme.rst b/source/guides/making-a-pypi-friendly-readme.rst index eea221b4ab..0cba44c2ca 100644 --- a/source/guides/making-a-pypi-friendly-readme.rst +++ b/source/guides/making-a-pypi-friendly-readme.rst @@ -78,10 +78,9 @@ and identifies the markup as GitHub-flavored Markdown: from setuptools import setup # read the contents of your README file - from os import path - this_directory = path.abspath(path.dirname(__file__)) - with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: - long_description = f.read() + from pathlib import Path + this_directory = Path(__file__).parent + long_description = (this_directory / "README.md").read_text() setup( name='an_example_package',