From fad687bdcb4405814db02f806a04ed306e337aee Mon Sep 17 00:00:00 2001 From: Keith Yang Date: Tue, 10 Aug 2021 00:29:26 +0800 Subject: [PATCH] Refine PyPI packaging --- CHANGES.rst | 3 --- HOW_TO_BUILD.rst | 5 +++++ MANIFEST.in | 1 + pyproject.toml | 6 ++++++ setup.cfg | 4 ---- setup.py | 14 ++++---------- 6 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 HOW_TO_BUILD.rst create mode 100644 MANIFEST.in create mode 100644 pyproject.toml diff --git a/CHANGES.rst b/CHANGES.rst index 0795320..0292a6e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,3 @@ -(Unrelease) -=================== - 1.2.0 (2021-08-09) ================== diff --git a/HOW_TO_BUILD.rst b/HOW_TO_BUILD.rst new file mode 100644 index 0000000..6587cff --- /dev/null +++ b/HOW_TO_BUILD.rst @@ -0,0 +1,5 @@ +python3 -m pip install --upgrade build +python3 -m pip install --upgrade twine +python3 -m build +python3 -m twine check dist/* +python3 -m twine upload --repository testpypi dist/* diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..7539083 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include CHANGES.rst diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f6c1689 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel", +] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index de0e9b3..3153758 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,3 @@ -[metadata] -description-file = README.rst - - [bdist_wheel] universal=1 diff --git a/setup.py b/setup.py index 1540aaa..975a88d 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,9 @@ -import os - from setuptools import setup -here = os.path.abspath(os.path.dirname(__file__)) -try: - with open(os.path.join(here, 'README.rst')) as f: - README = f.read() - with open(os.path.join(here, 'CHANGES.rst')) as f: - CHANGES = f.read() -except IOError: - README = CHANGES = '' +with open("README.rst", "r", encoding="utf-8") as f: + README = f.read() +with open("CHANGES.rst", "r", encoding="utf-8") as f: + CHANGES = f.read() testing_extras = [ 'pytest-cov',