Skip to content

Commit

Permalink
realease 0.1.5 to fix doc in pypi.org
Browse files Browse the repository at this point in the history
  • Loading branch information
vargastat committed Jan 8, 2025
1 parent a03b82c commit a6b6f70
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ jobs:
- name: Performs Windows tests
if: matrix.os == 'windows-latest'
run: tox -e 3.9-test

- name: Build README
run: tox -e build-readme
5 changes: 5 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v0.1.5 (2025-01-08)
-------------------

- Concatenate .md files for single Readme at pypi.org

v0.1.4 (2025-01-07)
-------------------

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ build-backend = "setuptools.build_meta"

[project]
name = "antares_craft"
version = "0.1.4"
version = "0.1.5"
description = """Antares Craft python library under construction. It will allow to create, update and read antares studies."""
readme = "README.md"
readme = "CONCATENATED_README.md"
license = {file = "LICENSE"}
authors = [
{name="Sylvain Leclerc"},
Expand Down
47 changes: 47 additions & 0 deletions scripts/concat_readme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from pathlib import Path
import re

project_root = Path(__file__).resolve().parent.parent


files = [
project_root / "README.md",
project_root / "docs/usage.md",
project_root / "docs/developer.md",
project_root / "docs/CHANGELOG.md"
]

output_file = project_root / "CONCATENATED_README.md"

#Function to delete Table of Contents in CONCATENATED_README.md
def remove_table_of_contents(content_text: str) -> str:
lines = content_text.splitlines()
filtered_lines = []

in_table_of_contents = False

for line in lines:
# Remove the Table of Contents title (e.g., **Table of Contents**)
if "**Table of Contents**" in line:
in_table_of_contents = True
continue

# Remove items in Table of Contents
if line.strip().startswith("- ["):
continue

if in_table_of_contents and not line.strip().startswith("-"):
in_table_of_contents = False

if not in_table_of_contents:
filtered_lines.append(line)

return "\n".join(filtered_lines)

with open(output_file, "w", encoding="utf-8") as outfile:
for file in files:
with open(file, "r", encoding="utf-8") as infile:
content = infile.read()
if file.name == "README.md":
content = remove_table_of_contents(content) # Remove Table of Contents
outfile.write(content + "\n\n") # Add spacing between files
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tox]
env_list =
py3.{9,10,12}-test
build-readme

[testenv]
deps =
Expand Down Expand Up @@ -35,3 +36,10 @@ commands =
ruff check src/ tests/ {posargs}
ruff format --check src/ tests/ {posargs}
mypy {posargs}


[testenv:build-readme]
description = Concatenate multiple Markdown files into one README
skip_install = True
commands =
python scripts/concat_readme.py

0 comments on commit a6b6f70

Please sign in to comment.