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

Move Python packages to the python folder #3301

Merged
merged 5 commits into from
Nov 2, 2021
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
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ jobs:
python -m pip install jupyterlab~=3.0 jupyter_packaging~=0.10
- name: Build the extension
run: |
pushd python/ipywidgets
pip install .
popd
jlpm install
jlpm run build
cd jupyterlab_widgets
pushd python/jupyterlab_widgets
pwd
pip install -e .
jupyter labextension develop . --overwrite
popd
jupyter labextension list

python -m jupyterlab.browser_check
53 changes: 53 additions & 0 deletions .github/workflows/devinstall.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Run the dev-install script

on:
push:
branches: master
pull_request:
branches: '*'

jobs:
devinstall:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: '3.8'
architecture: 'x64'
- name: Cache pip on Linux
uses: actions/cache@v1
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn
uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
python -m pip install notebook jupyterlab~=3.0 jupyter_packaging~=0.10
- name: Run the dev-install script
run: |
./dev-install.sh
jupyter nbextension list
jupyter labextension list

python -m jupyterlab.browser_check
11 changes: 7 additions & 4 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,24 @@ jobs:
python -m pip install --upgrade pip wheel build jupyterlab~=3.0
- name: Build PyPI distributions for ipywidgets
run: |
mkdir -p dist/
cd python/ipywidgets
python -m build
cp ./dist/* ../../dist
- name: Build and link packages
run: |
yarn install
yarn run build
- name: Build PyPI distributions for jupyterlab_widgets
run: |
cd jupyterlab_widgets
cd python/jupyterlab_widgets
python -m build
cp ./dist/* ../dist
cp ./dist/* ../../dist
- name: Build PyPI distributions for widgetsnbextension
run: |
cd widgetsnbextension
cd python/widgetsnbextension
python -m build
cp ./dist/* ../dist
cp ./dist/* ../../dist
- name: Build checksum file
run: |
cd dist
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
sudo apt-get install -y pandoc
python -m pip install --upgrade pip
python -m pip install file://$PWD#egg=ipywidgets
python -m pip install file://$PWD/python/ipywidgets#egg=ipywidgets
python -m pip install -r ./docs/requirements.txt
- name: Build docs
run: |
Expand Down Expand Up @@ -115,10 +115,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install file://$PWD#egg=ipywidgets[test]
pip install file://$PWD/python/ipywidgets#egg=ipywidgets[test]
- name: Test with pytest
run: |
pip install pytest
cd python/ipywidgets
pytest --cov=ipywidgets ipywidgets
spec:
name: Message Specification
Expand All @@ -138,7 +139,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install file://$PWD#egg=ipywidgets
pip install file://$PWD/python/ipywidgets#egg=ipywidgets
- name: Compare spec with latest version
run: |
python ./packages/schema/generate-spec.py -f markdown spec.md
Expand Down Expand Up @@ -184,10 +185,12 @@ jobs:
yarn run build
- name: Build the extension
run: |
cd python/ipywidgets
pip install .
cd ../..
jlpm install
jlpm run build
cd jupyterlab_widgets
cd python/jupyterlab_widgets
pwd
pip install -e .
jupyter labextension develop . --overwrite
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ npm-debug.log
.vscode/*
!.vscode/extensions.json

widgetsnbextension/widgetsnbextension/static
jupyterlab_widgets/jupyterlab_widgets/labextension/
python/widgetsnbextension/widgetsnbextension/static
python/jupyterlab_widgets/jupyterlab_widgets/labextension/

index.built.js
index.built.js.map
Expand Down
11 changes: 5 additions & 6 deletions dev-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,20 @@ yarn install
yarn run build

echo -n "widgetsnbextension"
cd widgetsnbextension
pip install -v -e .
pip install -v -e ./python/widgetsnbextension
if [[ "$OSTYPE" == "msys" ]]; then
jupyter nbextension install --overwrite --py $nbExtFlags widgetsnbextension
else
jupyter nbextension install --overwrite --py --symlink $nbExtFlags widgetsnbextension
fi
jupyter nbextension enable --py $nbExtFlags widgetsnbextension
cd ..

echo -n "ipywidgets"
pip install -v -e ".[test]"
pip install -v -e "./python/ipywidgets[test]"

if test "$skip_jupyter_lab" != yes; then
echo -n "jupyterlab_ipywidgets"
pip install jupyter_packaging
pip install -ve ./jupyterlab_widgets
jupyter labextension develop ./jupyterlab_widgets --overwrite
pip install -ve ./python/jupyterlab_widgets
jupyter labextension develop ./python/jupyterlab_widgets --overwrite
fi
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
# -- General information -------

_release = {}
exec(compile(open('../../ipywidgets/_version.py').read(), '../../ipywidgets/_version.py', 'exec'), _release)
exec(compile(open('../../python/ipywidgets/ipywidgets/_version.py').read(), '../../python/ipywidgets/ipywidgets/_version.py', 'exec'), _release)
from packaging.version import Version
v = Version(_release['__version__'])
version = f'{v.major}.{v.minor}'
Expand Down
7 changes: 2 additions & 5 deletions docs/source/dev_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@ To install ipywidgets from git, you will need:



### Installing With Conda
### Installing With Conda

```bash
conda create -c conda-forge -n ipywidgets yarn notebook
conda create -c conda-forge -n ipywidgets yarn notebook jupyterlab
conda activate ipywidgets
ipython kernel install --name ipywidgets --display-name "ipywidgets" --sys-prefix
pip install --pre jupyterlab
git clone https://github.com/jupyter-widgets/ipywidgets.git
cd ipywidgets
./dev-install.sh
```

Notice that we install the prerelease of JupyterLab currently, which is only available via `pip`.

Rebuilding after making changes
----------------------------

Expand Down
27 changes: 16 additions & 11 deletions docs/source/dev_release.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Developer Release Procedure
===========================
# Developer Release Procedure

To release a new version of the widgets on PyPI and npm, first checkout master
and cd into the repo root.
Expand All @@ -17,7 +16,6 @@ git clone [email protected]:jupyter-widgets/ipywidgets.git
cd ipywidgets
```


### Fix the widget spec

If there were changes in the widget model specification (i.e., any change made
Expand All @@ -27,6 +25,7 @@ record the documented attributes.
First, update the relevant model specification versions. For example, the commit https://github.com/jupyter-widgets/ipywidgets/commit/fca6f355605dc9e04062ce0eec4a7acbb5632ae2 updated the controls model version. We follow the semver spec for model version numbers, so model changes that are backwards-incompatible should be major version bumps, while backwards-compatible additions should be minor version bumps.

Next, regenerate the model spec with the new version numbers by doing something like this in the repository root directory:

```
python ./packages/schema/generate-spec.py -f json-pretty packages/schema/jupyterwidgetmodels.latest.json
python ./packages/schema/generate-spec.py -f markdown packages/schema/jupyterwidgetmodels.latest.md
Expand Down Expand Up @@ -57,47 +56,53 @@ Lerna will prompt you for version numbers for each of the changed npm packages i

### jupyterlab_widgets

Go into the `jupyterlab_widgets` directory. Change `jupyterlab_widgets/_version.py` to reflect the new version number.
Go into the `python/jupyterlab_widgets` directory. Change `jupyterlab_widgets/_version.py` to reflect the new version number.

```
python -m build
twine upload dist/*
```

Verify that the package is uploaded.

```
curl -s https://pypi.org/pypi/jupyterlab-widgets/json | jq -r '[.releases[][] | [.upload_time, .digests.sha256, .filename] | join(" ")] | sort '
```

### widgetsnbextension

Go into the `widgetsnbextension` directory. Change `widgetsnbextension/_version.py` to reflect the new version number.
Go into the `python/widgetsnbextension` directory. Change `widgetsnbextension/_version.py` to reflect the new version number.

```
python -m build
twine upload dist/*
```

Verify that the package is uploaded.

```
curl -s https://pypi.org/pypi/widgetsnbextension/json | jq -r '[.releases[][] | [.upload_time, .digests.sha256, .filename] | join(" ")] | sort '
```

### ipywidgets

Change `ipywidgets/_version.py` to reflect the new version number, and if necessary, a new `__html_manager_version__`. Change the `install_requires` parameter in `setup.py` reference the new widgetsnbextension version.
Go into the `python/ipywidgets` directory. Change `ipywidgets/_version.py` to reflect the new version number, and if necessary, a new `__html_manager_version__`. Change the `install_requires` parameter in `setup.py` reference the new widgetsnbextension version.

```
python -m build
twine upload dist/*
```

Verify that the package is uploaded:

```
curl -s https://pypi.org/pypi/ipywidgets/json | jq -r '[.releases[][] | [.upload_time, .digests.sha256, .filename] | join(" ")] | sort '
```

### Push changes back

Calculate the hashes of the uploaded files. You could use a small shell script, for example, like this on macOS:

```sh
#!/bin/sh
for f in $@
Expand All @@ -111,18 +116,18 @@ done
```

Using the above script, you can do:

```
hashes dist/*
hashes widgetsnbextension/dist/*
hashes jupyterlab_widgets/dist/*
hashes python/ipywidgets/dist/*
hashes python/widgetsnbextension/dist/*
hashes python/jupyterlab_widgets/dist/*
```

Commit the changes you've made above, and include the uploaded files hashes in the commit message. Tag the release if ipywidgets was released. Push to origin master (and include the tag in the push).

Update conda-forge packages (if the requirements changed to ipywidgets, make sure to update widgetsnbextension first).

Release Notes
=============
# Release Notes

### Changelog

Expand Down
2 changes: 1 addition & 1 deletion docs/source/dev_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To run the Python tests:

```sh
pytest --cov=ipywidgets ipywidgets
pytest --cov=ipywidgets ./python/ipywidgets
```

To run the Javascript tests in each package directory:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"private": true,
"workspaces": [
"packages/*",
"widgetsnbextension",
"python/widgetsnbextension",
"examples/*",
"jupyterlab_widgets"
"python/jupyterlab_widgets"
],
"scripts": {
"build": "lerna run build --ignore \"@jupyter-widgets/example-*\"",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"extends": "../tsconfigbase",
"extends": "../../tsconfigbase",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"include": ["src/**/*"],
"references": [
{
"path": "../packages/base"
"path": "../../packages/base"
},
{
"path": "../packages/controls"
"path": "../../packages/controls"
},
{
"path": "../packages/output"
"path": "../../packages/output"
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ version: 2
python:
version: 3.7
install:
- method: setuptools
path: .
- method: pip
jasongrout marked this conversation as resolved.
Show resolved Hide resolved
path: ./python/ipywidgets
- requirements: docs/requirements.txt