-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added pyproject.toml packaging files
- Loading branch information
Chris Antonellis
committed
Feb 1, 2021
1 parent
5c38670
commit d34187e
Showing
5 changed files
with
61 additions
and
0 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,24 @@ | ||
set -euo pipefail | ||
|
||
MODULE_NAME=$1 | ||
|
||
echo "Ensuring pip is up to date" | ||
python -m pip install --upgrade pip | ||
echo "Installing the PyPA build package" | ||
pip build | ||
|
||
echo "--------------" | ||
echo "Building wheel" | ||
python -m build | ||
|
||
APP_DIR=$(pwd) | ||
|
||
# move into root dir so Python will import the installed package instead of the local source files | ||
cd / | ||
echo "------------------" | ||
echo "Installing package" | ||
pip install ${APP_DIR}/dist/*.whl | ||
|
||
echo "-----------------------------" | ||
echo "Attempting to import package" | ||
python "${GITHUB_ACTION_PATH}/test_module_import.py" "${MODULE_NAME}" |
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,12 @@ | ||
name: "Verify Python Wheel" | ||
description: "Build a wheel for the package and importing the package doesn't cause an error" | ||
inputs: | ||
package-import-name: | ||
description: "Name used to import the package from python code" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "Verify wheel" | ||
run: "$GITHUB_ACTION_PATH/action.sh ${{ inputs.package-import-name }}" | ||
shell: "bash" |
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,15 @@ | ||
import importlib | ||
import sys | ||
|
||
try: | ||
module_name = sys.argv[1] | ||
except IndexError: | ||
print("module_name must be provided as first argument to test_module_import.py script") | ||
sys.exit(1) | ||
|
||
try: | ||
module = importlib.import_module(module_name) | ||
except Exception as e: | ||
print(f"Error importing module {module_name}: {e}") | ||
sys.exit(1) | ||
print(f"Imported {module_name} version {module.__version__}") |
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,3 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" |
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,7 @@ | ||
[metadata] | ||
name = extra-model | ||
version = 0.0.1 | ||
description = extra model description | ||
|
||
[options] | ||
packages = find: |