Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,19 @@ cache.json
Untitled*.ipynb
tmp/
lab/
*.csv
*.csv

tmp*

# lite
.cache
*.doit.db*
lite/_/
lite/pypi
lite/jupyterlite-icortex/py_src/jupyterlite_icortex/labextension/
lite/jupyterlite-icortex/pypi/
lite/jupyterlite-icortex/src/_pypi.ts
lite/jupyterlite-icortex/style/icortex.png
lite/jupyterlite-icortex/LICENSE
node_modules/
*.tsbuildinfo
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
[![License](https://img.shields.io/github/license/textcortex/icortex.svg?color=blue)](https://github.com/textcortex/icortex/blob/main/LICENSE)
[![](https://dcbadge.vercel.app/api/server/QtfGgKneHX?style=flat)](https://discord.textcortex.com/)

ICortex is a [Jupyter kernel](https://jupyter-client.readthedocs.io/en/latest/kernels.html) that lets you program with plain English, by letting you generate Python code from natural language prompts:
ICortex is a [Jupyter kernel](https://jupyter-client.readthedocs.io/en/latest/kernels.html) that lets you program using plain English, by generating Python code from natural language prompts:

https://user-images.githubusercontent.com/2453968/196814906-1a0de2a1-27a7-4aec-a960-0eb21fbe2879.mp4

It is ...

- a drop-in replacement for the IPython kernel. Prompts start with a forward slash `/`—otherwise the line is treated as regular Python code.
- a [Natural Language Programming](https://en.wikipedia.org/wiki/Natural-language_programming) interface—prompts written in plain English automatically generate Python code which can then be executed in the global namespace.
- an interface for [Natural Language Programming](https://en.wikipedia.org/wiki/Natural-language_programming) interface—prompts written in plain English automatically generate Python code which can then be executed globally.
- interactive—install missing packages directly, decide whether to execute the generated code or not, and so on, directly in the Jupyter Notebook cell.
- open source and fully extensible—if you think we are missing a model or an API, you can request it by creating an issue, or implement it yourself by subclassing `ServiceBase` under [`icortex/services`](icortex/services).

Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
27 changes: 27 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "ICortex"
copyright = "2022, TextCortex Team"
author = "TextCortex Team"
release = "0.0.3"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ["sphinxcontrib.video"]

templates_path = ["_templates"]
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "furo"
html_static_path = ["_static"]
51 changes: 51 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.. ICortex documentation master file, created by
sphinx-quickstart on Thu Oct 20 13:49:41 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

ICortex
=======


ICortex is a `Jupyter kernel <https://jupyter-client.readthedocs.io/en/latest/kernels.html>`__
that lets you program using plain English, by generating Python
code from natural language prompts:

.. video:: https://user-images.githubusercontent.com/2453968/196814906-1a0de2a1-27a7-4aec-a960-0eb21fbe2879.mp4
:width: 640

It is …

- a drop-in replacement for the IPython kernel. Prompts start with a
forward slash ``/``—otherwise the line is treated as regular Python
code.
- an interface for `Natural Language
Programming <https://en.wikipedia.org/wiki/Natural-language_programming>`__—prompts
written in plain English automatically generate
Python code which can then be executed globally.
- interactive—install missing packages directly, decide whether to
execute the generated code or not, and so on, directly in the Jupyter
Notebook cell.
- open source and fully extensible—if you think we are missing a model
or an API, you can request it by creating an issue, or implement it
yourself by subclassing ``ServiceBase`` under
`icortex/services <https://github.com/textcortex/icortex/tree/main/icortex/services>`__.

Get started
-----------

Visit :doc:`Quickstart<quickstart>` to see all the ways you can start using ICortex.

If you are experiencing any problems or bugs, `join our Discord <https://discord.textcortex.com/>`__ to get help.

Index
-----

.. toctree::
:maxdepth: 2

quickstart

.. * :ref:`genindex`
.. * :ref:`modindex`
.. * :ref:`search`
6 changes: 6 additions & 0 deletions docs/source/quickstart.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

Quickstart
==========


Some stuff
1 change: 1 addition & 0 deletions icortex/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def main(argv=None, prog=None, kernel=None):
parser.print_help()
elif args.command == "shell" or args.command is None:
from icortex.kernel import get_icortex_kernel

kernel = get_icortex_kernel()
if kernel is None:
ZMQTerminalICortexApp.launch_instance()
Expand Down
8 changes: 5 additions & 3 deletions icortex/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def set_service_var(self, var_name: str, var_value) -> bool:
service_name = self.get_service_name()

if service_name is None:
print("No service selected. Initialize a service by running `service init`.")
print(
"No service selected. Initialize a service by running `service init`."
)
return False

try:
Expand Down Expand Up @@ -138,8 +140,8 @@ def format_current_service(self):
output_dict = {}
if "service" in self.dict:
service_name = self.dict["service"]
output_dict["service"]= service_name
output_dict["service"] = service_name
if service_name in self.dict:
output_dict[service_name] = self.dict[service_name]

return toml.dumps(output_dict)
return toml.dumps(output_dict)
8 changes: 3 additions & 5 deletions icortex/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from IPython.utils.tempdir import TemporaryDirectory

kernel_json = {
"argv": [sys.executable, "-m", "icortex", "-f", "{connection_file}"],
"argv": [sys.executable, "-m", "icortex.kernel", "-f", "{connection_file}"],
"display_name": "ICortex",
"language": "text",
"language": "python",
}


Expand All @@ -23,9 +23,7 @@ def install_my_kernel_spec(user=True, prefix=None, uninstall=False):
# TODO: Copy any resources

print("Installing Jupyter kernel spec")
ksm.install_kernel_spec(
td, "icortex", user=user, prefix=prefix
)
ksm.install_kernel_spec(td, "icortex", user=user, prefix=prefix)
else:
try:
ksm.remove_kernel_spec("icortex")
Expand Down
4 changes: 0 additions & 4 deletions icortex/kernel.json

This file was deleted.

File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions icortex/kernel/icortex/kernel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"argv": ["python", "-m", "icortex.kernel", "-f", "{connection_file}"],
"display_name": "ICortex",
"language": "python"
}
Binary file added icortex/kernel/icortex/logo-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icortex/kernel/icortex/logo-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icortex/kernel/icortex/logo-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icortex/kernel/icortex/logo-64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icortex/services/textcortex.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ def generate(

return response_dict["generated_text"]
elif response_dict["status"] == "fail":
import ipdb

ipdb.set_trace()
raise Exception(
f"There was an issue with generation: {response_dict['message']}"
)
Loading