Skip to content

Commit

Permalink
Merge branch 'main' into manzt/hoist-2
Browse files Browse the repository at this point in the history
  • Loading branch information
manzt authored Dec 16, 2024
2 parents 3d9e9e8 + 6a5bf6c commit ec43e5c
Show file tree
Hide file tree
Showing 73 changed files with 7,142 additions and 4,781 deletions.
50 changes: 50 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "\U0001F41E Bug report"
description: Report an issue with anywidget
labels: ['bug']
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: bug-description
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks!
placeholder: Bug description
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Reproduction
description: Please provide a link to a repo or gist that can reproduce the problem you ran into. If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "need reproduction" label. If no reproduction is provided within a reasonable time-frame, the issue will be closed.
placeholder: Reproduction
validations:
required: true
- type: textarea
id: logs
attributes:
label: Logs
description: 'Please include browser console and/or Python logs around the time this bug occurred. Optional if provided reproduction. Please try not to insert an image but copy paste the log text.'
render: shell
- type: textarea
id: system-info
attributes:
label: System Info
description: Output of `npx envinfo --system --browsers` and `pip freeze | grep -E "anywidget|jupyter|notebook"`. And please, other relevant package versions.
render: shell
placeholder: System, Binaries, Browsers
validations:
required: true
- type: dropdown
id: severity
attributes:
label: Severity
description: Select the severity of this issue
options:
- annoyance
- blocking an upgrade
- blocking all usage of anywidget
validations:
required: true
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Discord Chat
url: https://discord.gg/W5h4vPMbDQ
about: Ask questions and discuss with other anywidget devs/users in real time.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Documentation
description: Create a report to help us improve the documentation
labels: [docs]
body:
- type: input
id: link
attributes:
label: Documentation Link
description: >-
Link to any documentation or examples that you are referencing.
placeholder: https://anywidget.dev/...
- type: textarea
id: issue
attributes:
label: Issue
description: What is lacking, unclear, or incorrect in the documentation?
placeholder: |
* The section on [...] is confusing because [...]
* [...] gives the impression that [...] whereas it should be [...]
* An example demonstrating [...] is missing
validations:
required: true
- type: textarea
id: recommendation
attributes:
label: Recommended improvement
placeholder: |
* Change this line to [...]
* Add a paragraph that explains [...]
* Add a new section with [...]
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 'Feature Request'
description: Request a new anywidget feature
labels: [enhancement]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to request this feature!
- type: textarea
id: problem
attributes:
label: Describe the problem
description: Please provide a clear and concise description the problem this feature would solve. The more information you can provide here, the better.
placeholder: I'm always frustrated when...
validations:
required: true
- type: textarea
id: solution
attributes:
label: Describe the proposed solution
description: Please provide a clear and concise description of what you would like to happen.
placeholder: I would like to see...
validations:
required: true
- type: dropdown
id: importance
attributes:
label: Importance
description: How important is this feature to you?
options:
- nice to have
- would make my life easier
- i cannot use anywidget without it
validations:
required: true
77 changes: 28 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,67 +19,53 @@ jobs:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
# Disable jupyter-builder build hook because not needed for linting/formatting, and requires pnpm
- run: |
sed -i '' 's/\[tool.hatch.build.hooks.\(.*\)\]/\[_tool.hatch.build.hooks.\1\]/' pyproject.toml
- uses: astral-sh/setup-uv@v4
with:
python-version: "3.12"
version: "0.5.x"
- run: |
pip install uv
uv pip install --system ruff
ruff check
ruff format
uv run ruff check
uv run ruff format
TypecheckPython:
name: Python / Typecheck
runs-on: macos-14
steps:
- uses: actions/checkout@v4

# Disable jupyter-builder build hook because not needed for typechecking, and requires npm
# Disable jupyter-builder build hook because not needed for typechecking, and requires pnpm
- run: |
sed -i '' 's/\[tool.hatch.build.hooks.\(.*\)\]/\[_tool.hatch.build.hooks.\1\]/' pyproject.toml
cat pyproject.toml
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v4
with:
python-version: "3.12"
- run: |
pip install uv
uv pip install --system -e '.[test,dev]'
- run: mypy
version: "0.5.x"
- run: uv run mypy

TestPython:
name: Python / Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
- run: pnpm install --frozen-lock

- uses: actions/setup-python@v5
run_install: true
- uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}

- if: ${{ matrix.python-version != '3.7' }}
run: |
pip install uv
uv pip install --system -e '.[test,dev]'
- if: ${{ matrix.python-version == '3.7' }}
run: |
pip install -e '.[test,dev]'
version: "0.5.x"
- name: Run tests
run: pytest ./tests --color=yes --cov anywidget --cov-report xml

- uses: codecov/codecov-action@v4
run: uv run --with pytest-cov pytest ./tests --color=yes --cov anywidget --cov-report xml
env:
UV_PYTHON: ${{ matrix.python-version }}
- uses: codecov/codecov-action@v5

LintJavaScript:
name: JavaScript / Lint
Expand All @@ -91,29 +77,22 @@ jobs:
version: latest
- run: biome ci .


TypecheckJavaScript:
name: JavaScript / Typecheck
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
- run: |
pnpm install
pnpm typecheck
run_install: true
- run: pnpm typecheck

TestJavaScript:
name: JavaScript / Test
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
- run: |
pnpm install
pnpm test
run_install: true
- run: pnpm test
2 changes: 1 addition & 1 deletion .github/workflows/jsr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- uses: denoland/setup-deno@v2
with:
deno-version: v1.x
- run: |
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,17 @@ jobs:
issues: read
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
- run: pnpm install --frozen-lock

- uses: actions/setup-python@v5
run_install: true
- uses: astral-sh/setup-uv@v4
with:
python-version: "3.11"
- run: |
python -m pip install --upgrade pip
pip install build twine
version: "0.5.x"
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
# this expects you to have a npm script called version that runs some logic and then calls `changeset version`.
version: npm run version
# This expects you to have a script called release which does a build for the packages and calls `changeset publish`
publish: npm run release
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__pycache__/

*.egg-info/
*.tsbuildinfo
.eggs/*

.ipynb_checkpoints/
Expand Down
10 changes: 7 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ preferred-citation:
family-names: "Gehlenborg"
affiliation: "Harvard Medical School"
orcid: "https://orcid.org/0000-0003-0327-8297"
doi: "10.31219/osf.io/tw9sg"
journal: "OSF preprint"
month: 6
doi: "10.21105/joss.06939"
journal: "Journal of Open Source Software"
volume: "9"
number: "102"
pages: "6939"
year: 2024
publisher:
name: "The Open Journal"
40 changes: 16 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,16 @@ contains both JavaScript and Python components, it requires dual package
managers:

- [pnpm](https://pnpm.io) for JavaScript
- [hatch](https://github.com/pypa/hatch) for Python
- [uv](https://github.com/astral-sh/uv) for Python

You can [install pnpm](https://pnpm.io/installation) and
[install hatch](https://github.com/pypa/hatch) with:
[install uv](https://github.com/astral-sh/uv) with:

```bash
npm i -g pnpm
pipx install hatch
curl -LsSf https://astral.sh/uv/install.sh | sh # for Linux and macOS, see link for Windows
```

Then, create a Python virtual environment with `hatch`:

```bash
hatch shell
```

This command creates a virtual environment and installs all dependencies
specified in the `pyproject.toml`. It also installs **anywidget** in development
mode. The environment setup might take some time during the first run, but
`hatch` reuses the environment in subsequent runs.

You can deactivate the environment with `Ctrl + D` and reset it using
`hatch env remove`. For more information, read the
[hatch docs](https://hatch.pypa.io/latest/).

## Code structure

Entry points to be aware of:
Expand Down Expand Up @@ -60,12 +45,12 @@ Entry points to be aware of:
Once your environment is set up, you can start making changes to the codebase.
We recommend using the classic Jupyter Notebook or Jupyter Lab for development.

If you are using the classic Jupyter Notebook you need to install the local
If you are using the classic Jupyter Notebook (<v7) you need to install the local
nbextension:

```bash
jupyter nbextension install --py --symlink --sys-prefix anywidget
jupyter nbextension enable --py --sys-prefix anywidget
uv run jupyter nbextension install --py --symlink --sys-prefix anywidget
uv run jupyter nbextension enable --py --sys-prefix anywidget
```

Note for developers:
Expand All @@ -78,7 +63,7 @@ Note for developers:
For developing with JupyterLab:

```bash
jupyter labextension develop --overwrite anywidget
uv run jupyter labextension develop --overwrite anywidget
```

> **Note** If you make changes to the Python code, you'll need to restart the
Expand All @@ -94,8 +79,15 @@ There are a few guidelines we follow:

- For JavaScript, internal variables are written with `snake_case` while
external APIs are written with `camelCase` (if applicable).
- For Python, ensure `hatch run lint` passes. You can run `hatch run fmt` to
format and fix linting errors.
- For Python, ensure typechecking and linting passes.

Commands to know:

```sh
uv run ruff check # linting
uv run ruff format # formatting
uv run mypy # typechecking
```

### Generating changelogs

Expand Down
Loading

0 comments on commit ec43e5c

Please sign in to comment.