Skip to content

Commit

Permalink
DRAFT enable publish of tools/model_explorer_circle
Browse files Browse the repository at this point in the history
on-going draft to enable publish of tools/model_explorer_circle.

Signed-off-by: SaeHie Park <[email protected]>
  • Loading branch information
seanshpark committed Nov 25, 2024
1 parent 2d19014 commit 408c247
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 7 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/pub-tools-mec-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish model-explorer-circle to pypi

on:
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install build dependencies
run: python -m pip install -U setuptools wheel build

- name: Build
run: |
cd tools/model_explorer_circle/
python -m build .
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: tools/model_explorer_circle/dist/
skip-existing: false
user: __token__
password: ${{ secrets.MEC_PYPI_API }}
6 changes: 2 additions & 4 deletions .github/workflows/run-tools-mec-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ jobs:
test:
strategy:
matrix:
# TODO add more versions
python: ['3.10']
# TODO add more platforms
platform: [ubuntu-latest]
python: ['3.10'] # ['3.10', '3.11', '3.12']
platform: [ubuntu-latest] # [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.platform }}

Expand Down
24 changes: 24 additions & 0 deletions tools/model_explorer_circle/HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,27 @@ pytest
flatc -p --gen-onefile --gen-object-api circle_schema.fbs
```
* Note: For `--gen-onefile` option, you need to use the latest version of `flatc`. (tested version = v24.3.25)

## How to local build with nox

Use separate virtual-env:
```
python3 -m venv venv
source venv/bin/activate
```

Install tools:
```
python3 -m pip install --upgrade nox build
```

To run unit tests:
```
python3 -m nox -s tests-3.xx
```
- where `xx` is your python version, for example `10`

To build package:
```
python3 -m build .
```
11 changes: 11 additions & 0 deletions tools/model_explorer_circle/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,21 @@
import os
import nox

nox.options.sessions = ["lint"]

# Define the minimal nox version required to run
nox.options.needs_version = ">= 2024.3.2"


@nox.session
def lint(session):
# NOTE no need to run lint, as format checker runs with yapf including this project
session.install("yapf==0.40.2")
session.run("yapf", "--verbose", "--in-place", "--recursive", "--exclude",
"src/circle_adapter/circle_schema_generated.py", "noxfile.py", "./src",
"./tests")


@nox.session
def build_and_check_dists(session):
session.install("build", "check-manifest >= 0.42", "twine", "ai-edge-model-explorer",
Expand Down
2 changes: 1 addition & 1 deletion tools/model_explorer_circle/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "model-explorer-circle"
version = "0.0.1"
version = "0.0.2"
maintainers = [
{ name="NNFW", email="[email protected]" },
]
Expand Down
2 changes: 0 additions & 2 deletions tools/model_explorer_circle/src/circle_adapter/__init__.py

This file was deleted.

0 comments on commit 408c247

Please sign in to comment.