Skip to content

Commit

Permalink
add UI for install all (#13732)
Browse files Browse the repository at this point in the history
* add UI for install all
  • Loading branch information
Borda authored Jul 28, 2022
1 parent 511875e commit a58a406
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 21 deletions.
19 changes: 19 additions & 0 deletions .github/actions/pkg-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,22 @@ runs:
- name: copy/export pkg
run: cp dist/* pypi/
shell: bash

- name: Unzip packages
if: ${{ inputs.pkg-name != '' }}
working-directory: dist
run: for file in `ls *.gz`; do tar -xzf $file; done
shell: bash

- name: Check single pkg/folder
if: ${{ inputs.pkg-name != '' }}
working-directory: dist
run: |
import os, glob, pathlib, shutil
# list folders without ending .egg-info
dirs = [d for d in glob.glob(os.path.join("*", "src", "*")) if not d.endswith(".egg-info")]
print(dirs)
assert len(dirs) == 1
# cleaning
shutil.rmtree(pathlib.Path(dirs[0]).parent.parent)
shell: python
23 changes: 17 additions & 6 deletions .github/actions/pkg-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ description: installing and validationg the package
inputs:
pkg-name:
description: package name for import
required: true
required: false
default: ""
pip-flags:
description: additional pil install flags
required: false
Expand All @@ -13,21 +14,31 @@ inputs:
runs:
using: "composite"
steps:
- name: Determine package name
if: ${{ inputs.pkg-import == '' }}
working-directory: ./dist
run: python -c "import glob ; ls = glob.glob('*.tar.gz') ; name = '_'.join(ls[0].split('-')[:-1]) ; print(f'PKG_NAME={name}')" >> $GITHUB_ENV
shell: bash

- name: Pass package name
if: ${{ inputs.pkg-import != '' }}
run: echo "PKG_NAME=${{ inputs.pkg-name }}" >> $GITHUB_ENV
shell: bash

- name: Install | Uninstall package - archive
working-directory: ./dist
run: |
pip install *.tar.gz ${{ inputs.pip-flags }}
pip install *.tar.gz ${PKG_NAME}
pip list | grep lightning
python -c "import ${{ inputs.pkg-name }} ; print(${{ inputs.pkg-name }}.__version__)"
pip uninstall -y ${{ inputs.pkg-name }}
python -c "import ${PKG_NAME} ; print(${PKG_NAME}.__version__)"
pip uninstall -y ${PKG_NAME}
shell: bash

- name: Install | Uninstall package - wheel
working-directory: ./dist
run: |
pip install *.whl ${{ inputs.pip-flags }}
pip list | grep lightning
python -c "import ${{ inputs.pkg-name }} ; print(${{ inputs.pkg-name }}.__version__)"
pip uninstall -y ${{ inputs.pkg-name }}
python -c "import ${PKG_NAME} ; print(${PKG_NAME}.__version__)"
pip uninstall -y ${PKG_NAME}
shell: bash
7 changes: 0 additions & 7 deletions .github/workflows/ci_pkg-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,7 @@ jobs:
name: ci-packages-${{ github.sha }}
path: pypi

- name: Determine package name
if: ${{ inputs.pkg-import == '' }}
working-directory: ./dist
run: python -c "import glob ; ls = glob.glob('*.tar.gz') ; name = '_'.join(ls[0].split('-')[:-1]) ; print(f'PKG_NAME={name}')" >> $GITHUB_ENV

- uses: ./.github/actions/pkg-install
with:
pkg-name: ${{ env.PKG_NAME }}

install-meta-src:
needs: install-standalone
Expand Down
17 changes: 9 additions & 8 deletions src/lightning/__setup__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,23 @@ def _adjust_manifest(**kwargs: Any) -> None:
manifest_path = os.path.join(_PROJECT_ROOT, "MANIFEST.in")
assert os.path.isfile(manifest_path)
with open(manifest_path) as fp:
lines = fp.readlines()
lines = [ln.rstrip() for ln in fp.readlines()]
if kwargs["pkg_name"] == "lightning":
lines += [
"recursive-include src/lightning *.md" + os.linesep,
"recursive-include src/lightning *.md",
# fixme: this is strange, this shall work with setup find package - include
"prune src/lightning_app" + os.linesep,
"prune src/pytorch_lightning" + os.linesep,
"prune src/lightning_app",
"prune src/pytorch_lightning",
]
else:
lines += [
"recursive-include src *.md" + os.linesep,
"recursive-include requirements *.txt" + os.linesep,
"recursive-include src/lightning_app/cli/*-template *" + os.linesep, # Add templates
"recursive-include src *.md",
"recursive-include requirements *.txt",
"recursive-include src/lightning_app/ui *",
"recursive-include src/lightning_app/cli/*-template *", # Add templates as build-in
]
with open(manifest_path, "w") as fp:
fp.writelines(lines)
fp.writelines([ln + os.linesep for ln in lines])


def _setup_args(**kwargs: Any) -> Dict[str, Any]:
Expand Down

0 comments on commit a58a406

Please sign in to comment.