Skip to content

Commit

Permalink
[Release] Fix pypi description (#1416)
Browse files Browse the repository at this point in the history
* Fix pypi description

* fix

* format
  • Loading branch information
Michaelvll authored Nov 15, 2022
1 parent dbea5b1 commit 8a2acdf
Showing 1 changed file with 12 additions and 4 deletions.
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 @@ -119,7 +127,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

0 comments on commit 8a2acdf

Please sign in to comment.