Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pydeck] Create a prebuilt extension for JupyterLab #7030

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 14 additions & 2 deletions bindings/pydeck/MANIFEST.in
@@ -1,9 +1,15 @@
include LICENSE.txt
include README.md
include *.md
include pyproject.toml

include pytest.ini
include .coveragerc

include package.json
include install.json
include ts*.json
include yarn.lock

include pydeck/io/templates/*.j2

# Examples
Expand All @@ -13,10 +19,16 @@ graft examples
graft tests
prune tests/build

# Javascript files
graft pydeck/nbextension
graft pydeck/labextension
prune setup

# Javascript files
graft src
graft style
prune **/node_modules
prune lib

# Patterns to exclude from any directory
global-exclude *~
global-exclude *.pyc
Expand Down
61 changes: 61 additions & 0 deletions bindings/pydeck/RELEASE.md
@@ -0,0 +1,61 @@
# Making a new release of pydeck

The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser).

## Manual release

### Python package

This extension can be distributed as Python
packages. All of the Python
packaging instructions in the `pyproject.toml` file to wrap your extension in a
Python package. Before generating a package, we first need to install `build`.

```bash
pip install build twine
```

To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do:

```bash
python -m build
```

> `python setup.py sdist bdist_wheel` is deprecated and will not work for this package.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the Makefile with the new commands as well?


Then to upload the package to PyPI, do:

```bash
twine upload dist/*
```

### NPM package

To publish the frontend part of the extension as a NPM package, do:

```bash
npm login
npm publish --access public
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we should be able to put --access public in the package.json I think so we don't need to specify it manually. Ref
https://docs.npmjs.com/cli/v8/configuring-npm/package-json#publishconfig and https://docs.npmjs.com/cli/v8/using-npm/config#access

```

## Automated releases with the Jupyter Releaser

The extension repository should already be compatible with the Jupyter Releaser.

Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for more information.

Here is a summary of the steps to cut a new release:

- Fork the [`jupyter-releaser` repo](https://github.com/jupyter-server/jupyter_releaser)
- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the Github Secrets in the fork
- Go to the Actions panel
- Run the "Draft Changelog" workflow
- Merge the Changelog PR
- Run the "Draft Release" workflow
- Run the "Publish Release" workflow

## Publishing to `conda-forge`

If the package is not on conda forge yet, check the documentation to learn how to add it: https://conda-forge.org/docs/maintainer/adding_pkgs.html

Otherwise a bot should pick up the new version publish to PyPI, and open a new PR on the feedstock repository automatically.
1 change: 1 addition & 0 deletions bindings/pydeck/package.json
2 changes: 1 addition & 1 deletion bindings/pydeck/pydeck/_version.py
@@ -1 +1 @@
__version__ = "0.7.1"
__version__ = "0.8.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I'd bump the version in a follow-up PR

2 changes: 1 addition & 1 deletion bindings/pydeck/pydeck/frontend_semver.py
@@ -1 +1 @@
DECKGL_SEMVER = "~8.5.*"
DECKGL_SEMVER = "8.7.*"
44 changes: 17 additions & 27 deletions bindings/pydeck/pyproject.toml
@@ -1,34 +1,24 @@
[project]
name = "pydeck"
version = "0.7.1"
version = "0.8.0"
requires-python = ">=3.7"

[build-system]
requires = [
"setuptools",
"wheel",
]
requires = ["jupyter_packaging~=0.10,<2", "jupyterlab~=3.1"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you include jupyterlab as a build dependency? The jupyter-packaging docs don't seem to require it: https://github.com/jupyter/jupyter-packaging/#as-a-build-backend

build-backend = "jupyter_packaging.build_api"

[tool.black]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why delete the black config section?

line-length = 120
target-version = ['py34']
include = '\.pyi?$'
exclude = '''
[tool.jupyter-packaging.options]
skip-if-exists = ["pydeck/labextension/static/style.js"]
ensured-targets = ["pydeck/labextension/static/style.js", "pydeck/labextension/package.json"]

(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
| foo.py # also separately exclude a file named foo.py in
# the root of the project
)
'''
[tool.jupyter-packaging.builder]
factory = "jupyter_packaging.npm_builder"

[tool.jupyter-packaging.build-args]
build_cmd = "build:labextension"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only builds the labextension?

path = "../../modules/jupyter-widget"
build_dir = "pydeck/labextension"
npm = ["jlpm"]

[tool.check-manifest]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check-manifest config is defined here but it seems there's instructions on how to use it.

ignore = ["pydeck/labextension/**", "yarn.lock", ".*", "package-lock.json"]