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

merge upstream #3

Open
wants to merge 84 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
7ce65d4
Remove explicit server extension enabling
yuvipanda Jul 28, 2022
7d2b954
Merge pull request #31 from yuvipanda/patch-1
betatim Aug 2, 2022
b0d3b5e
Increase timeout, remove extra extensions
tkukurin Sep 1, 2022
e08502d
Merge pull request #32 from tkukurin/patch-1
betatim Nov 25, 2022
cf40e84
Add Github Actions workflow to build and publish
xhochy Nov 25, 2022
a1a5f79
Upload on release
xhochy Nov 25, 2022
8a44db0
Add release trigger
xhochy Nov 25, 2022
07bbff2
Update .github/workflows/ci.yaml
xhochy Nov 25, 2022
7869d63
Merge pull request #34 from xhochy/gha
xhochy Nov 26, 2022
8c8e15f
Only upload on release creation.
xhochy Dec 20, 2022
24abe6c
Update .github/workflows/ci.yaml
xhochy Dec 21, 2022
b870d8c
Merge pull request #35 from betatim/xhochy-patch-1
xhochy Dec 21, 2022
c2a69ff
Run CI on pull requests
xhochy Aug 18, 2023
bac01ce
Merge pull request #40 from betatim/ci-on-prs
xhochy Aug 18, 2023
1de6cee
Move _get_vscode_cmd outside of setup_vscode function.
janjagusch Aug 15, 2023
e805c81
Allow to specify code executable.
janjagusch Aug 15, 2023
796a39b
Add openvscode-server as executable option.
janjagusch Aug 15, 2023
ce43836
Refactor to remove redundancy.
janjagusch Aug 15, 2023
296f9d8
Add type hints.
janjagusch Aug 15, 2023
bee1fe5
Rename to inner_cmd.
janjagusch Aug 15, 2023
593cb10
Update jupyter_vscode_proxy/__init__.py
janjagusch Aug 18, 2023
ae67d42
Merge pull request #39 from janjagusch/add-support-for-openvscode-server
xhochy Aug 18, 2023
937a0cd
Add some pre-commit hooks
xhochy Aug 18, 2023
445e69f
Merge pull request #41 from xhochy/pre-commit-hooks
xhochy Aug 18, 2023
dd45d91
Use micromamba everywhere in CI
xhochy Aug 18, 2023
f86bacf
Merge pull request #42 from betatim/use-micromamba-everywhere
xhochy Aug 18, 2023
790b719
Move to pyproject.toml and setuptools_scm
xhochy Aug 18, 2023
6414046
Merge pull request #43 from xhochy/pyproject.toml
xhochy Aug 18, 2023
915f147
Classifier 'Framework :: Juypter' is not a valid classifier.
xhochy Aug 18, 2023
ed4e8ea
Merge pull request #44 from xhochy/rm-framework-jupyter
xhochy Aug 18, 2023
6cf02f3
Add dependabot configuration
xhochy Aug 18, 2023
12ce85e
Add CODEOWNERS
xhochy Aug 18, 2023
bddc684
Merge pull request #46 from xhochy/codeowners
xhochy Aug 18, 2023
1b25745
Merge pull request #45 from xhochy/dependabot
xhochy Aug 18, 2023
77de68e
Bump the dependencies group with 1 update
dependabot[bot] Aug 18, 2023
ae63738
Merge pull request #47 from betatim/dependabot/github_actions/depende…
xhochy Aug 18, 2023
29782e8
Bump the dependencies group with 2 updates
dependabot[bot] Sep 11, 2023
9a0e6c9
Merge pull request #48 from betatim/dependabot/github_actions/depende…
xhochy Sep 11, 2023
4842443
Bump the dependencies group with 1 update
dependabot[bot] Oct 16, 2023
81ebad6
Merge pull request #49 from betatim/dependabot/github_actions/depende…
xhochy Oct 16, 2023
6068ae8
Bump the dependencies group with 1 update
dependabot[bot] Oct 30, 2023
fbc6ad5
Merge pull request #51 from betatim/dependabot/github_actions/depende…
xhochy Oct 30, 2023
9550c2e
Bump the dependencies group with 1 update
dependabot[bot] Dec 4, 2023
46a5052
Merge pull request #52 from betatim/dependabot/github_actions/depende…
xhochy Dec 4, 2023
7545b30
Bump the dependencies group with 2 updates
dependabot[bot] Dec 11, 2023
de375ad
Merge pull request #53 from betatim/dependabot/github_actions/depende…
xhochy Dec 11, 2023
b5ae10d
Bump the dependencies group with 1 update
dependabot[bot] Dec 18, 2023
41671a2
Merge pull request #54 from betatim/dependabot/github_actions/depende…
xhochy Dec 18, 2023
07740e3
Bump the dependencies group with 1 update
dependabot[bot] Jan 29, 2024
ca0e73d
Merge pull request #55 from betatim/dependabot/github_actions/depende…
xhochy Jan 29, 2024
2d5abaf
Bump the dependencies group with 1 update
dependabot[bot] Feb 12, 2024
d8682f6
Merge pull request #56 from betatim/dependabot/github_actions/depende…
xhochy Feb 12, 2024
298cdbb
Bump the dependencies group with 1 update
dependabot[bot] Feb 26, 2024
c52f5a6
Merge pull request #57 from betatim/dependabot/github_actions/depende…
xhochy Feb 26, 2024
95f83ac
Bump the dependencies group with 1 update
dependabot[bot] Mar 4, 2024
bbb7db3
Merge pull request #58 from betatim/dependabot/github_actions/depende…
xhochy Mar 4, 2024
22a4120
Bump the dependencies group with 1 update
dependabot[bot] Mar 11, 2024
2f9eb51
Merge pull request #59 from betatim/dependabot/github_actions/depende…
xhochy Mar 11, 2024
a2a035c
Add code-server icon behind `USE_CODE_SERVER_ICON`
krassowski May 6, 2024
9521f98
Update jupyter_vscode_proxy/__init__.py
xhochy May 6, 2024
8e7165e
Merge pull request #61 from krassowski/add-code-server-icon
xhochy May 7, 2024
00397bc
Bump mamba-org/setup-micromamba in the dependencies group
dependabot[bot] May 27, 2024
d68413e
Merge pull request #63 from betatim/dependabot/github_actions/depende…
xhochy May 27, 2024
4ec72fa
Bump pypa/gh-action-pypi-publish in the dependencies group
dependabot[bot] Jun 17, 2024
83475a3
Merge pull request #64 from betatim/dependabot/github_actions/depende…
xhochy Jun 18, 2024
3ec37d2
Bump pypa/gh-action-pypi-publish in the dependencies group
dependabot[bot] Sep 2, 2024
71d327d
Merge pull request #65 from betatim/dependabot/github_actions/depende…
xhochy Sep 2, 2024
0b1c337
Bump pypa/gh-action-pypi-publish in the dependencies group
dependabot[bot] Sep 9, 2024
8e6c87a
Merge pull request #66 from betatim/dependabot/github_actions/depende…
xhochy Sep 9, 2024
f3a6275
Bump pypa/gh-action-pypi-publish in the dependencies group
dependabot[bot] Sep 23, 2024
55eee1d
Merge pull request #67 from betatim/dependabot/github_actions/depende…
xhochy Sep 23, 2024
2fc4fd6
Bump the dependencies group with 2 updates
dependabot[bot] Oct 7, 2024
c1c6950
Merge pull request #68 from betatim/dependabot/github_actions/depende…
xhochy Oct 7, 2024
8e5cc5e
Bump pypa/gh-action-pypi-publish in the dependencies group
dependabot[bot] Nov 4, 2024
601a4bb
Merge pull request #69 from betatim/dependabot/github_actions/depende…
xhochy Nov 4, 2024
5d49341
Bump the dependencies group with 2 updates
dependabot[bot] Nov 11, 2024
63053f4
Merge pull request #70 from betatim/dependabot/github_actions/depende…
xhochy Nov 11, 2024
a0e5410
Update README.md
anhaabaete Nov 24, 2024
a7ada93
Update README.md
xhochy Nov 24, 2024
ad5b03d
Merge pull request #72 from anhaabaete/patch-1
xhochy Nov 24, 2024
7b9b1db
Bump mamba-org/setup-micromamba in the dependencies group
dependabot[bot] Dec 2, 2024
08235f4
Merge pull request #73 from betatim/dependabot/github_actions/depende…
xhochy Dec 2, 2024
c93bc28
Bump the dependencies group with 2 updates
dependabot[bot] Dec 16, 2024
b01fec4
Merge pull request #74 from betatim/dependabot/github_actions/depende…
xhochy Dec 16, 2024
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
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Taken directly from https://github.com/ambv/black/blob/master/.flake8
[flake8]
ignore = E203, E266, E501, W503, C901, D104, D100
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9
per-file-ignores =
tests/**:D101,D102,D103
docstring-convention = numpy
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @betatim @xhochy
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
dependencies:
patterns:
- "*"
30 changes: 30 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build and upload to PyPI
on:
push:
pull_request:
release:
types: [published]

jobs:
build_artifacts:
name: Build artifacts
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v4
- name: Fetch full git history
run: git fetch --prune --unshallow
- name: Set up Conda env
uses: mamba-org/setup-micromamba@068f1ab4b37ed9b3d9f73da7db90a0cda0a48d29
with:
environment-file: environment.yml
cache-environment: true
- shell: bash -el {0}
run:
python -m build
- uses: pypa/[email protected]
if: github.event_name == 'release'
with:
user: __token__
password: ${{ secrets.PYPI_RELEASE_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI
on: [push, pull_request]

# Automatically stop old builds on the same branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -el {0}

jobs:
pre-commit-checks:
name: "Linux - pre-commit checks - Python 3.10"
timeout-minutes: 30
runs-on: ubuntu-latest
env:
PRE_COMMIT_USE_MICROMAMBA: 1
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up micromamba
uses: mamba-org/setup-micromamba@068f1ab4b37ed9b3d9f73da7db90a0cda0a48d29
- name: Add micromamba to GITHUB_PATH
run: echo "${HOME}/micromamba-bin" >> "$GITHUB_PATH"
- name: Install Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Run pre-commit checks
uses: pre-commit/[email protected]
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/Quantco/pre-commit-mirrors-black
rev: 23.7.0
hooks:
- id: black-conda
args:
- --safe
- --target-version=py38
- repo: https://github.com/Quantco/pre-commit-mirrors-flake8
rev: 6.1.0
hooks:
- id: flake8-conda
- repo: https://github.com/Quantco/pre-commit-mirrors-isort
rev: 5.12.0
hooks:
- id: isort-conda
additional_dependencies: [-c, conda-forge, toml=0.10.2]
- repo: https://github.com/Quantco/pre-commit-mirrors-mypy
rev: "1.5.1"
hooks:
- id: mypy-conda
additional_dependencies:
- -c
- conda-forge
- types-mock
- types-setuptools
- types-redis
- types-boto
- boto3-stubs
- repo: https://github.com/Quantco/pre-commit-mirrors-pyupgrade
rev: 3.10.1
hooks:
- id: pyupgrade-conda
args:
- --py38-plus
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# VS Code on Binder

[![PyPI](https://img.shields.io/pypi/v/jupyter-vscode-proxy)](https://pypi.org/project/jupyter-vscode-proxy/)
[![Install with conda](https://anaconda.org/conda-forge/jupyter-vscode-proxy/badges/installer/conda.svg)](https://github.com/conda-forge/jupyter-vscode-proxy-feedstock)
[![Install with conda](https://anaconda.org/conda-forge/jupyter-vscode-proxy/badges/version.svg)](https://github.com/conda-forge/jupyter-vscode-proxy-feedstock)

VS Code on Binder, because sometimes you need a real editor.

Expand Down
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: vscode-binder
channels:
- conda-forge
dependencies:
- numpy
- python-build
- jupyter-server-proxy
- code-server >=3.2
67 changes: 48 additions & 19 deletions jupyter_vscode_proxy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,75 @@
import os
import shutil
from typing import Any, Callable, Dict, List


def setup_vscode():
def _get_vscode_cmd(port):
executable = "code-server"
def _get_inner_vscode_cmd() -> List[str]:
return [
"code-server",
"--auth",
"none",
"--disable-telemetry",
]


def _get_inner_openvscode_cmd() -> List[str]:
return [
"openvscode-server",
"--without-connection-token",
"--telemetry-level",
"off",
]


_CODE_EXECUTABLE_INNER_CMD_MAP: Dict[str, Callable] = {
"code-server": _get_inner_vscode_cmd,
"openvscode-server": _get_inner_openvscode_cmd,
}


def _get_cmd_factory(executable: str) -> Callable:
if executable not in _CODE_EXECUTABLE_INNER_CMD_MAP:
raise KeyError(
f"'{executable}' is not one of {_CODE_EXECUTABLE_INNER_CMD_MAP.keys()}."
)

get_inner_cmd = _CODE_EXECUTABLE_INNER_CMD_MAP[executable]

def _get_cmd(port: int) -> List[str]:
if not shutil.which(executable):
raise FileNotFoundError("Can not find code-server in PATH")
raise FileNotFoundError(f"Can not find {executable} in PATH")

# Start vscode in CODE_WORKINGDIR env variable if set
# If not, start in 'current directory', which is $REPO_DIR in mybinder
# but /home/jovyan (or equivalent) in JupyterHubs
working_dir = os.getenv("CODE_WORKINGDIR", ".")

extensions_dir = os.getenv("CODE_EXTENSIONSDIR", None)
extra_extensions_dir = os.getenv("CODE_EXTRA_EXTENSIONSDIR", None)

cmd = [
executable,
"--auth",
"none",
"--disable-telemetry",
"--port=" + str(port),
]
cmd = get_inner_cmd()

cmd.append("--port=" + str(port))

if extensions_dir:
cmd += ["--extensions-dir", extensions_dir]

if extra_extensions_dir:
cmd += ["--extra-extensions-dir", extra_extensions_dir]

cmd.append(working_dir)
return cmd

return _get_cmd


def setup_vscode() -> Dict[str, Any]:
executable = os.environ.get("CODE_EXECUTABLE", "code-server")
icon = "code-server.svg" if executable == "code-server" else "vscode.svg"
return {
"command": _get_vscode_cmd,
"timeout": 20,
"command": _get_cmd_factory(executable),
"timeout": 300,
"new_browser_tab": True,
"launcher_entry": {
"title": "VS Code",
"icon_path": os.path.join(
os.path.dirname(os.path.abspath(__file__)), "icons", "vscode.svg"
os.path.dirname(os.path.abspath(__file__)), "icons", icon
),
},
}
9 changes: 9 additions & 0 deletions jupyter_vscode_proxy/icons/code-server.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions postBuild
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/bin/bash

# Enable the proxy extension in notebook and lab
jupyter serverextension enable --py jupyter_server_proxy
jupyter labextension install @jupyterlab/server-proxy
jupyter lab build

code-server --install-extension ms-python.python

# Install the VS code proxy
Expand Down
53 changes: 53 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[build-system]
requires = ["setuptools", "setuptools-scm", "wheel"]

[tool.setuptools_scm]
version_scheme = "post-release"

[project]
name = "jupyter_vscode_proxy"
description = "VS Code extension for Jupyter"
readme = "README.md"
dynamic = ["version"]
authors = [
{name = "Tim Head", email = "[email protected]"},
]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
requires-python = ">=3.8"
license = {text = "BSD-3-clause"}

[project.urls]
repository = "https://github.com/betatim/vscode-binder"

[project.entry-points.jupyter_serverproxy_servers]
vscode = "jupyter_vscode_proxy:setup_vscode"

[tool.black]
exclude = '''
/(
\.eggs
| \.git
| \.venv
| build
| dist
)/
'''

[tool.isort]
profile = "black"
line_length = 88
known_first_party = "{{ project_slug }}"
skip_glob = '\.eggs/*,\.git/*,\.venv/*,build/*,dist/*'
default_section = 'THIRDPARTY'

[tool.mypy]
python_version = '3.8'
ignore_missing_imports = true
no_implicit_optional = true
check_untyped_defs = true
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

31 changes: 0 additions & 31 deletions setup.py

This file was deleted.