From de61dbfc04574e62d5d4e455b5faa9c1f9d0e351 Mon Sep 17 00:00:00 2001 From: JWuzyk <49727999+JWuzyk@users.noreply.github.com> Date: Wed, 28 Feb 2024 20:52:35 +0100 Subject: [PATCH] feat!: replace Jupyter Lab with VS Code notebook support (#216) --- README.md | 1 - .../.devcontainer/devcontainer.json | 4 ++-- .../pyproject.toml | 19 +------------------ 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 781d9ec1..08e86767 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,6 @@ To update your Python project with the latest template: | `development_environment`
["simple", "strict"] | Whether to configure the development environment with a focus on simplicity or with a focus on strictness. In strict mode, additional [Ruff rules](https://beta.ruff.rs/docs/rules/) are added, and tools such as [Mypy](https://github.com/python/mypy) and [Pytest](https://github.com/pytest-dev/pytest) are set to strict mode. | | `with_conventional_commits`
["0", "1"] | If "1", [Commitizen](https://github.com/commitizen-tools/commitizen) will verify that your commits follow the [Conventional Commits](https://www.conventionalcommits.org/) standard. In return, `cz bump` may be used to automate [Semantic Versioning](https://semver.org/) and [Keep A Changelog](https://keepachangelog.com/). | | `with_fastapi_api`
["0", "1"] | If "1", [FastAPI](https://github.com/tiangolo/fastapi) is added as a run time dependency, FastAPI API stubs and tests are added, a `poe api` command for serving the API is added, and an `app` stage that packages the API is added to the Dockerfile. Additionally, the CI workflow will push the application as a Docker image instead of publishing the Python package. | -| `with_jupyter_lab`
["0", "1"] | If "1", [JupyterLab](https://github.com/jupyterlab/jupyterlab) is added to Poetry's dev dependencies, and a `poe lab` command is added to start Jupyter Lab in the `notebooks/` directory. | | `with_pydantic_typing`
["0", "1"] | If "1", [Pydantic](https://github.com/samuelcolvin/pydantic) is added as a run time dependency, and the [Pydantic mypy plugin](https://pydantic-docs.helpmanual.io/mypy_plugin/) is enabled and configured. | | `with_sentry_logging`
["0", "1"] | If "1", [Sentry](https://github.com/getsentry/sentry-python) is added as a run time dependency, and a Sentry configuration stub and tests are added. | | `with_streamlit_app`
["0", "1"] | If "1", [Streamlit](https://github.com/streamlit/streamlit) is added as a run time dependency, a Streamlit application stub is added, a `poe app` command to serve the Streamlit app is added, and an `app` stage that packages the Streamlit app is added to the Dockerfile. Additionally, the CI workflow will push the application as a Docker image instead of publishing the Python package. | diff --git a/{{ cookiecutter.__package_name_kebab_case }}/.devcontainer/devcontainer.json b/{{ cookiecutter.__package_name_kebab_case }}/.devcontainer/devcontainer.json index b36cc5aa..f9b5df19 100644 --- a/{{ cookiecutter.__package_name_kebab_case }}/.devcontainer/devcontainer.json +++ b/{{ cookiecutter.__package_name_kebab_case }}/.devcontainer/devcontainer.json @@ -12,9 +12,7 @@ "charliermarsh.ruff", "ms-python.mypy-type-checker", "ms-python.python", - {%- if cookiecutter.with_jupyter_lab|int %} "ms-toolsai.jupyter", - {%- endif %} "ryanluker.vscode-coverage-gutters", "tamasfe.even-better-toml", "visualstudioexptteam.vscodeintellicode" @@ -38,7 +36,9 @@ 100 ], "files.autoSave": "onFocusChange", + "jupyter.kernels.excludePythonEnvironments": ["/usr/local/bin/python"], "mypy-type-checker.importStrategy": "fromEnvironment", + "notebook.formatOnSave.enabled": true, "python.defaultInterpreterPath": "/opt/{{ cookiecutter.__package_name_kebab_case }}-env/bin/python", "python.terminal.activateEnvironment": false, "python.testing.pytestEnabled": true, diff --git a/{{ cookiecutter.__package_name_kebab_case }}/pyproject.toml b/{{ cookiecutter.__package_name_kebab_case }}/pyproject.toml index dcd6937f..bbab8a11 100644 --- a/{{ cookiecutter.__package_name_kebab_case }}/pyproject.toml +++ b/{{ cookiecutter.__package_name_kebab_case }}/pyproject.toml @@ -72,9 +72,7 @@ typeguard = ">=3.0.2" [tool.poetry.group.dev.dependencies] # https://python-poetry.org/docs/master/managing-dependencies/ cruft = ">=2.14.0" -{%- if cookiecutter.with_jupyter_lab|int %} -jupyterlab = ">=3.6.3" -{%- endif %} +ipykernel = ">=6.29.2" pdoc = ">=13.1.1" {%- if cookiecutter.private_package_repository_name %} @@ -260,21 +258,6 @@ convention = "{{ cookiecutter.docstring_style|lower }}" name = "outputdirectory" options = ["--output-directory"] default = "docs" -{%- if cookiecutter.with_jupyter_lab|int %} - - [tool.poe.tasks.lab] - help = "Run Jupyter Lab" - - [[tool.poe.tasks.lab.sequence]] - cmd = "mkdir -p notebooks" - - [[tool.poe.tasks.lab.sequence]] - cmd = """ - jupyter lab - --allow-root - --notebook-dir notebooks - """ -{%- endif %} [tool.poe.tasks.lint] help = "Lint this package"