Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:

jobs:
python-build:
name: Python Build & Test (${{ matrix.python-version }})
strategy:
matrix:
python-version: ['3.11', '3.12']
uses: ./.github/workflows/reusable-python.yml
with:
python-version: ${{ matrix.python-version }}
install-extras: test,typing
extra-packages: dbus-python keyring secretstorage
run-tests: true
test-command: pytest tests/ --cov=code_sandboxes --cov-report term-missing
run-mypy: true
mypy-target: code_sandboxes
44 changes: 44 additions & 0 deletions .github/workflows/py-code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Py Code Style

on:
push:
branches:
- main
- develop
paths:
- 'code_sandboxes/**/*.py'
- 'tests/**/*.py'
- 'pyproject.toml'
- 'setup.py'
- '.pre-commit-config.yaml'
- 'ruff.toml'
- '.ruff.toml'
- '.github/workflows/py-code-style.yml'
- '.github/workflows/reusable-python.yml'
pull_request:
branches:
- main
- develop
paths:
- 'code_sandboxes/**/*.py'
- 'tests/**/*.py'
- 'pyproject.toml'
- 'setup.py'
- '.pre-commit-config.yaml'
- 'ruff.toml'
- '.ruff.toml'
- '.github/workflows/py-code-style.yml'
- '.github/workflows/reusable-python.yml'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check-code-style:
uses: ./.github/workflows/reusable-python.yml
with:
python-version: '3.11'
extra-packages: pre-commit
run-pre-commit: true
43 changes: 43 additions & 0 deletions .github/workflows/py-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Py Tests

on:
push:
branches:
- main
paths:
- 'code_sandboxes/**'
- 'tests/**'
- 'pyproject.toml'
- 'setup.py'
- 'requirements*.txt'
- '**/*.py'
- '.github/workflows/py-tests.yml'
- '.github/workflows/reusable-python.yml'
pull_request:
branches:
- main
paths:
- 'code_sandboxes/**'
- 'tests/**'
- 'pyproject.toml'
- 'setup.py'
- 'requirements*.txt'
- '**/*.py'
- '.github/workflows/py-tests.yml'
- '.github/workflows/reusable-python.yml'

workflow_dispatch:

jobs:
tests:
strategy:
max-parallel: 1
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
uses: ./.github/workflows/reusable-python.yml
with:
python-version: ${{ matrix.python-version }}
install-extras: test
extra-packages: dbus-python keyring secretstorage
run-tests: true
test-command: pytest tests/ --cov=code_sandboxes --cov-report term-missing
44 changes: 44 additions & 0 deletions .github/workflows/py-typing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Py Type Checking

on:
push:
branches:
- main
- develop
paths:
- 'code_sandboxes/**/*.py'
- 'tests/**/*.py'
- 'pyproject.toml'
- 'setup.py'
- 'mypy.ini'
- '.mypy.ini'
- '.github/workflows/py-typing.yml'
- '.github/workflows/reusable-python.yml'
pull_request:
branches:
- main
- develop
paths:
- 'code_sandboxes/**/*.py'
- 'tests/**/*.py'
- 'pyproject.toml'
- 'setup.py'
- 'mypy.ini'
- '.mypy.ini'
- '.github/workflows/py-typing.yml'
- '.github/workflows/reusable-python.yml'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
type-check:
uses: ./.github/workflows/reusable-python.yml
with:
python-version: '3.12'
install-extras: typing
extra-packages: types-requests
run-mypy: true
mypy-target: code_sandboxes
100 changes: 100 additions & 0 deletions .github/workflows/reusable-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Reusable Python Workflow

on:
workflow_call:
inputs:
python-version:
description: Python version to use
required: false
type: string
default: '3.11'
install-system-deps:
description: Install Linux system dependencies and unlock keyring
required: false
type: boolean
default: true
install-extras:
description: Optional extras to install from pyproject (for example test,typing)
required: false
type: string
default: ''
extra-packages:
description: Optional extra packages to install with uv pip
required: false
type: string
default: ''
run-tests:
description: Run tests
required: false
type: boolean
default: false
test-command:
description: Test command to run when run-tests=true
required: false
type: string
default: 'pytest -q'
run-mypy:
description: Run mypy
required: false
type: boolean
default: false
mypy-target:
description: Package/module path to type-check
required: false
type: string
default: ''
run-pre-commit:
description: Run pre-commit
required: false
type: boolean
default: false

jobs:
python-checks:
runs-on: ubuntu-latest

steps:
- name: Install system dependencies
if: inputs.install-system-deps
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-3 libdbus-1-dev libglib2.0-dev

- name: Checkout
uses: actions/checkout@v6

- name: Setup UV
uses: astral-sh/setup-uv@v7
with:
version: latest
python-version: ${{ inputs.python-version }}
activate-environment: true

- name: Install dependencies
run: |
uv pip install .
if [[ -n "${{ inputs.install-extras }}" ]]; then
uv pip install ".[${{ inputs.install-extras }}]"
fi
if [[ -n "${{ inputs.extra-packages }}" ]]; then
uv pip install ${{ inputs.extra-packages }}
fi

- name: Unlock keyring
if: inputs.install-system-deps
uses: t1m0thyj/unlock-keyring@v1

- name: Configure git to use https
run: git config --global hub.protocol https

- name: Run tests
if: inputs.run-tests
run: ${{ inputs.test-command }}

- name: Run mypy
if: inputs.run-mypy
run: mypy ${{ inputs.mypy-target }}

- name: Run pre-commit
if: inputs.run-pre-commit
run: pre-commit run --all-files
2 changes: 1 addition & 1 deletion .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ header:
- 'docs/**/*'
- 'LICENSE'

comment: on-failure
comment: on-failure
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"packageManager": "ms-python.python:conda"
}
]
}
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
-->

# Changelog

## Unreleased

- Breaking change: sandbox variant names are `eval`, `docker`, `jupyter`, and `datalayer`.
- Removed support for the older `local-*` variant names from the public API and documentation.
- Clarified in the documentation that `Sandbox.create()` defaults to `datalayer`.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading
Loading