Skip to content

Commit

Permalink
chore: Move python code to its own directory
Browse files Browse the repository at this point in the history
  • Loading branch information
thomass-dev committed Oct 4, 2024
1 parent 8144a03 commit 7efa77a
Show file tree
Hide file tree
Showing 64 changed files with 173 additions and 179 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
changes:
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
skore: ${{ steps.filter.outputs.skore }}
skore-ui: ${{ steps.filter.outputs.skore-ui }}
permissions:
pull-requests: read
Expand All @@ -15,12 +15,12 @@ jobs:
id: filter
with:
filters: |
backend:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- 'requirements*.txt'
- '.github/workflows/backend.yml'
skore:
- 'skore/src/**'
- 'skore/tests/**'
- 'skore/pyproject.toml'
- 'skore/requirements*.txt'
- '.github/workflows/skore.yml'
skore-ui:
- 'skore-ui/**'
- '.github/workflows/skore-ui.yml'
Expand All @@ -30,10 +30,10 @@ jobs:
permissions:
contents: read

lint-and-test-backend:
lint-and-test-skore:
needs: [lint-all-files, changes]
if: ${{ needs.changes.outputs.backend == 'true' }}
uses: ./.github/workflows/backend.yml
if: ${{ needs.changes.outputs.skore == 'true' }}
uses: ./.github/workflows/skore.yml
permissions:
contents: read

Expand All @@ -48,7 +48,7 @@ jobs:
ci-all-green:
needs:
- lint-all-files
- lint-and-test-backend
- lint-and-test-skore
- lint-and-test-skore-ui
if: ${{ always() }}
runs-on: Ubuntu-latest
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: make build-skore-ui

- name: Override VERSION.txt with tag
run: echo "${GITHUB_REF_NAME}" > VERSION.txt
run: echo "${GITHUB_REF_NAME}" > skore/VERSION.txt

- name: Set up Python 3.12
uses: actions/setup-python@v5
Expand All @@ -46,19 +46,21 @@ jobs:
- name: Build package distributions
run: |
python -m pip install build
cd skore
python -m build
- name: Checks whether distribution’s long description will render correctly on PyPI
continue-on-error: true
run: |
python -m pip install twine
python -m twine check dist/*
python -m twine check skore/dist/*
- name: Upload package distributions
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
path: skore/dist/

publish:
name: Publish package distributions to TestPyPI using trusted publisher
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/skore-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Reusable skore-ui workflow

on: [workflow_call]

defaults:
run:
shell: 'bash'
working-directory: './skore-ui'

jobs:
lint-skore-ui:
runs-on: ubuntu-latest
Expand All @@ -14,8 +19,6 @@ jobs:
cache-dependency-path: skore-ui/package-lock.json
- name: Lint skore-ui
run: |
cd skore-ui
npm install
npm run type-check
npm run lint
Expand All @@ -34,8 +37,6 @@ jobs:
cache-dependency-path: skore-ui/package-lock.json
- name: Test skore-ui
run: |
cd skore-ui
npm install
npm run test:unit:coverage
- name: Report coverage
Expand All @@ -56,10 +57,7 @@ jobs:
cache: 'npm'
cache-dependency-path: skore-ui/package-lock.json
- name: Build skore-ui
shell: bash
run: |
cd skore-ui
npm install
npm run build
npm run build:lib -- --emptyOutDir false
45 changes: 24 additions & 21 deletions .github/workflows/backend.yml → .github/workflows/skore.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: Reusable backend workflow
name: Reusable skore workflow

on: [workflow_call]

jobs:
build-skore-ui:
runs-on: ubuntu-latest
defaults:
run:
shell: 'bash'
working-directory: './skore-ui'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -14,8 +18,6 @@ jobs:
cache-dependency-path: skore-ui/package-lock.json
- shell: bash
run: |
cd skore-ui
npm install
npm run build
npm run build:lib -- --emptyOutDir false
Expand All @@ -24,51 +26,52 @@ jobs:
name: skore-ui-package-distributions
path: skore-ui/dist

test-backend:
test-skore:
runs-on: ubuntu-latest
needs: build-skore-ui
defaults:
run:
shell: 'bash'
working-directory: './skore'
strategy:
fail-fast: true
matrix:
python-version: ['3.11', '3.12']

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Lint
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pre-commit
pre-commit run --all-files ruff
- name: Download package distributions
uses: actions/download-artifact@v4
with:
name: skore-ui-package-distributions
path: src/skore/ui/static

- name: Build
path: skore/src/skore/ui/static
- name:
timeout-minutes: 10
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pre-commit
python -m pip install --upgrade build
# Lint
pre-commit run --all-files ruff
# Build
python -m build
- name: Install
run: |
# Install
python -m pip install dist/*.whl --no-dependencies
python -m pip install -r requirements.txt -r requirements-test.txt
- name: Test
timeout-minutes: 5
run: python -m pytest
# Test
python -m pytest
cleanup:
runs-on: ubuntu-latest
if: always()
needs: test-backend
needs: test-skore
steps:
- uses: geekyeggo/delete-artifact@v5
with:
Expand Down
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

1 change: 1 addition & 0 deletions LICENSE
59 changes: 24 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,37 @@
SKORE_ROOT ?= ".datamander"

pip-compile:
pip-compile --output-file=requirements.txt pyproject.toml
pip-compile --extra=test --output-file=requirements-test.txt pyproject.toml
pip-compile --extra=tools --output-file=requirements-tools.txt pyproject.toml
python -m piptools compile --output-file=skore/requirements.txt skore/pyproject.toml
python -m piptools compile --extra=test --output-file=skore/requirements-test.txt skore/pyproject.toml
python -m piptools compile --extra=tools --output-file=skore/requirements-tools.txt skore/pyproject.toml

install:
install-skore:
python -m pip install \
-e . \
-r requirements.txt \
-r requirements-test.txt \
-r requirements-tools.txt
pre-commit install

check-wip:
pre-commit run --all-files
python -m pytest tests

serve-api:
SKORE_ROOT=$(SKORE_ROOT) python -m uvicorn \
--factory skore.ui.app:create_app \
--reload --reload-dir ./src \
--host 0.0.0.0 \
--port 22140 \
--timeout-graceful-shutdown 0
-e skore/ \
-r skore/requirements.txt \
-r skore/requirements-test.txt \
-r skore/requirements-tools.txt

serve-ui:
SKORE_ROOT=$(SKORE_ROOT) python -m uvicorn \
--factory skore.ui.app:create_app \
--reload --reload-dir ./src \
--host 0.0.0.0 \
--port 22140 \
--timeout-graceful-shutdown 0
pre-commit install

build-skore-ui:
# cleanup
rm -rf skore-ui/dist
rm -rf src/skore/ui/static
rm -rf skore/src/skore/ui/static
# build
(\
cd skore-ui;\
npm install;\
npm run build;\
npm run build:lib -- --emptyOutDir false;\
( \
cd skore-ui; \
npm install; \
npm run build; \
npm run build:lib -- --emptyOutDir false; \
)
# move
mv skore-ui/dist/ src/skore/ui/static
mv skore-ui/dist/ skore/src/skore/ui/static

serve-skore-ui:
SKORE_ROOT=$(SKORE_ROOT) python -m uvicorn \
--factory skore.ui.app:create_app \
--reload --reload-dir skore/src \
--host 0.0.0.0 \
--port 22140 \
--timeout-graceful-shutdown 0
79 changes: 0 additions & 79 deletions README.md

This file was deleted.

Loading

0 comments on commit 7efa77a

Please sign in to comment.