Skip to content

Commit

Permalink
Fix a lint error of the long_description in setup.py
Browse files Browse the repository at this point in the history
Signed-off-by: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
  • Loading branch information
thombashi committed Dec 29, 2024
1 parent 8307b8a commit dc4d8c9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import os.path
import re

import setuptools

Expand All @@ -24,12 +25,17 @@ def get_release_command_class() -> dict[str, type[setuptools.Command]]:
return {"release": ReleaseCommand}


def make_long_description() -> str:
# ref: https://github.com/pypa/readme_renderer/issues/304
re_exclude = re.compile(r"\s*:scale:\s*\d+")

with open("README.rst", encoding=ENCODING) as f:
return "".join([line for line in f if not re_exclude.search(line)])


with open(os.path.join(MODULE_NAME, "__version__.py")) as f:
exec(f.read(), pkg_info)

with open("README.rst", encoding=ENCODING) as f:
long_description = f.read()

with open(os.path.join("docs", "pages", "introduction", "summary.txt"), encoding=ENCODING) as f:
summary = f.read().strip()

Expand Down Expand Up @@ -100,7 +106,7 @@ def get_release_command_class() -> dict[str, type[setuptools.Command]]:
"TOML",
],
license=pkg_info["__license__"],
long_description=long_description,
long_description=make_long_description(),
long_description_content_type="text/x-rst",
packages=setuptools.find_packages(exclude=["test*"]),
package_data={MODULE_NAME: ["py.typed"]},
Expand Down

0 comments on commit dc4d8c9

Please sign in to comment.