Skip to content

Commit

Permalink
Add wheel build
Browse files Browse the repository at this point in the history
  • Loading branch information
augray committed Dec 12, 2024
1 parent beb2d5a commit a160ccc
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 100 deletions.
95 changes: 0 additions & 95 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ commands:
pkg-manager: pip
app-dir: ~/project/requirements # If you're requirements.txt isn't in the root directory.
pip-dependency-file: ci-requirements.txt # if you have a different name for your requirements file, maybe one that combines your runtime and test requirements.
install-uv-deps:
description: Install Dependencies Via UV
steps:
- run:
name: Py-prep
command: make py-prep
install-npm-dependencies:
description: Install NPM dependencies in the UI folder
steps:
Expand Down Expand Up @@ -57,27 +51,6 @@ commands:
- run:
name: Check DB Schema
command: make migrate_up_sqlite && make update-schema && git diff --exit-code

non-coverage-tests:
description: Do tests without tracking code coverage
steps:
# Pre-build Sematic so we can retry if there are errors due to downloading deps
- run:
name: Pre-build Sematic
command: |
PATH="$PATH:$CIRCLE_WORKING_DIRECTORY/.circleci/"
retry 5 bazel build --experimental_repository_downloader_retries=5 //sematic/...
- run:
name: Run Non-coverage Tests
# This assumes pytest is installed via the install-package step above
command: PYTHONUNBUFFERED=1 bazel test --experimental_repository_downloader_retries=5 --action_env=RUN_SLOW_TESTS=1 //sematic/... --test_output=all
non-coverage-tests-uv:
description: Do tests without tracking code coverage
steps:
- run:
name: Run Non-coverage Tests
command: source ./.venv/bin/activate && .venv/bin/pytest

installation-tests:
description: Do a test of installing sematic via wheel
steps:
Expand Down Expand Up @@ -115,22 +88,6 @@ jobs:
- .pyenv
- .cache/Cypress
- project
uv-init:
docker:
- image: $SEMATIC_CI_IMAGE
auth:
username: $SEMATIC_DOCKERHUB_USER
password: $SEMATIC_DOCKERHUB_PASSWORD
steps:
- checkout
- install-uv-deps
- install-npm-dependencies
- persist_to_workspace:
root: /home/circleci
paths:
- .venv
- .cache/uv
- project

lint:
docker:
Expand All @@ -153,52 +110,6 @@ jobs:
- attach_workspace:
at: /home/circleci
- validate-schemas

unit-tests:
docker:
- image: $SEMATIC_CI_IMAGE
auth:
username: $SEMATIC_DOCKERHUB_USER
password: $SEMATIC_DOCKERHUB_PASSWORD
steps:
- attach_workspace:
at: /home/circleci
# Uncomment to profile CPU/Memory
# - run:
# name: Profile CPU and memory (background)
# command: |
# while true; do
# sleep 2
# printf "\n\n$(date)\n"
# top -b -c -n 1
# echo "======"
# done
# background: true
- non-coverage-tests
uv-unit-tests:
docker:
- image: $SEMATIC_CI_IMAGE
auth:
username: $SEMATIC_DOCKERHUB_USER
password: $SEMATIC_DOCKERHUB_PASSWORD
steps:
- checkout
- run:
name: Py-prep
command: make py-prep
# Uncomment to profile CPU/Memory
# - run:
# name: Profile CPU and memory (background)
# command: |
# while true; do
# sleep 2
# printf "\n\n$(date)\n"
# top -b -c -n 1
# echo "======"
# done
# background: true
- non-coverage-tests-uv

installation:
docker:
- image: $SEMATIC_CI_IMAGE
Expand Down Expand Up @@ -283,10 +194,6 @@ workflows:
- schemas:
requires:
- init
- unit-tests:
requires:
- init
- uv-unit-tests
- installation:
requires:
- init
Expand All @@ -298,9 +205,7 @@ workflows:
- init
- finalize:
requires:
- uv-unit-tests
- lint
- schemas
- unit-tests
- integration-test
- fe-unit-tests
4 changes: 4 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ jobs:
run: |
source .venv/bin/activate
pytest
- name: Wheel
run: |
make ui
make wheel
12 changes: 12 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
exclude sematic/examples/lightning_resnet/*.jpg
exclude sematic/examples/summarization_finetune/images/*.jpg
exclude sematic/examples/hackernews_summarization/*.png
exclude sematic/examples/cifar_classifier/*.jpg
recursive-include sematic/ui/build *
recursive-exclude sematic/ui/packages *
recursive-exclude sematic/examples *.jpg
recursive-exclude sematic/examples *.png
recursive-exclude sematic/ tests/*
recursive-exclude sematic/ BUILD
global-exclude *.tsx
global-exclude *.ts
26 changes: 22 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,34 @@ wheel : sematic/ui/build
rm README.nohtml
bazel build //sematic:wheel

uv-wheel:
cat README.md | \
grep -v "<img" | \
grep -v "<p" | \
grep -v "/p>" | \
grep -v "<h2" | \
grep -v "/h2>" | \
grep -v "<h3" | \
grep -v "/h3>" | \
grep -v "<a" | \
grep -v "/a>" | \
grep -v "/img>" > README.nohtml
uvx m2r --overwrite README.nohtml
cp BUILD tmp.BUILD
rm -rf dist build src/*.egg-info
uvx pip wheel -w dist . && rm -rf build && mv tmp.BUILD BUILD
rm README.nohtml

test-release:
python3 -m twine check bazel-bin/sematic/*.whl
python3 -m twine upload --repository testpypi bazel-bin/sematic/*.whl
uvx twine check ./dist/*sematic*.whl
uvx twine upload --repository testpypi ./dist/*sematic*.whl

release:
python3 -m twine upload bazel-bin/sematic/*.whl
uvx twine upload ./dist/*sematic*.whl

release-server:
rm -f docker/*.whl
cp bazel-bin/sematic/*.whl docker/
cp ./dist/*sematic*.whl docker/
cd docker; docker build --build-arg EXTRA=default -t sematic/sematic-server:${TAG} -f Dockerfile.server .
docker push sematic/sematic-server:${TAG}
cd docker; docker build --build-arg EXTRA=all -t sematic/sematic-server-ee:${TAG} -f Dockerfile.server .
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies = [

# Code
"pyyaml>=6.0.1",
"python-magic>=0.4.27",

# Git integration
"git-python>=1.0.3",
Expand Down Expand Up @@ -56,6 +57,17 @@ py-modules = [
"sematic",
]

[tool.setuptools.packages.find]
where = ["."]
include = ["sematic*"]
exclude = ["tests*", "*.tests*"]

[tool.setuptools.package-data]
sematic = ["sematic/ui/build/**/*"]

[project.scripts]
sematic = "sematic.cli.main:cli"

[project.optional-dependencies]
examples = [
# Examples
Expand Down
2 changes: 1 addition & 1 deletion tools/sematic_wheel_rule.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,4 @@ tries to locate `.runfiles` directory which is not packaged in the wheel.
_entrypoint_attrs,
_other_attrs,
),
)
)

0 comments on commit a160ccc

Please sign in to comment.