Skip to content

Commit

Permalink
Modify doc generation after repositories merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien Lelaquais committed Dec 15, 2023
1 parent d74f622 commit ef3daaf
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ site/
# Doc generation
mkdocs.yml
/taipy
/gui
/taipy-fe
docs/manuals/reference/**/*.md
!docs/manuals/reference/index.md
docs/manuals/gui/controls.md
Expand Down
11 changes: 5 additions & 6 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ name = "pypi"

[packages]
"backports.zoneinfo" = {version="==0.2.1", markers="python_version < '3.9'", extras=["tzdata"]}
apispec = {extras = ["yaml"], version = "==5.0"}
apispec = {extras = ["yaml"], version = "==6.3"}
apispec-webframeworks = "==0.5.2"
bcrypt = "==3.2.2"
cookiecutter = "==2.1.1"
deepdiff = "==6.2.2"
flask = "==3.0.0"
flask-cors = "==4.0.0"
flask-marshmallow = ">=0.14"
flask-migrate = ">=3.0"
flask-restful = ">=0.3.9"
flask-socketio = "==5.3.6"
gevent = "==23.7.0"
Expand All @@ -22,15 +20,16 @@ gitignore-parser = "==0.1.1"
kthread = "==0.2.3"
ldap3 = "==2.9.1"
markdown = "==3.4.4"
markupsafe = "==2.1.1"
marshmallow = "==3.20.1"
modin = "==0.23.0"
networkx = "==2.6"
openpyxl = "==3.1.2"
opentelemetry-api = "==1.20.0"
opentelemetry-exporter-otlp = "==1.20.0"
opentelemetry-sdk = "==1.20.0"
pandas = "==2.0.0"
passlib = "==1.7.4"
pyarrow = "==10.0.1"
pymongo = {extras = ["srv"], version = "==4.2.0"}
pyngrok = "==5.1"
python-dotenv = "==1.0.0"
python-magic = {version = "==0.4.24", markers="sys_platform != 'win32'"}
python-magic-bin = {version = "==0.4.14", markers="sys_platform == 'win32'"}
Expand Down
2 changes: 1 addition & 1 deletion tools/_setup_generation/step_gui_ext_refman.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def enter(self, setup: Setup):
def setup(self, setup: Setup) -> None:
if self.npm_path:
saved_cwd = os.getcwd()
gui_path = os.path.join(setup.root_dir, "gui")
gui_path = os.path.join(setup.root_dir, "taipy-fe")
os.chdir(gui_path)
print(f"... Installing node modules...", flush=True)
subprocess.run(f"{self.npm_path} run inst", shell=True)
Expand Down
46 changes: 25 additions & 21 deletions tools/fetch_source_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Where all the code from all directories/repositories is copied
DEST_DIR_NAME = "taipy"

REPOS = ["config", "core", "gui", "rest", "taipy", "templates"]
REPOS = ["taipy"]
PRIVATE_REPOS = ["auth", "enterprise"]

OPTIONAL_PACKAGES = {
Expand Down Expand Up @@ -143,8 +143,9 @@ def safe_rmtree(dir: str):
safe_rmtree(os.path.join(TOOLS_PATH, DEST_DIR_NAME))

pipfile_packages = {}
PIPFILE_PACKAGE_RE = re.compile(r"(.*?)\s?=\s?(.*)")
PIPFILE_PACKAGE_RE = re.compile(r"(..*?)\s?=\s?(.*)")

frontend_dir = os.path.join(ROOT_DIR, f"taipy-fe")

# Fetch files
def move_files(repo: str, src_path: str):
Expand Down Expand Up @@ -196,13 +197,6 @@ def move_files(repo: str, src_path: str):
text=True)
os.chdir(saved_dir)
else:
tmp_dir = os.path.join(ROOT_DIR, f"{repo}.tmp")
safe_rmtree(tmp_dir)
gui_dir = os.path.join(ROOT_DIR, f"gui") if repo == "taipy-gui" else None
if repo == "taipy-gui" and os.path.isdir(gui_dir):
if os.path.isdir(os.path.join(gui_dir, "node_modules")):
shutil.move(os.path.join(gui_dir, "node_modules"), os.path.join(ROOT_DIR, f"gui_node_modules"))
shutil.rmtree(gui_dir)
try:
def copy_source(src_path: str, repo: str):
def copy(item: str, src: str, dst: str, rel_path: str):
Expand All @@ -229,26 +223,33 @@ def copy(item: str, src: str, dst: str, rel_path: str):
dest_path = os.path.join(ROOT_DIR, "taipy")
if not os.path.exists(dest_path):
os.makedirs(dest_path)
src_path = os.path.join(src_path, "src", "taipy")
for item in os.listdir(src_path):
copy(item, src_path, dest_path, "")
sources_path = os.path.join(src_path, "taipy")
# Packages using the 'src' directory to hold source files
if not os.path.exists(sources_path):
sources_path = os.path.join(src_path, "src", "taipy")
for item in os.listdir(sources_path):
copy(item, sources_path, dest_path, "")
copy_source(src_path, repo)

if gui_dir:
if not os.path.isdir(gui_dir):
os.mkdir(gui_dir)
src_gui_dir = os.path.join(src_path, "gui")
shutil.copytree(os.path.join(src_gui_dir, "src"), os.path.join(gui_dir, "src"))
for f in [f for f in os.listdir(src_gui_dir) if f.endswith(".md") or f.endswith(".json")]:
shutil.copy(os.path.join(src_gui_dir, f), os.path.join(gui_dir, f))
if os.path.isdir(os.path.join(ROOT_DIR, "gui_node_modules")):
shutil.move(os.path.join(ROOT_DIR, "gui_node_modules"), os.path.join(gui_dir, "node_modules"))
# Copy Taipy GUI front end code
if repo == "taipy":
if not os.path.isdir(frontend_dir):
os.mkdir(frontend_dir)
fe_src_dir = os.path.join(src_path, "frontend", "taipy-gui")
shutil.copytree(os.path.join(fe_src_dir, "src"), os.path.join(frontend_dir, "src"))
for f in [f for f in os.listdir(fe_src_dir) if f.endswith(".md") or f.endswith(".json")]:
shutil.copy(os.path.join(fe_src_dir, f), os.path.join(frontend_dir, f))
finally:
pass
"""
shutil.rmtree(tmp_dir)
"""

frontend_dir = os.path.join(ROOT_DIR, f"taipy-fe")
if os.path.isdir(os.path.join(frontend_dir, "node_modules")):
shutil.move(os.path.join(frontend_dir, "node_modules"), os.path.join(ROOT_DIR, f"fe_node_modules"))
if os.path.isdir(os.path.join(frontend_dir)):
shutil.rmtree(frontend_dir)

for repo in repo_defs.keys():
if repo_defs[repo].get("skip", False):
Expand Down Expand Up @@ -291,6 +292,9 @@ def handleRemoveReadonly(func, path, exc):

shutil.rmtree(clone_dir, onerror=handleRemoveReadonly)

if os.path.isdir(os.path.join(ROOT_DIR, "fe_node_modules")) and os.path.isdir(os.path.join(frontend_dir)):
shutil.move(os.path.join(ROOT_DIR, "fe_node_modules"), os.path.join(frontend_dir, "node_modules"))

# Manually add the taipy.run() function.
# TODO: Automate this, grabbing the function from the 'taipy' repository,
# so we benefit from potential updates.
Expand Down

0 comments on commit ef3daaf

Please sign in to comment.