Skip to content

Commit 83172a3

Browse files
committed
first commit
0 parents  commit 83172a3

File tree

17 files changed

+500
-0
lines changed

17 files changed

+500
-0
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
16+
- name: Install dependencies
17+
run: python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.10
18+
- name: Build the extension
19+
run: |
20+
python -m pip install -e .
21+
jupyter labextension list 2>&1 | grep -ie "jupyterlab_stata_highlight2.*OK"
22+
python -m jupyterlab.browser_check
23+
pip uninstall -y myextension
24+
pip install -v -e .
25+
jupyter labextension develop . --overwrite

.gitignore

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
*.bundle.*
2+
node_modules/
3+
*.egg-info/
4+
.ipynb_checkpoints
5+
*.tsbuildinfo
6+
jupyterlab_stata_highlight2/labextension
7+
8+
# Created by https://www.gitignore.io/api/python
9+
# Edit at https://www.gitignore.io/?templates=python
10+
11+
### Python ###
12+
# Byte-compiled / optimized / DLL files
13+
__pycache__/
14+
*.py[cod]
15+
*$py.class
16+
17+
# C extensions
18+
*.so
19+
20+
# Distribution / packaging
21+
.Python
22+
build/
23+
develop-eggs/
24+
dist/
25+
downloads/
26+
eggs/
27+
.eggs/
28+
lib64/
29+
parts/
30+
sdist/
31+
var/
32+
wheels/
33+
pip-wheel-metadata/
34+
share/python-wheels/
35+
.installed.cfg
36+
*.egg
37+
MANIFEST
38+
39+
# PyInstaller
40+
# Usually these files are written by a python script from a template
41+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
42+
*.manifest
43+
*.spec
44+
45+
# Installer logs
46+
pip-log.txt
47+
pip-delete-this-directory.txt
48+
49+
# Unit test / coverage reports
50+
htmlcov/
51+
.tox/
52+
.nox/
53+
.coverage
54+
.coverage.*
55+
.cache
56+
nosetests.xml
57+
coverage.xml
58+
*.cover
59+
.hypothesis/
60+
.pytest_cache/
61+
62+
# Translations
63+
*.mo
64+
*.pot
65+
66+
# Scrapy stuff:
67+
.scrapy
68+
69+
# Sphinx documentation
70+
docs/_build/
71+
72+
# PyBuilder
73+
target/
74+
75+
# pyenv
76+
.python-version
77+
78+
# celery beat schedule file
79+
celerybeat-schedule
80+
81+
# SageMath parsed files
82+
*.sage.py
83+
84+
# Spyder project settings
85+
.spyderproject
86+
.spyproject
87+
88+
# Rope project settings
89+
.ropeproject
90+
91+
# Mr Developer
92+
.mr.developer.cfg
93+
.project
94+
.pydevproject
95+
96+
# mkdocs documentation
97+
/site
98+
99+
# mypy
100+
.mypy_cache/
101+
.dmypy.json
102+
dmypy.json
103+
104+
# Pyre type checker
105+
.pyre/
106+
107+
# End of https://www.gitignore.io/api/python
108+
109+
# OSX files
110+
.DS_Store

LICENSE

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
The MIT License (MIT)
3+
Copyright (c) 2022, Tim Huegerich
4+
5+
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:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
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.
10+

MANIFEST.in

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
include LICENSE
2+
include *.md
3+
include pyproject.toml
4+
5+
include package.json
6+
include install.json
7+
include ts*.json
8+
include yarn.lock
9+
10+
graft jupyterlab_stata_highlight2/labextension
11+
12+
# Javascript files
13+
graft lib
14+
graft style
15+
prune **/node_modules
16+
17+
# Patterns to exclude from any directory
18+
global-exclude *~
19+
global-exclude *.pyc
20+
global-exclude *.pyo
21+
global-exclude .git
22+
global-exclude .ipynb_checkpoints

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# jupyterlab_stata_highlight2
2+
3+
![Github Actions Status](https://github.com/hugetim/jupyterlab_stata_highlight2/workflows/Build/badge.svg)
4+
5+
JupyterLab extension for Stata syntax highlighting similar to the Stata IDE's.
6+
7+
## Requirements
8+
9+
* JupyterLab >= 3.1
10+
11+
## Install
12+
13+
```bash
14+
pip install jupyterlab_stata_highlight2
15+
```
16+
17+
## Contributing
18+
19+
### Development install
20+
21+
Note: You will need NodeJS to build the extension package.
22+
23+
The `jlpm` command is JupyterLab's pinned version of
24+
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
25+
`yarn` or `npm` in lieu of `jlpm` below.
26+
27+
```bash
28+
# Clone the repo to your local environment
29+
# Change directory to the jupyterlab_stata_highlight2 directory
30+
# Install package in development mode
31+
pip install -e .
32+
# Link your development version of the extension with JupyterLab
33+
jupyter labextension develop . --overwrite
34+
# Rebuild extension Typescript source after making changes
35+
jlpm run build
36+
```
37+
38+
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
39+
40+
```bash
41+
# Watch the source directory in one terminal, automatically rebuilding when needed
42+
jlpm run watch
43+
# Run JupyterLab in another terminal
44+
jupyter lab
45+
```
46+
47+
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
48+
49+
By default, the `jlpm run build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
50+
51+
```bash
52+
jupyter lab build --minimize=False
53+
```
54+
55+
### Uninstall
56+
57+
```bash
58+
pip uninstall jupyterlab_stata_highlight2
59+
```
60+
61+
## Updating the version
62+
63+
To update the version, install tbump and use it to bump the version.
64+
By default it will also create a tag.
65+
66+
```bash
67+
pip install tbump
68+
tbump <new-version>
69+
```
70+
71+
## Predecessor license notices
72+
Extension boilerplate originated in Project Jupyter's https://github.com/jupyterlab/extension-cookiecutter-js
73+
Extension content forked from Kyle Barron's https://github.com/kylebarron/jupyterlab-stata-highlight
74+
Please note their respective licenses.

binder/environment.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# a mybinder.org-ready environment for demoing jupyterlab_stata_highlight2
2+
# this environment may also be used locally on Linux/MacOS/Windows, e.g.
3+
#
4+
# conda env update --file binder/environment.yml
5+
# conda activate jupyterlab_stata_highlight2-demo
6+
#
7+
name: jupyterlab_stata_highlight2-demo
8+
9+
channels:
10+
- conda-forge
11+
12+
dependencies:
13+
# runtime dependencies
14+
- python >=3.8,<3.9.0a0
15+
- jupyterlab >=3,<4.0.0a0
16+
# labextension build dependencies
17+
- nodejs >=14,<15
18+
- pip
19+
- wheel
20+
# additional packages for demos
21+
# - ipywidgets

binder/postBuild

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python3
2+
""" perform a development install of jupyterlab_stata_highlight2
3+
4+
On Binder, this will run _after_ the environment has been fully created from
5+
the environment.yml in this directory.
6+
7+
This script should also run locally on Linux/MacOS/Windows:
8+
9+
python3 binder/postBuild
10+
"""
11+
import subprocess
12+
import sys
13+
from pathlib import Path
14+
15+
16+
ROOT = Path.cwd()
17+
18+
def _(*args, **kwargs):
19+
""" Run a command, echoing the args
20+
21+
fails hard if something goes wrong
22+
"""
23+
print("\n\t", " ".join(args), "\n")
24+
return_code = subprocess.call(args, **kwargs)
25+
if return_code != 0:
26+
print("\nERROR", return_code, " ".join(args))
27+
sys.exit(return_code)
28+
29+
# verify the environment is self-consistent before even starting
30+
_(sys.executable, "-m", "pip", "check")
31+
32+
# install the labextension
33+
_(sys.executable, "-m", "pip", "install", "-e", ".")
34+
35+
# verify the environment the extension didn't break anything
36+
_(sys.executable, "-m", "pip", "check")
37+
38+
# list the extensions
39+
_("jupyter", "server", "extension", "list")
40+
41+
# initially list installed extensions to determine if there are any surprises
42+
_("jupyter", "labextension", "list")
43+
44+
45+
print("JupyterLab with jupyterlab_stata_highlight2 is ready to run with:\n")
46+
print("\tjupyter lab\n")

install.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"packageManager": "python",
3+
"packageName": "jupyterlab_stata_highlight2",
4+
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_stata_highlight2"
5+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
import json
3+
from pathlib import Path
4+
5+
from ._version import __version__
6+
7+
HERE = Path(__file__).parent.resolve()
8+
9+
with (HERE / "labextension" / "package.json").open() as fid:
10+
data = json.load(fid)
11+
12+
def _jupyter_labextension_paths():
13+
return [{
14+
"src": "labextension",
15+
"dest": data["name"]
16+
}]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__version__ = "0.1.0"
2+

0 commit comments

Comments
 (0)