Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release] Fix pypi description (#1416) #1417

Merged
merged 1 commit into from
Nov 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions sky/setup_files/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,19 @@ def find_version(*filepath):
raise RuntimeError('Unable to find version string.')


def parse_footnote(readme: str) -> str:
"""Parse the footnote from the README.md file."""
def parse_readme(readme: str) -> str:
"""Parse the README.md file to be pypi compatible."""
# Replace the footnotes.
readme = readme.replace('<!-- Footnote -->', '#')
footnote_re = re.compile(r'\[\^([0-9]+)\]')
return footnote_re.sub(r'<sup>[\1]</sup>', readme)
readme = footnote_re.sub(r'<sup>[\1]</sup>', readme)

# Remove the dark mode switcher
mode_re = re.compile(
r'<picture>[\n ]*<source media=.*>[\n ]*<img(.*)>[\n ]*</picture>',
re.MULTILINE)
readme = mode_re.sub(r'<img\1>', readme)
return readme


install_requires = [
Expand Down Expand Up @@ -113,7 +121,7 @@ def parse_footnote(readme: str) -> str:
# README. Skip the description for that case.
if os.path.exists(readme_filepath):
long_description = io.open(readme_filepath, 'r', encoding='utf-8').read()
long_description = parse_footnote(long_description)
long_description = parse_readme(long_description)

setuptools.setup(
# NOTE: this affects the package.whl wheel name. When changing this (if
Expand Down