Skip to content

Commit b779035

Browse files
Scaffolding for adding a npm package and setting up the releaser (#23)
* Scaffolding for adding a npm package and setting up the releaser * Automatic application of license header * Fix attempt for jupyter-releaser * Add yarn.lock * ignore yarn.lock for license * Set package as private for now to avoid publication and conflict with core package * Fix pre-commit * Fix test for pypy * Skip npm publication for now * Lint code * Fix more tests * Another try to fix pypy warning * Fourth try * Drop PyPy test --------- Co-authored-by: Frédéric Collonval <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 4dbb6d9 commit b779035

20 files changed

+3130
-119
lines changed

.copier-answers.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: v4.3.4
3+
_src_path: https://github.com/jupyterlab/extension-template
4+
author_email: [email protected]
5+
author_name: Jupyter Development Team
6+
has_binder: false
7+
has_settings: false
8+
kind: frontend
9+
labextension_name: '@jupyterlab/builder'
10+
project_short_description: Jupyter build tools.
11+
python_name: jupyter_builder
12+
repository: https://github.com/jupyterlab/jupyterlab-builder
13+
test: false
14+

.github/workflows/build.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Base Setup
24+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
25+
26+
- name: Install dependencies
27+
run: python -m pip install .[test]
28+
29+
- name: Lint the extension
30+
run: |
31+
set -eux
32+
jlpm
33+
jlpm run lint:check
34+
35+
- name: Package the extension
36+
run: |
37+
set -eux
38+
39+
pip install build
40+
python -m build
41+
42+
- name: Upload extension packages
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: extension-artifacts
46+
path: dist/jupyter_builder*
47+
if-no-files-found: error
48+
49+
test_isolated:
50+
needs: build
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- name: Install Python
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: '3.9'
58+
architecture: 'x64'
59+
- uses: actions/download-artifact@v4
60+
with:
61+
name: extension-artifacts
62+
- name: Install and Test
63+
run: |
64+
set -eux
65+
66+
pip install jupyter_builder*.whl
67+
68+
69+
check_links:
70+
name: Check Links
71+
runs-on: ubuntu-latest
72+
timeout-minutes: 15
73+
steps:
74+
- uses: actions/checkout@v4
75+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
76+
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Check Release
2+
on:
3+
push:
4+
branches: ["main"]
5+
pull_request:
6+
branches: ["*"]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
check_release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Base Setup
19+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
20+
- name: Check Release
21+
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
22+
with:
23+
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Upload Distributions
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: jupyter_builder-releaser-dist-${{ github.run_number }}
30+
path: .jupyter_releaser_checkout/dist

.github/workflows/pre-release.yml renamed to .github/workflows/prep-release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
post_version_spec:
1313
description: "Post Version Specifier"
1414
required: false
15+
# silent:
16+
# description: "Set a placeholder in the changelog and don't publish the release."
17+
# required: false
18+
# type: boolean
1519
since:
1620
description: "Use PRs with activity since this date or git reference"
1721
required: false
@@ -33,9 +37,8 @@ jobs:
3337
with:
3438
token: ${{ secrets.GITHUB_TOKEN }}
3539
version_spec: ${{ github.event.inputs.version_spec }}
36-
silent: ${{ github.event.inputs.silent }}
40+
# silent: ${{ github.event.inputs.silent }}
3741
post_version_spec: ${{ github.event.inputs.post_version_spec }}
38-
target: ${{ github.event.inputs.target }}
3942
branch: ${{ github.event.inputs.branch }}
4043
since: ${{ github.event.inputs.since }}
4144
since_last_stable: ${{ github.event.inputs.since_last_stable }}

.github/workflows/publish-release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
steps_to_skip:
1212
description: "Comma separated list of steps to skip"
1313
required: false
14+
default: 'build-npm'
1415

1516
jobs:
1617
publish_release:
@@ -38,6 +39,8 @@ jobs:
3839

3940
- name: Finalize Release
4041
id: finalize-release
42+
env:
43+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4144
uses: jupyter-server/jupyter_releaser/.github/actions/finalize-release@v2
4245
with:
4346
token: ${{ steps.app-token.outputs.token }}

.github/workflows/python-tests.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
matrix:
2323
os: [ubuntu-latest, windows-latest, macos-latest]
2424
python-version: ["3.8", "3.12"]
25-
include:
26-
- os: ubuntu-latest
27-
python-version: "pypy-3.8"
25+
# include:
26+
# - os: ubuntu-latest
27+
# python-version: "pypy-3.8"
2828
steps:
2929
- name: Checkout
3030
uses: actions/checkout@v4
@@ -62,8 +62,7 @@ jobs:
6262
-
6363
run: pip install -e ".[test,dev]"
6464
- name: Run the unit tests
65-
run: |
66-
pytest
65+
run: pytest
6766

6867
test_prereleases:
6968
name: Test Prereleases
@@ -74,10 +73,10 @@ jobs:
7473
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
7574
with:
7675
dependency_type: pre
76+
-
77+
run: pip install -e ".[test,dev]"
7778
- name: Run the tests
78-
run: |
79-
pip install pytest
80-
pytest
79+
run: pytest
8180

8281
make_sdist:
8382
name: Make SDist
@@ -97,8 +96,8 @@ jobs:
9796
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
9897
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
9998
with:
100-
package_spec: -vv .
101-
test_command: pip install pytest && pytest
99+
package_spec: -vv .[test]
100+
test_command: pytest
102101

103102
check_release:
104103
runs-on: ubuntu-latest

.gitignore

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
*.bundle.*
2+
lib/
3+
node_modules/
4+
*.log
5+
.eslintcache
6+
.stylelintcache
7+
*.egg-info/
8+
.ipynb_checkpoints
9+
*.tsbuildinfo
10+
# Version file is handled by hatchling
11+
jupyter_builder/_version.py
12+
13+
# Created by https://www.gitignore.io/api/python
14+
# Edit at https://www.gitignore.io/?templates=python
15+
16+
### Python ###
117
# Byte-compiled / optimized / DLL files
218
__pycache__/
319
*.py[cod]
@@ -20,6 +36,7 @@ parts/
2036
sdist/
2137
var/
2238
wheels/
39+
pip-wheel-metadata/
2340
share/python-wheels/
2441
*.egg-info/
2542
.installed.cfg
@@ -44,6 +61,7 @@ htmlcov/
4461
.coverage.*
4562
.cache
4663
nosetests.xml
64+
coverage/
4765
coverage.xml
4866
*.cover
4967
*.py,cover
@@ -55,16 +73,6 @@ cover/
5573
*.mo
5674
*.pot
5775

58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
6876
# Scrapy stuff:
6977
.scrapy
7078

@@ -83,36 +91,9 @@ profile_default/
8391
ipython_config.py
8492

8593
# pyenv
86-
# For a library or package, you might want to ignore these files since the code is
87-
# intended to run in multiple environments; otherwise, check them in:
88-
# .python-version
89-
90-
# pipenv
91-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94-
# install all needed dependencies.
95-
#Pipfile.lock
96-
97-
# poetry
98-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102-
#poetry.lock
103-
104-
# pdm
105-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106-
#pdm.lock
107-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108-
# in version control.
109-
# https://pdm.fming.dev/#use-with-ide
110-
.pdm.toml
111-
112-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113-
__pypackages__/
114-
115-
# Celery stuff
94+
.python-version
95+
96+
# celery beat schedule file
11697
celerybeat-schedule
11798
celerybeat.pid
11899

@@ -135,6 +116,11 @@ venv.bak/
135116
# Rope project settings
136117
.ropeproject
137118

119+
# Mr Developer
120+
.mr.developer.cfg
121+
.project
122+
.pydevproject
123+
138124
# mkdocs documentation
139125
/site
140126

@@ -160,4 +146,10 @@ cython_debug/
160146
#.idea/
161147
junit.xml
162148

163-
tests/dummy/
149+
# End of https://www.gitignore.io/api/python
150+
151+
# OSX files
152+
.DS_Store
153+
154+
# Yarn cache
155+
.yarn/

.licenserc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ header:
1919
- tsconfig.tsbuildinfo
2020
- node_modules/**
2121
- node_modules/.**
22+
- 'yarn.lock'
2223

2324
comment: on-failure

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ repos:
1818
- id: check-yaml
1919
- id: debug-statements
2020
- id: end-of-file-fixer
21+
exclude: \.copier-answers\.yml
2122
- id: trailing-whitespace
2223

2324
- repo: https://github.com/python-jsonschema/check-jsonschema

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
**/node_modules
3+
**/lib
4+
**/package.json
5+
!/package.json
6+
jupyter_builder

0 commit comments

Comments
 (0)