Skip to content

Commit

Permalink
updates (#131)
Browse files Browse the repository at this point in the history
- switch from poetry to uv
- switch from isort/black to ruff
- remove code using yaml from tests
- pin ci runner versions
- test on python 3.12, no longer 3.8 which is EOL
- update pyright, devcontainer cli
  • Loading branch information
alex-treebeard authored Dec 23, 2024
1 parent a3730bc commit a9cee00
Show file tree
Hide file tree
Showing 27 changed files with 1,557 additions and 1,605 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ ARG NODE_VERSION="lts/*"
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
USER vscode
RUN pip3 --disable-pip-version-check --no-cache-dir install -U \
'poetry==1.8.3' \
'pip==22.1.2'
RUN npm install -g @devcontainers/cli@v0.30.0
'pip==22.1.2' \
'uv==0.5.11'
RUN npm install -g @devcontainers/cli@v0.72.0
1 change: 0 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"postCreateCommand": "poetry install",
"remoteUser": "vscode"
}
3 changes: 1 addition & 2 deletions .devcontainer/vm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ ARG NODE_VERSION="lts/*"
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
USER vscode
RUN pip3 --disable-pip-version-check --no-cache-dir install -U \
'poetry==1.8.3' \
'pip==22.1.2'
RUN npm install -g @devcontainers/cli@v0.30.0
RUN npm install -g @devcontainers/cli@v0.72.0
19 changes: 6 additions & 13 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,12 @@ Steps to reproduce the behavior:
**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Relevant versions**

Please share which versions you have with this:
```sh
uv pip show nbmake nbclient ipykernel pytest | grep -E "^(Name|Version):"
```

**Additional context**
Add any other context about the problem here.
9 changes: 4 additions & 5 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ on:
types: [published]
jobs:
build-n-publish:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
- run: pip install poetry
- run: poetry version ${GITHUB_REF:10}
- run: poetry build
- run: pip install uv
- run: uv build
- run: pip install twine==4.0.1
- run: twine upload dist/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}
- uses: EndBug/[email protected]
Expand All @@ -19,4 +18,4 @@ jobs:
author_email: 41898282+github-actions[bot]@users.noreply.github.com
add: pyproject.toml
branch: main
message: Published new version
message: Published new version
27 changes: 12 additions & 15 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,31 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: npm install -g @devcontainers/cli@v0.30.0
- run: npm install -g @devcontainers/cli@v0.72.0
- run: devcontainer up --workspace-folder=.
- run: devcontainer exec --workspace-folder=. poetry run pre-commit run --verbose --all-files
- run: devcontainer exec --workspace-folder=. poetry run pytest --cov-report=xml --cov=src
- uses: codecov/codecov-action@v1
with:
file: coverage.xml
- run: devcontainer exec --workspace-folder=. uv venv
- run: devcontainer exec --workspace-folder=. uv pip install pre-commit pytest
- run: devcontainer exec --workspace-folder=. uv run pre-commit run --verbose --all-files
- run: devcontainer exec --workspace-folder=. uv run pytest
pytest:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- ubuntu-24.04
- macos-14
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- run: pip install poetry
- run: poetry install
- run: poetry run pytest --cov-report=xml --cov=src
- uses: codecov/codecov-action@v1
with:
file: coverage.xml
- run: pipx install uv
- run: uv venv
- run: uv pip install -e .
- run: uv run pytest
10 changes: 3 additions & 7 deletions .github/workflows/test-publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ on:
- main
jobs:
build-n-publish:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
- run: pip install poetry
- name: Set poetry version to dev
run: |
build_version="$(poetry version -s).dev$(date +%s)"
poetry version $build_version
- run: poetry build
- run: pip install uv
- run: uv build
- run: pip install 'pytest==7.1'
- run: pip install dist/*gz --force-reinstall
- run: pytest --nbmake tests/resources/mock.ipynb
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,4 @@ typeshed

trash
**/_build
.aider*
26 changes: 8 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,19 @@ repos:
rev: 0.5.0
hooks:
- id: nbstripout
- repo: https://github.com/ambv/black
rev: 22.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: black
files: '(src|tests).*py'
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["-m", "3", "--tc"]
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
args: [--line-length=88]
- repo: local
hooks:
- id: pyright
name: pyright
entry: poetry run pyright
entry: uv run pyright
language: node
pass_filenames: false
types: [python]
additional_dependencies: ["[email protected]"]
# - repo: local
# hooks:
# - id: smoketest
# name: smoketest
# entry: poetry run pytest -k test_when_nb_present_then_collected
# language: system
# pass_filenames: false
additional_dependencies: ["[email protected]"]
10 changes: 0 additions & 10 deletions CONTRIBUTING.MD
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@ nbmake uses devcontainers to pre-configure a dev environment. We recommend you o

For non-vscode users, here are some install steps:

### Install local package
```
poetry install
```

### Activate shell
```
poetry shell
```

### Run static checks
```
pre-commit run --all-files
Expand Down
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@

**Who is this for?** Research/Machine Learning Software Engineers who maintain packages/teaching materials with documentation written in notebooks.

---
**✨ New: save your energy when investigating GitHub actions failures with our [Pull Request Bot](https://github.com/marketplace/treebeard-build)**

---

## Functionality

1. Executes notebooks using pytest and nbclient, allowing parallel notebook testing
Expand Down Expand Up @@ -245,11 +240,3 @@ pytest -p no:nbmake
* [jupyter book](https://github.com/executablebooks/jupyter-book)
* [jupyter cache](https://github.com/executablebooks/jupyter-cache)
* [MyST-NB](https://github.com/executablebooks/MyST-NB)

---

## ℹ️ Get help with machine learning infrastructure

Join our [Discord](https://discord.gg/QFjCpMjqRY) for support and learning through the community.

---
Loading

0 comments on commit a9cee00

Please sign in to comment.