Skip to content

Commit

Permalink
chore: move python host to packages folder
Browse files Browse the repository at this point in the history
  • Loading branch information
freaz committed Sep 11, 2023
1 parent 006ff60 commit 1f63476
Show file tree
Hide file tree
Showing 21 changed files with 39 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: host/python
working-directory: packages/python_host
steps:
# checkout
- uses: actions/checkout@v3
Expand All @@ -154,11 +154,11 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: core-wasm
path: host/python/src/one_sdk/assets
path: packages/python_host/src/one_sdk/assets
- uses: actions/download-artifact@v3
with:
name: test-core-wasm
path: host/python/src/one_sdk/assets
path: packages/python_host/src/one_sdk/assets
# test and build
- name: Install dependencies and package locally
run: python -m pip install .
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,25 +245,25 @@ jobs:
run: scripts/release-level.sh ${{ inputs.release-level }} ${{ inputs.release-kind }} >>$GITHUB_OUTPUT
- name: Resolve release version
id: release-version
run: scripts/release-version.sh ./host/python/VERSION ${{ steps.release-level.outputs.RELEASE_LEVEL }} ${{ steps.release-level.outputs.RELEASE_PREID }} >>$GITHUB_OUTPUT
run: scripts/release-version.sh ./packages/python_host/VERSION ${{ steps.release-level.outputs.RELEASE_LEVEL }} ${{ steps.release-level.outputs.RELEASE_PREID }} >>$GITHUB_OUTPUT
# Update version
- name: Update version in pyproject
working-directory: host/python
working-directory: packages/python_host
run: toml set --toml-path pyproject.toml project.version ${{ steps.release-version.outputs.RELEASE_VERSION }}
# Build
- uses: actions/download-artifact@v3
with:
name: core-wasm
path: host/python/src/one_sdk/assets
- name: Build host/python
working-directory: host/python
path: packages/python_host/src/one_sdk/assets
- name: Build packages/python_host
working-directory: packages/python_host
run: python -m build
# Changelog
- name: Update changelog
uses: superfaceai/release-changelog-action@v1
if: ${{ steps.release-level.outputs.RELEASE_TAG == 'latest' }}
with:
path-to-changelog: host/python/CHANGELOG.md
path-to-changelog: packages/python_host/CHANGELOG.md
version: ${{ steps.release-version.outputs.RELEASE_VERSION }}
operation: release
# Commit release changes
Expand All @@ -272,12 +272,12 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions release workflow"
- name: Commit pyproject.toml, VERSION, CHANGELOG.md and create git tag
working-directory: host/python
working-directory: packages/python_host
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add pyproject.toml VERSION CHANGELOG.md
git commit -m "chore: release host/python ${{ steps.release-version.outputs.RELEASE_VERSION }}"
git commit -m "chore: release packages/python_host ${{ steps.release-version.outputs.RELEASE_VERSION }}"
git tag "python-v${{ steps.release-version.outputs.RELEASE_VERSION }}"
git push origin
git push origin --tags
Expand All @@ -297,7 +297,7 @@ jobs:
id: get-changelog
uses: superfaceai/release-changelog-action@v1
with:
path-to-changelog: host/python/CHANGELOG.md
path-to-changelog: packages/python_host/CHANGELOG.md
version: ${{ steps.get-changelog-version.outputs.VERSION }}
operation: read
- name: Update GitHub release documentation
Expand Down Expand Up @@ -328,17 +328,17 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: core-wasm
path: host/python/src/one_sdk/assets
path: packages/python_host/src/one_sdk/assets
- name: Copy LICENSE
run: cp LICENSE host/python/LICENSE
- name: Build host/python
working-directory: host/python
run: cp LICENSE packages/python_host/LICENSE
- name: Build packages/python_host
working-directory: packages/python_host
run: python -m build
# Publish
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: host/python/dist
packages-dir: packages/python_host/dist
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

Expand Down
34 changes: 19 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ CORE_SCHEMA_ASSETS_SECURITY_VALUES=${CORE_SCHEMA_ASSETS}/security_values.json
CORE_SCHEMA_ASSETS_PARAMETERS_VALUES=${CORE_SCHEMA_ASSETS}/parameters_values.json
SECURITY_VALUES_JSON_SCHEMA=core/json_schemas/src/schemas/security_values.json
PARAMETERS_VALUES_JSON_SCHEMA=core/json_schemas/src/schemas/parameters_values.json
# Hosts
# packages
HOST_JAVASCRIPT_ASSETS=host/javascript/assets
HOST_PYTHON_ASSETS=host/python/src/one_sdk/assets
PYTHON_HOST_ASSETS=packages/python_host/src/one_sdk/assets

all: clean build

Expand Down Expand Up @@ -144,11 +144,11 @@ clean_integration:
##########
## HOST ##
##########
build_hosts: build_host_javascript build_host_python
build_hosts: build_host_javascript
clean_hosts:
rm -rf ${HOST_JAVASCRIPT_ASSETS}
cd host/javascript && yarn clean
rm -rf ${HOST_PYTHON_ASSETS}
rm -rf ${PYTHON_HOST_ASSETS}

# copy wasm always because cached docker artifacts can have older timestamp
build_host_javascript: ${CORE_ASYNCIFY_WASM}
Expand All @@ -160,16 +160,20 @@ test_host_javascript: build_host_javascript ${TEST_CORE_ASYNCIFY_WASM}
cp ${TEST_CORE_ASYNCIFY_WASM} ${HOST_JAVASCRIPT_ASSETS}/test-core-async.wasm
cd host/javascript && yarn test

deps_host_python:
cd host/python; test -d venv || python3 -m venv venv; source venv/bin/activate; \
python3 -m pip install -e .

build_host_python: deps_host_python ${CORE_WASM}
mkdir -p ${HOST_PYTHON_ASSETS}
cp ${CORE_WASM} ${HOST_PYTHON_ASSETS}/core.wasm
# TODO: build?
##############
## PACKAGES ##
##############

test_host_python: build_host_python ${TEST_CORE_WASM}
cp ${TEST_CORE_WASM} ${HOST_PYTHON_ASSETS}/test-core.wasm
cd host/python; source venv/bin/activate; \
python3 -m unittest discover tests/
build_packages: build_python_host
deps_python_host:
cd packages/python_host; test -d venv || python3 -m venv venv; source venv/bin/activate; \
python3 -m pip install -e .
build_python_host: deps_python_host ${CORE_WASM}
mkdir -p ${PYTHON_HOST_ASSETS}
cp ${CORE_WASM} ${PYTHON_HOST_ASSETS}/core.wasm
# TODO: build?
test_python_host: build_python_host ${TEST_CORE_WASM}
cp ${TEST_CORE_WASM} ${PYTHON_HOST_ASSETS}/test-core.wasm
cd packages/python_host; source venv/bin/activate; \
python3 -m unittest discover tests/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The OneSDK uses these environment variables:
- [🦄 JavaScript/TypeScript](https://github.com/superfaceai/one-sdk/tree/main/host/javascript)
- [Node.js](https://github.com/superfaceai/one-sdk/tree/main/host/javascript/src/node)
- [Cloudflare Workers](https://github.com/superfaceai/one-sdk/tree/main/host/javascript/src/cloudflare)
- [🐍 Python](https://github.com/superfaceai/one-sdk/tree/main/host/python)
- [🐍 Python](https://github.com/superfaceai/one-sdk/tree/main/packages/python_host)

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion examples/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ case $1 in
make build_host_python $MAKE_FLAGS
fi
cd "$base"
source ../host/python/venv/bin/activate
source ../packages/python_host/venv/bin/activate
python3 ./python
;;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
]

[project.urls]
"Homepage" = "https://github.com/superfaceai/one-sdk/tree/main/host/python"
"Homepage" = "https://github.com/superfaceai/one-sdk/tree/main/packages/python_host"
"Bug Tracker" = "https://github.com/superfaceai/one-sdk/issues"

[build-system]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1f63476

Please sign in to comment.