Skip to content

Commit

Permalink
Merge branch 'jlab4' into 'master'
Browse files Browse the repository at this point in the history
Migration to jupyterlab 4

See merge request beenje/jupyterlab-gitlab!6
  • Loading branch information
beenje committed Jul 26, 2023
2 parents b6758ed + 8a90175 commit ce6f375
Show file tree
Hide file tree
Showing 24 changed files with 7,310 additions and 7,470 deletions.
15 changes: 8 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
*.bundle.*
lib/
node_modules/
*.log
.eslintcache
.stylelintcache
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
jupyterlab_gitlab/labextension
# Version file is handled by hatchling
jupyterlab_gitlab/_version.py

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
Expand Down Expand Up @@ -56,6 +61,7 @@ htmlcov/
.coverage.*
.cache
nosetests.xml
coverage/
coverage.xml
*.cover
.hypothesis/
Expand Down Expand Up @@ -111,10 +117,5 @@ dmypy.json
# OSX files
.DS_Store

test/build/*
.vscode/
.idea/
.ipynb_checkpoints/
npm-debug.log
package-lock.json
*.swp
# Yarn cache
.yarn/
10 changes: 6 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ stages:
- release

.jupyterlab_ext:
image: condaforge/miniforge3:latest
image: condaforge/mambaforge:latest
before_script:
- source /opt/conda/etc/profile.d/conda.sh
- conda create -n jupyterlab-ext -y python=3 jupyterlab=3 jupyter-packaging nodejs=14
- mamba create -n jupyterlab-ext -y python=3 jupyterlab=4 nodejs=18
- conda activate jupyterlab-ext

run-pre-commit:
stage: check
image: python:3.6
image: python:3.9
before_script:
- pip install pre-commit
script:
Expand Down Expand Up @@ -42,12 +42,14 @@ test-python3:
stage: test
script:
- python -m pip install dist/jupyterlab*.whl
- jupyter server extension list
- jupyter server extension list 2>&1 | grep -ie "jupyterlab_gitlab.*OK"
- jupyter labextension list
- jupyter labextension list 2>&1 | grep -ie "jupyterlab-gitlab.*OK"

release-pypi:
stage: release
image: python:3.7
image: python:3.9
before_script:
- pip install twine
script:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
repos:
- repo: https://github.com/ambv/black
rev: 21.7b0
rev: 23.3.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
rev: 6.0.0
hooks:
- id: flake8
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
**/node_modules
**/lib
**/package.json
!/package.json
jupyterlab_gitlab
3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
enableImmutableInstalls: false

nodeLinker: node-modules
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Version 4.0.0 (2021-08-23)

- Update for JupyterLab 4.0
(not compatible with JupyterLab 3.x)
- Get the project default branch from the API

## Version 3.0.0 (2021-08-19)

- Update for JupyterLab 3.1
Expand Down
19 changes: 10 additions & 9 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
BSD 3-Clause License

Copyright (c) 2021, Benjamin Bertrand All rights reserved.
Copyright (c) 2023, Benjamin Bertrand
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down
27 changes: 0 additions & 27 deletions MANIFEST.in

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ If you want to use git from JupyterLab, you should look at the

## Requirements

* JupyterLab >= 3.0
* JupyterLab >= 4.0
* JupyterLab 1.x for version 1.x
* JupyterLab 2.x for version 2.x
* JupyterLab 3.x for version 3.x
* JupyterLab 4.x for version 4.x
* A GitLab account for the server extension

## Installation
Expand Down
77 changes: 77 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Making a new release of jupyterlab_gitlab

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 are in the `pyproject.toml` file to wrap your extension in a
Python package. Before generating a package, you first need to install some tools:

```bash
pip install build twine hatch
```

Bump the version using `hatch`. By default this will create a tag.
See the docs on [hatch-nodejs-version](https://github.com/agoose77/hatch-nodejs-version#semver) for details.

```bash
hatch version <new-version>
```

Make sure to clean up all the development files before building the package:

```bash
jlpm clean:all
```

You could also clean up the local git repository:

```bash
git clean -dfX
```

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.
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
```

## Automated releases with the Jupyter Releaser

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

Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html) for more information.

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

- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the [Github Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) in the repository
- Go to the Actions panel
- Run the "Step 1: Prep Release" workflow
- Check the draft changelog
- Run the "Step 2: 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.
7 changes: 7 additions & 0 deletions jupyter-config/nb-config/jupyterlab_gitlab.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"NotebookApp": {
"nbserver_extensions": {
"jupyterlab_gitlab": true
}
}
}
7 changes: 7 additions & 0 deletions jupyter-config/server-config/jupyterlab_gitlab.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ServerApp": {
"jpserver_extensions": {
"jupyterlab_gitlab": true
}
}
}
12 changes: 3 additions & 9 deletions jupyterlab_gitlab/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
import json
from pathlib import Path

from ._version import __version__ # noqa
from .gitlab import setup_handlers

HERE = Path(__file__).parent.resolve()

with (HERE / "labextension" / "package.json").open() as fid:
data = json.load(fid)


def _jupyter_labextension_paths():
return [{"src": "labextension", "dest": data["name"]}]
return [{"src": "labextension", "dest": "jupyterlab-gitlab"}]


def _jupyter_server_extension_points():
Expand All @@ -27,6 +19,8 @@ def _load_jupyter_server_extension(server_app):
JupyterLab application instance
"""
setup_handlers(server_app.web_app)
name = "jupyterlab_gitlab"
server_app.log.info(f"Registered {name} server extension")


# For backward compatibility with notebook server - useful for Binder/JupyterHub
Expand Down
20 changes: 0 additions & 20 deletions jupyterlab_gitlab/_version.py

This file was deleted.

Loading

0 comments on commit ce6f375

Please sign in to comment.