Skip to content

Commit

Permalink
v6 updates (#835)
Browse files Browse the repository at this point in the history
* remove nbconvert < 6 compat patches

* throw error on nbconvert<6

* convert pdf via html exporter to use nbconvert webpdf exporter

* removed pdfkit, wkhtmltopdf, cleanup

* undo adding nbconvert[webpdf] to grading container image

* changelog

* add depencies for exporting pdfs via html to grading image

* enable pdf via html in grading containers

* install only chromium

* remove nbconvert < 6 compat patches

* throw error on nbconvert<6

* convert pdf via html exporter to use nbconvert webpdf exporter

* removed pdfkit, wkhtmltopdf, cleanup

* undo adding nbconvert[webpdf] to grading container image

* changelog

* add depencies for exporting pdfs via html to grading image

* enable pdf via html in grading containers

* install only chromium

* use poetry and pyproject.toml for packaging

* update CI to run Docker tests weekly instead of on every push/PR

* extras poetry

* docs

* py3.12 default, migrate to extras for dep mgmt, slim down grading envs

* update proj03 example

* Update .readthedocs.yml

* catch chromium error from nbconvert

* changelog

* combine export and grading extras

* update run-docker-tests.yml

* debugging beta branch not reusing cached docker images in tests

* update .dockerignore

* add matplotlib and numpy to grade test requirements.txt

* Handle empty assignment configs in Otter Assign

Closes #795

* Clean up JupyterLite support and remove import_or_raise per #511

* Removed variables key of assignment config in favor of generate.serialized_variables in Otter Assign per #628

* Update Otter Assign to add cell metadata so that questions with no check cell have their tests run after the last solution cell per #798

* type hints for functions in otter/assign

* cleanup

* upgrade setup-buildx-action

* Updated Otter Assign to strip type annotations from generated test code per #796

* Updated Otter Grade Docker image to create an empty submission_metadata.json file in the grading image to prevent plugins from erroring per #811

* Otter Grade: Added Progress Monitoring to Queue

- When an instance of ``multiprocessing.Queue`` is passed to
grade/__init_.py::main, progress messages are written to the
``multiprocessing.Queue` via custom QueueLoggingHandler

* Otter Grade: Cleaned Up Progress Monitoring

* Otter Grade: Clean Up Progress Monitoring

* Otter Grade: Progress Monitoring CHANGELOG updated

* Update CHANGELOG.md

* Update utils.py

* Format code with black and isort (#839)

* add black to pyproject.toml

* reformat files with black

* add isort for import sorting

* reformat files with isort

* restore test file formatting

* fix exclusions and make otter generate render templates correctly

* add workflow for checking formatting

* use different poetry setup action

* pin fica>=0.4.1

* fixing lsp complaints

* fix args and kwargs type hints

* add student_files to otter assign (#852)

* Add pip install cell to Colab notebooks (#862)

* Add ability to ignore .OTTER_LOG to Notebook.export and Otter Assign (#863)

* add ability to ignore .OTTER_LOG to Notebook.export and Otter Assign

* typo

* Fix/add support for all_or_nothing test file config (#865)

* Add more tests for otter.test_files (#866)

* update deps

* update cache key

* debugging failed builds

* add nb_conda_kernels

* add note about code formatting to CONTRIBUTING.md

* go back an additional frame in Notebook.check for py3.13 for some reason :(

* use matrix to cover supported python versions

* add coveralls parallel builds for matrix and pin py3.9 for docker tests

* docs for all_or_nothing

* Auto-ignore test fn calls in assign exception-based test cells (#867)

* Add addl packages to otter --version (#868)

* add addl packages to otter --version

* add addl packages to otter --version

* remake poetry.lock

* Fix converting indented functions in test cells to doctests (#869)

* add question structure to otter assign docs

* remove unnecessary passage

---------

Co-authored-by: sean-morris <[email protected]>
  • Loading branch information
chrispyles and sean-morris authored Oct 26, 2024
1 parent 8a946bf commit e56de20
Show file tree
Hide file tree
Showing 177 changed files with 9,658 additions and 3,367 deletions.
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ exclude_lines =
# Don't complain if tests don't hit defensive assertion code:
raise NotImplementedError

# Ignore ellipse statements
\.\.\.

omit =
# This file is just calls otter.cli.cli
otter/__main__.py

# This file is a copy of an external script and is not tested as part of Otter
otter/plugins/builtin/gmail_notifications/bin/gmail_oauth2.py

# ignore templates
otter/generate/templates/**/*
30 changes: 15 additions & 15 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
__pycache__
.DS_Store
dist
build
*.egg-info
.ipynb_checkpoints
test/test-grading-notebook.ipynb
test/tests
.coverage
.vscode
test/output
.sos
docs/_build
.Rproj.user
.Rhistory
.DS_Store
.ionide
gs-testing-stuff
.ipynb_checkpoints
.git
.github
.mypy.cache
.pytest_cache
.OTTER_LOG
.Rproj.user
.Rhistory
.sos
.vscode
*.egg-info
build
dist
docs
examples
logo
.git
poetry.lock
test
52 changes: 52 additions & 0 deletions .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Check formatting

on:
push:
branches:
- master
- beta
- release
pull_request:
branches:
- master
- beta
- release
- temp
workflow_dispatch:

jobs:
build:
name: Check formatting
runs-on: ubuntu-latest

env:
TAR: /bin/tar

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true

- name: Install dependencies
run: |
poetry install --with dev --no-root
- name: Run formatters
run: |
source .venv/bin/activate
make format CI=true
13 changes: 9 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,25 @@ jobs:
TAR: /bin/tar

steps:
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.10

- name: Only allow releases off of master (or temp for patches)
run: |
python3 -c 'import os, sys; sys.exit(os.environ["GITHUB_REF"] != "refs/heads/master" and os.environ["GITHUB_REF"] != "refs/heads/temp")'
- uses: liskin/gh-pipx@v1
with:
packages: >-
poetry
- uses: actions/checkout@v2

- name: Install dependencies
run: |
python3 -m pip install -r requirements.txt twine wheel setuptools
poetry install --with dev --no-root
- name: Update versions
run: |
Expand All @@ -53,7 +58,7 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python3 setup.py sdist bdist_wheel
poetry build
python3 -m twine upload dist/*
- name: Create a release on GitHub
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/run-docker-tests-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
with:
ref: beta

- uses: docker/setup-buildx-action@v2
- uses: docker/setup-buildx-action@v3
if: ${{ steps.check-branch.outputs.run == 'true' }}
with:
install: true
Expand All @@ -65,16 +65,18 @@ jobs:
if: ${{ steps.check-branch.outputs.run == 'true' }}
with:
environment-file: environment.yml
create-args: >-
python=3.9
init-shell: >-
bash
cache-environment: true
cache-environment-key: requirements-${{ hashFiles('pyproject.toml') }}
cache-environment-key: requirements-${{ hashFiles('environment.yml') }}

- name: Install dependencies
if: ${{ steps.check-branch.outputs.run == 'true' }}
run: |
micromamba activate otter-grader
poetry install --with test --all-extras
poetry install --with dev,test --all-extras
- name: Install ottr
if: ${{ steps.check-branch.outputs.run == 'true' }}
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/run-docker-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,33 @@ jobs:
with:
ref: ${{ matrix.branch }}

- uses: docker/setup-buildx-action@v2
- uses: docker/setup-buildx-action@v3
with:
install: true

- uses: r-lib/actions/setup-tinytex@v2

- uses: r-lib/actions/setup-pandoc@v2

- uses: liskin/gh-pipx@v1
with:
packages: >-
poetry
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
create-args: >-
python=3.9
init-shell: >-
bash
cache-environment: true
cache-environment-key: requirements-${{ hashFiles('requirements*.txt') }}
cache-environment-key: requirements-${{ hashFiles('environment.yml') }}

- name: Install dependencies
run: |
micromamba activate otter-grader
poetry install --with dev,test --all-extras
- name: Install ottr
run: |
Expand Down
31 changes: 30 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
name: Test suite
runs-on: ubuntu-latest

strategy:
matrix:
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

env:
TAR: /bin/tar

Expand All @@ -35,13 +39,26 @@ jobs:

- uses: r-lib/actions/setup-pandoc@v2

- uses: liskin/gh-pipx@v1
with:
packages: >-
poetry
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
create-args: >-
python=${{ matrix.python_version }}
init-shell: >-
bash
cache-environment: true
cache-environment-key: requirements-${{ hashFiles('requirements*.txt') }}
cache-environment-key: mamba-${{ hashFiles('environment.yml') }}

- name: Install dependencies
run: |
micromamba activate otter-grader
poetry env info
poetry install --with dev,test --all-extras
- name: Install ottr
run: |
Expand All @@ -54,3 +71,15 @@ jobs:
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
parallel: true
flag-name: run ${{ join(matrix.*, ' - ') }}

finish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
16 changes: 12 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ sphinx:
# Optionally build your docs in additional formats such as PDF and ePub
formats: all

conda:
environment: rtd_environment.yml

build:
os: ubuntu-22.04
tools:
python: "mambaforge-22.9"
python: "3.10"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
# VIRTUAL_ENV needs to be set manually for now.
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Changelog

**v6.0.0 (unreleased):**

* Switched to [poetry](https://python-poetry.org/) for packaging
* Removed compatibility patches for nbconvert < 6 per [#777](https://github.com/ucbds-infra/otter-grader/issues/777)
* Updated Otter Export to throw an error if nbconvert<6.0.0 is found
* Converted Otter Export's PDF via HTML exporter to use nbconvert's WebPDF exporter per [#781](https://github.com/ucbds-infra/otter-grader/issues/781)
* Removed pdfkit from dependencies
* Added ability to export PDFs via HTML in grading containers per [#782](https://github.com/ucbds-infra/otter-grader/issues/782)
* Set default Python version for grading images to 3.12
* Remove support for Python versions < 3.9 per [#668](https://github.com/ucbds-infra/otter-grader/issues/668)
* Removed `setuptools` and `pkg_resources` dependencies
* Remove dependencies not strictly required by Otter in the grading environment per [#739](https://github.com/ucbds-infra/otter-grader/issues/739)
* Handle empty assignment configs in Otter Assign per [#795](https://github.com/ucbds-infra/otter-grader/issues/795)
* Removed `Notebook` `colab` and `jupyterlite` arguments, switching to always determining the interpreter automatically
* Made `dill` a required dependency
* Removed `variables` key of assignment config in favor of `generate.serialized_variables` in Otter Assign per [#628](https://github.com/ucbds-infra/otter-grader/issues/628)
* Update Otter Assign to add cell metadata so that questions with no check cell have their tests run after the last solution cell per [#798](https://github.com/ucbds-infra/otter-grader/issues/798)
* Updated Otter Assign to strip type annotations from generated test code per [#796](https://github.com/ucbds-infra/otter-grader/issues/796)
* Updated Otter Grade Docker image to create an empty `submission_metadata.json` file in the grading image to prevent plugins from erroring per [#811](https://github.com/ucbds-infra/otter-grader/issues/811)
* Added ability to monitor grading progress to Otter Grade per [#827](https://github.com/ucbds-infra/otter-grader/issues/827)
* Added handling of student-created files with the `student_files` configuration in Otter Assign per [#737](https://github.com/ucbds-infra/otter-grader/issues/737)
* Updated Otter Assign to add a cell to install Otter at the top of Colab notebooks per [#861](https://github.com/ucbds-infra/otter-grader/issues/861)
* Added the ability to ignore the `.OTTER_LOG` file to `Notebook.export` and Otter Assign per [#857](https://github.com/ucbds-infra/otter-grader/issues/857)
* Fixed OK-test support for the `all_or_nothing` config per [#751](https://github.com/ucbds-infra/otter-grader/issues/751)
* Added exception-based test support for the `all_or_nothing` config per [#751](https://github.com/ucbds-infra/otter-grader/issues/751)
* Added Otter Assign support for the `all_or_nothing` config per [#751](https://github.com/ucbds-infra/otter-grader/issues/751)
* Updated Otter Assign to only allow a function definition and statement to call the test function in exception-based test cells and automatically ignore the latter statement instead of requiring an explicit `# IGNORE` comment per [#516](https://github.com/ucbds-infra/otter-grader/issues/516)
* Added additional package versions to the output of `otter --version` per [#843](https://github.com/ucbds-infra/otter-grader/issues/843)
* Fixed bug in converting test cells containing indented functions to doctests in Otter Assign per [#840](https://github.com/ucbds-infra/otter-grader/issues/840)

**v5.7.1:**

* Removed testing code unintentioanlly committed in v5.7.0 per [#849](https://github.com/ucbds-infra/otter-grader/issues/849)
Expand Down
24 changes: 19 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,33 @@ any updates. Make sure to update the changelog with any information about the co

## Environment Setup

To set up an environment for working on Otter, we recommend using
[Conda](https://docs.conda.io/en/latest/miniconda.html). This repo contains an
To set up an environment for working on Otter, we recommend using [Mamba](https://mamba.readthedocs.io/en/latest/) (or Conda). This repo contains an
[`environment.yml`](environment.yml) file which defines all of the requirements for an environment
used to work on Otter.

Running

```
conda env create -f environment.yml
mamba env create -f environment.yml
```

will create a conda environment called `otter-grader` with the necessary packages installed for both
Python and R.
will create a conda environment called `otter-grader` with the necessary Python and R versions.

To install development dependencies, use [`poetry`](https://python-poetry.org/) to update the environment:

```
mamba activate otter-grader
poetry install --with dev,test
```


## Code Formatting

The Python files in this repo are formatted with isort and black. Installing the `dev` dependencies
with poetry will install these as well. You can run `make format` with your conda/virtual environment
activated to format the files in-place.

Note that code formatting is enforced by a CI test.


## Running Tests
Expand Down
17 changes: 0 additions & 17 deletions MANIFEST.in

This file was deleted.

Loading

0 comments on commit e56de20

Please sign in to comment.