Skip to content

Commit

Permalink
chore: update pyproject.toml in packing action
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoandre-avaiga committed Aug 7, 2024
1 parent 0628b4d commit a1a3433
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,28 @@ jobs:
with:
python-version: ${{ matrix.python-versions }}

- name: Install Dependencies
run: |
pip install toml
- name: Build frontends
run: |
python tools/frontend/bundle_build.py
- name: Install Taipy without dependencies
- name: Update pyproject.toml
run: |
python tools/release/setup_project.py taipy/config
python tools/release/setup_project.py taipy/core
python tools/release/setup_project.py taipy/gui
python tools/release/setup_project.py taipy/rest
python tools/release/setup_project.py taipy/templates
python tools/release/setup_project.py .
- name: Install Taipy Subpackages
run: |
pip install taipy/config taipy/core taipy/gui taipy/rest taipy/templates
- name: Install Taipy
run: |
pip install .
Expand Down
20 changes: 11 additions & 9 deletions tools/release/setup_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import toml # type: ignore


def get_requirements(pkg: str):
def get_requirements(pkg: str, env: str = "dev") -> list:
# get requirements from the different setups in tools/packages (removing taipy packages)
reqs = set()
pkg_name = pkg if pkg == "taipy" else f"taipy-{pkg}"
Expand All @@ -29,7 +29,9 @@ def get_requirements(pkg: str):
requirements_file = os.path.join(package_path, "setup.requirements.txt")
if os.path.exists(requirements_file):
reqs.update(Path(requirements_file).read_text("UTF-8").splitlines())
return [r for r in reqs if r and not r.startswith("taipy")]
if env == "dev":
return [r for r in reqs if r and not r.startswith("taipy")]
return list(reqs)


def update_pyproject(version_path: str, pyproject_path: str):
Expand All @@ -44,7 +46,7 @@ def update_pyproject(version_path: str, pyproject_path: str):
pyproject_data["project"]["urls"]["Release notes"] = f"https://docs.taipy.io/en/release-{version_string}/relnotes/"
pyproject_data["project"]["dependencies"] = get_requirements(get_pkg_name(pyproject_path))

with open(pyproject_path, "w") as pyproject_file:
with open(pyproject_path, "w", encoding="utf-8") as pyproject_file:
toml.dump(pyproject_data, pyproject_file)


Expand All @@ -57,7 +59,7 @@ def _build_webapp(webapp_path: str):

def get_pkg_name(path: str) -> str:
# The regex pattern
pattern = r"([^/]+)/pyproject\.toml$"
pattern = r"([^/\\]+)[/\\]pyproject\.toml$"

# Search for the pattern
match = re.search(pattern, os.path.abspath(path))
Expand All @@ -67,15 +69,15 @@ def get_pkg_name(path: str) -> str:


if __name__ == "__main__":
_pyproject_path = f"{sys.argv[1]}/pyproject.toml"
_pyproject_path = os.path.join(sys.argv[1], "pyproject.toml")

pkg = get_pkg_name(_pyproject_path)
if pkg == "taipy":
_version_path = f"{sys.argv[1]}/taipy/version.json"
_webapp_path = f"{sys.argv[1]}/taipy/gui/webapp/index.html"
_version_path = os.path.join(sys.argv[1], "taipy", "version.json")
_webapp_path = os.path.join(sys.argv[1], "taipy", "gui", "webapp", "index.html")
else:
_version_path = f"{sys.argv[1]}/version.json"
_webapp_path = f"{sys.argv[1]}/webapp/index.html"
_version_path = os.path.join(sys.argv[1], "version.json")
_webapp_path = os.path.join(sys.argv[1], "webapp", "index.html")

update_pyproject(_version_path, _pyproject_path)

Expand Down

0 comments on commit a1a3433

Please sign in to comment.