Skip to content

Commit 750346b

Browse files
tdhopperblackarybhrutledge
authored
Switch example reading Markdown to use pathlib (#969)
Co-authored-by: Zachary Blackwood <zblackwo@gmail.com> Co-authored-by: Zachary Blackwood <zblackwo@gmail.com> Co-authored-by: Brian Rutledge <bhrutledge@gmail.com>
1 parent 9c8996b commit 750346b

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

source/guides/making-a-pypi-friendly-readme.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,9 @@ and identifies the markup as GitHub-flavored Markdown:
7878
from setuptools import setup
7979
8080
# read the contents of your README file
81-
from os import path
82-
this_directory = path.abspath(path.dirname(__file__))
83-
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
84-
long_description = f.read()
81+
from pathlib import Path
82+
this_directory = Path(__file__).parent
83+
long_description = (this_directory / "README.md").read_text()
8584
8685
setup(
8786
name='an_example_package',

0 commit comments

Comments
 (0)