We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a1a82f commit f0e2746Copy full SHA for f0e2746
setup.py
@@ -2,6 +2,7 @@
2
import re
3
import shutil
4
import sys
5
+from pathlib import Path
6
7
from setuptools import find_packages, setup
8
@@ -35,16 +36,14 @@
35
36
37
38
def read(f):
- with open(f, encoding='utf-8') as file:
39
- return file.read()
+ return Path(f).read_text(encoding='utf-8')
40
41
42
def get_version(package):
43
"""
44
Return package version as listed in `__version__` in `init.py`.
45
46
- with open(os.path.join(package, '__init__.py'), encoding='utf-8') as f:
47
- init_py = f.read()
+ init_py = Path(package, "__init__.py").read_text(encoding="utf-8")
48
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
49
50
0 commit comments