forked from jupyterlab/jupyter-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
import AI module cookiecutter (jupyterlab#13)
* import Jupyter AI module cookiecutter * rename all remaining occurrences of GAI => AI * declare email in all packages and cookiecutter * fix VSCode ESLint extension * export InsertionContext type, add devDep on @jupyter-ai/core * update cookiecutter readme to delete extra files manually * configure skipLibCheck: true * update cookiecutter readme
- Loading branch information
Showing
52 changed files
with
1,555 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
*.bundle.* | ||
lib/ | ||
node_modules/ | ||
*.egg-info/ | ||
.ipynb_checkpoints | ||
*.tsbuildinfo | ||
.eslintcache | ||
.stylelintcache | ||
{{cookiecutter.python_name}}/static | ||
|
||
# Created by https://www.gitignore.io/api/python | ||
# Edit at https://www.gitignore.io/?templates=python | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
coverage/lcov-report/ | ||
coverage/lcov.info | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# End of https://www.gitignore.io/api/python | ||
|
||
# OSX files | ||
.DS_Store | ||
|
||
# Default extension dir | ||
myextension | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2017-2021, Project Jupyter Contributors | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Jupyter AI Module Cookiecutter | ||
|
||
A [cookiecutter](https://github.com/audreyr/cookiecutter) template for creating | ||
a AI module. The AI module constructed from the template serves as a very simple | ||
example that can be extended however you wish. | ||
|
||
## Usage | ||
|
||
Install cookiecutter. | ||
|
||
``` | ||
pip install cookiecutter | ||
``` | ||
|
||
Then from the project root, run these commands: | ||
|
||
``` | ||
cd packages/ | ||
cookiecutter jupyter-ai-module-cookiecutter | ||
``` | ||
|
||
Follow the prompts to create a new AI module under `packages/`. Your | ||
labextension name should use hyphens, whereas your Python name should use | ||
underscores. | ||
|
||
# Usage (monorepo integration) | ||
|
||
To integrate the new AI module into this monorepo, execute this command | ||
manually from the AI module root: | ||
|
||
``` | ||
rm -r .github/ binder/ CHANGELOG.md RELEASE.md | ||
``` | ||
|
||
Rename the JS package to be scoped under `@jupyter-ai/`. | ||
|
||
Finally, add the Python package to the `options.python_packages` field in | ||
`.jupyter-releaser.toml`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"author_name": "Project Jupyter", | ||
"author_email": "jupyter@googlegroups.com", | ||
"version": "0.1.0", | ||
"labextension_name": "myextension", | ||
"python_name": "{{ cookiecutter.labextension_name | replace('-', '_') }}", | ||
"project_short_description": "A JupyterLab extension.", | ||
"has_settings": "n", | ||
"has_binder": "n", | ||
"test": "y", | ||
"repository": "https://github.com/jupyterlab/jupyter-ai" | ||
} |
39 changes: 39 additions & 0 deletions
39
packages/jupyter-ai-module-cookiecutter/hooks/post_gen_project.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env python | ||
from pathlib import Path | ||
|
||
PROJECT_DIRECTORY = Path.cwd() | ||
|
||
|
||
def remove_path(path: Path) -> None: | ||
"""Remove the provided path. | ||
If the target path is a directory, remove it recursively. | ||
""" | ||
if not path.exists(): | ||
return | ||
|
||
if path.is_file(): | ||
path.unlink() | ||
elif path.is_dir(): | ||
for f in path.iterdir(): | ||
remove_path(f) | ||
path.rmdir() | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
if not "{{ cookiecutter.has_settings }}".lower().startswith("y"): | ||
remove_path(PROJECT_DIRECTORY / "schema") | ||
|
||
if not "{{ cookiecutter.has_binder }}".lower().startswith("y"): | ||
remove_path(PROJECT_DIRECTORY / "binder") | ||
remove_path(PROJECT_DIRECTORY / ".github/workflows/binder-on-pr.yml") | ||
|
||
if not "{{ cookiecutter.test }}".lower().startswith("y"): | ||
remove_path(PROJECT_DIRECTORY / ".github" / "workflows" / "update-integration-tests.yml") | ||
remove_path(PROJECT_DIRECTORY / "src" / "__tests__") | ||
remove_path(PROJECT_DIRECTORY / "ui-tests") | ||
remove_path(PROJECT_DIRECTORY / "{{ cookiecutter.python_name }}" / "tests") | ||
remove_path(PROJECT_DIRECTORY / "babel.config.js") | ||
remove_path(PROJECT_DIRECTORY / "conftest.py") | ||
remove_path(PROJECT_DIRECTORY / "jest.config.js") |
8 changes: 8 additions & 0 deletions
8
packages/jupyter-ai-module-cookiecutter/{{cookiecutter.labextension_name}}/.eslintignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node_modules | ||
dist | ||
coverage | ||
**/*.d.ts | ||
tests | ||
|
||
**/__tests__ | ||
ui-tests |
Oops, something went wrong.