Skip to content

Commit e601171

Browse files
committed
Migrate repo to be based off new jupyterlab extension cookiecutter
1 parent 907ca2d commit e601171

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+13395
-0
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
custom: ["https://www.buymeacoffee.com/ryantam626"]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Binder Badge
2+
on:
3+
pull_request_target:
4+
types: [opened]
5+
6+
jobs:
7+
binder:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
pull-requests: write
11+
steps:
12+
- uses: jupyterlab/maintainer-tools/.github/actions/binder-link@v1
13+
with:
14+
15+
github_token: ${{ secrets.github_token }}
16+

.github/wip-workflows/build.yml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: '*'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Base Setup
18+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
19+
20+
- name: Install dependencies
21+
run: python -m pip install -U jupyterlab~=3.1
22+
23+
- name: Lint the extension
24+
run: |
25+
set -eux
26+
jlpm
27+
jlpm run lint:check
28+
29+
- name: Test the extension
30+
run: |
31+
set -eux
32+
jlpm run test
33+
34+
- name: Build the extension
35+
run: |
36+
set -eux
37+
python -m pip install .[test]
38+
39+
pytest -vv -r ap --cov jupyterlab_code_formatter
40+
jupyter server extension list
41+
jupyter server extension list 2>&1 | grep -ie "jupyterlab_code_formatter.*OK"
42+
43+
jupyter labextension list
44+
jupyter labextension list 2>&1 | grep -ie "jupyterlab_code_formatter.*OK"
45+
python -m jupyterlab.browser_check
46+
47+
- name: Package the extension
48+
run: |
49+
set -eux
50+
51+
pip install build
52+
python -m build
53+
pip uninstall -y "jupyterlab_code_formatter" jupyterlab
54+
55+
- name: Upload extension packages
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: extension-artifacts
59+
path: dist/jupyterlab_code_formatter*
60+
if-no-files-found: error
61+
62+
test_isolated:
63+
needs: build
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v3
69+
- name: Install Python
70+
uses: actions/setup-python@v4
71+
with:
72+
python-version: '3.9'
73+
architecture: 'x64'
74+
- uses: actions/download-artifact@v3
75+
with:
76+
name: extension-artifacts
77+
- name: Install and Test
78+
run: |
79+
set -eux
80+
# Remove NodeJS, twice to take care of system and locally installed node versions.
81+
sudo rm -rf $(which node)
82+
sudo rm -rf $(which node)
83+
84+
pip install "jupyterlab~=3.1" jupyterlab_code_formatter*.whl
85+
86+
87+
jupyter server extension list
88+
jupyter server extension list 2>&1 | grep -ie "jupyterlab_code_formatter.*OK"
89+
90+
jupyter labextension list
91+
jupyter labextension list 2>&1 | grep -ie "jupyterlab_code_formatter.*OK"
92+
python -m jupyterlab.browser_check --no-chrome-test
93+
94+
integration-tests:
95+
name: Integration tests
96+
needs: build
97+
runs-on: ubuntu-latest
98+
99+
env:
100+
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers
101+
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v3
105+
106+
- name: Base Setup
107+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
108+
109+
- name: Download extension package
110+
uses: actions/download-artifact@v3
111+
with:
112+
name: extension-artifacts
113+
114+
- name: Install the extension
115+
run: |
116+
set -eux
117+
python -m pip install "jupyterlab~=3.1" jupyterlab_code_formatter*.whl
118+
119+
- name: Install dependencies
120+
working-directory: ui-tests
121+
env:
122+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
123+
run: jlpm install
124+
125+
- name: Set up browser cache
126+
uses: actions/cache@v3
127+
with:
128+
path: |
129+
${{ github.workspace }}/pw-browsers
130+
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}
131+
132+
- name: Install browser
133+
run: jlpm playwright install chromium
134+
working-directory: ui-tests
135+
136+
- name: Execute integration tests
137+
working-directory: ui-tests
138+
run: |
139+
jlpm playwright test
140+
141+
- name: Upload Playwright Test report
142+
if: always()
143+
uses: actions/upload-artifact@v3
144+
with:
145+
name: jupyterlab_code_formatter-playwright-tests
146+
path: |
147+
ui-tests/test-results
148+
ui-tests/playwright-report
149+
150+
check_links:
151+
name: Check Links
152+
runs-on: ubuntu-latest
153+
timeout-minutes: 15
154+
steps:
155+
- uses: actions/checkout@v3
156+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
157+
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Check Release
2+
on:
3+
push:
4+
branches: ["main"]
5+
pull_request:
6+
branches: ["*"]
7+
8+
jobs:
9+
check_release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
- name: Base Setup
15+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
16+
- name: Install Dependencies
17+
run: |
18+
pip install -e .
19+
- name: Check Release
20+
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
21+
with:
22+
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Upload Distributions
26+
uses: actions/upload-artifact@v3
27+
with:
28+
name: jupyterlab_code_formatter-releaser-dist-${{ github.run_number }}
29+
path: .jupyter_releaser_checkout/dist
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Update Playwright Snapshots
2+
3+
on:
4+
issue_comment:
5+
types: [created, edited]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
13+
14+
update-snapshots:
15+
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'please update playwright snapshots') }}
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
with:
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Configure git to use https
25+
run: git config --global hub.protocol https
26+
27+
- name: Checkout the branch from the PR that triggered the job
28+
run: hub pr checkout ${{ github.event.issue.number }}
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Base Setup
33+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
34+
35+
- name: Install dependencies
36+
run: python -m pip install -U jupyterlab~=3.1
37+
38+
- name: Install extension
39+
run: |
40+
set -eux
41+
jlpm
42+
python -m pip install .
43+
44+
- uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
45+
with:
46+
github_token: ${{ secrets.GITHUB_TOKEN }}
47+
# Playwright knows how to start JupyterLab server
48+
start_server_script: 'null'
49+
test_folder: ui-tests
50+

.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+
jupyterlab_code_formatter

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
<!-- <START NEW CHANGELOG ENTRY> -->
4+
5+
<!-- <END NEW CHANGELOG ENTRY> -->

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2023 Ryan TAM
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
![](docs/logo.png)
2+
3+
*A JupyterLab plugin to facilitate invocation of code formatters.*
4+
5+
PSA: This plugin is currently undergoing a major refactor, bear with me while I work on this.
6+
7+
----
8+
9+
Documentation: [Hosted on GitHub Pages](https://ryantam626.github.io/jupyterlab_code_formatter/index.html)
10+
11+
This is currently out of date. I will be updating that shortly.
12+
13+
----
14+
15+
## Demo
16+
17+
![](docs/_static/format-all.gif)
18+
19+
----
20+
21+
## Quick Start
22+
23+
I recommend you going to the [documentation site](https://ryantam626.github.io/jupyterlab_code_formatter/index.html#quick-start), but this should work too.
24+
25+
1. **Install the package**
26+
```bash
27+
pip install jupyterlab-code-formatter
28+
```
29+
30+
2. **Install some supported formatters** (isort+black are default for Python)
31+
```bash
32+
# NOTE: Install black and isort,
33+
# JL code formatter is configured to invoke isort and black by default
34+
pip install black isort
35+
```
36+
37+
3. **Restart JupyterLab**
38+
39+
This plugin includes a server plugin, restart JupyterLab if you have followed the above steps while it's running.
40+
41+
4. **Configure plugin**
42+
43+
To configure which/how formatters are invoked, see [configuration](https://ryantam626.github.io/jupyterlab_code_formatter/configuration.html).
44+
45+
----
46+
47+
## Your Support
48+
49+
I could really use your support in giving me a star on GitHub, recommending features, fixing bugs or maybe even providing monetary support!
50+
51+
- [Recommending features via GitHub Issues](https://github.com/ryantam626/jupyterlab_code_formatter/issues)
52+
- [Sumitting your PR on GitHub](https://github.com/ryantam626/jupyterlab_code_formatter/pulls)
53+
- [Buy me a coffee](https://www.buymeacoffee.com/ryantam626)
54+
- [Donating Via Solana](https://solana.com/): 6K7aK5RpskJkhEkwZi1ZQr68LhaVdfnTfWjZEQV3VbbD
55+
56+
----
57+
58+
## Contributors
59+
60+
Massive thanks to the below list of people who made past contributions to the project!
61+
62+
<a href="https://github.com/ryantam626/jupyterlab_code_formatter/graphs/contributors">
63+
<img src="https://contrib.rocks/image?repo=ryantam626/jupyterlab_code_formatter" />
64+
</a>
65+
66+
## License
67+
68+
This project is licensed under the terms of the [MIT LICENSE](LICENSE) .

0 commit comments

Comments
 (0)