-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from reactome/poetry-test
poetry-check
- Loading branch information
Showing
5 changed files
with
380 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: 'Setup Python and Poetry' | ||
description: 'Setup Python environment and install Poetry' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
pip install --upgrade pip | ||
pip install poetry==1.8.4 | ||
poetry install --no-root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import importlib.machinery | ||
import importlib.util | ||
import traceback | ||
from pathlib import Path | ||
|
||
# List all entry points here | ||
entry_points: list[Path] = list( | ||
map( | ||
Path("bin").joinpath, | ||
[ | ||
"chat-chainlit.py", | ||
"chat-fastapi.py", | ||
"embeddings_manager", | ||
], | ||
) | ||
) | ||
|
||
failed_imports: list[str] = [] | ||
|
||
location: Path | ||
for location in entry_points: | ||
name: str = location.stem | ||
try: | ||
loader = importlib.machinery.SourceFileLoader(name, str(location)) | ||
spec = importlib.util.spec_from_loader(name, loader) | ||
if spec is None: | ||
raise ModuleNotFoundError(name) | ||
module = importlib.util.module_from_spec(spec) | ||
loader.exec_module(module) | ||
except ImportError: | ||
failed_imports.append(name) | ||
print(f"Failed to import {location} due to ImportError:") | ||
traceback.print_exc() | ||
except Exception as e: | ||
print(f"Non-import error for {location}: {e}") | ||
traceback.print_exc() | ||
|
||
if failed_imports: | ||
print(f"Failed to import: {", ".join(failed_imports)}") | ||
exit(1) | ||
else: | ||
print("All entry points imported successfully.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.