Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Commit 35f87fc

Browse files
authored
Add docs (#15)
* Created sphinx documentation * Added dev dependencies * Moved kernel.py into its own directory with __main__.py * Minor
1 parent f56d4f0 commit 35f87fc

21 files changed

+619
-17
lines changed

.gitignore

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,19 @@ cache.json
137137
Untitled*.ipynb
138138
tmp/
139139
lab/
140-
*.csv
140+
*.csv
141+
142+
tmp*
143+
144+
# lite
145+
.cache
146+
*.doit.db*
147+
lite/_/
148+
lite/pypi
149+
lite/jupyterlite-icortex/py_src/jupyterlite_icortex/labextension/
150+
lite/jupyterlite-icortex/pypi/
151+
lite/jupyterlite-icortex/src/_pypi.ts
152+
lite/jupyterlite-icortex/style/icortex.png
153+
lite/jupyterlite-icortex/LICENSE
154+
node_modules/
155+
*.tsbuildinfo

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
[![License](https://img.shields.io/github/license/textcortex/icortex.svg?color=blue)](https://github.com/textcortex/icortex/blob/main/LICENSE)
55
[![](https://dcbadge.vercel.app/api/server/QtfGgKneHX?style=flat)](https://discord.textcortex.com/)
66

7-
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:
7+
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:
88

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

1111
It is ...
1212

1313
- a drop-in replacement for the IPython kernel. Prompts start with a forward slash `/`—otherwise the line is treated as regular Python code.
14-
- 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.
14+
- 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.
1515
- interactive—install missing packages directly, decide whether to execute the generated code or not, and so on, directly in the Jupyter Notebook cell.
1616
- 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).
1717

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/conf.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
project = "ICortex"
10+
copyright = "2022, TextCortex Team"
11+
author = "TextCortex Team"
12+
release = "0.0.3"
13+
14+
# -- General configuration ---------------------------------------------------
15+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
16+
17+
extensions = ["sphinxcontrib.video"]
18+
19+
templates_path = ["_templates"]
20+
exclude_patterns = []
21+
22+
23+
# -- Options for HTML output -------------------------------------------------
24+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
25+
26+
html_theme = "furo"
27+
html_static_path = ["_static"]

docs/source/index.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
.. ICortex documentation master file, created by
2+
sphinx-quickstart on Thu Oct 20 13:49:41 2022.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
ICortex
7+
=======
8+
9+
10+
ICortex is a `Jupyter kernel <https://jupyter-client.readthedocs.io/en/latest/kernels.html>`__
11+
that lets you program using plain English, by generating Python
12+
code from natural language prompts:
13+
14+
.. video:: https://user-images.githubusercontent.com/2453968/196814906-1a0de2a1-27a7-4aec-a960-0eb21fbe2879.mp4
15+
:width: 640
16+
17+
It is …
18+
19+
- a drop-in replacement for the IPython kernel. Prompts start with a
20+
forward slash ``/``—otherwise the line is treated as regular Python
21+
code.
22+
- an interface for `Natural Language
23+
Programming <https://en.wikipedia.org/wiki/Natural-language_programming>`__—prompts
24+
written in plain English automatically generate
25+
Python code which can then be executed globally.
26+
- interactive—install missing packages directly, decide whether to
27+
execute the generated code or not, and so on, directly in the Jupyter
28+
Notebook cell.
29+
- open source and fully extensible—if you think we are missing a model
30+
or an API, you can request it by creating an issue, or implement it
31+
yourself by subclassing ``ServiceBase`` under
32+
`icortex/services <https://github.com/textcortex/icortex/tree/main/icortex/services>`__.
33+
34+
Get started
35+
-----------
36+
37+
Visit :doc:`Quickstart<quickstart>` to see all the ways you can start using ICortex.
38+
39+
If you are experiencing any problems or bugs, `join our Discord <https://discord.textcortex.com/>`__ to get help.
40+
41+
Index
42+
-----
43+
44+
.. toctree::
45+
:maxdepth: 2
46+
47+
quickstart
48+
49+
.. * :ref:`genindex`
50+
.. * :ref:`modindex`
51+
.. * :ref:`search`

docs/source/quickstart.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
Quickstart
3+
==========
4+
5+
6+
Some stuff

icortex/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ def main(argv=None, prog=None, kernel=None):
195195
parser.print_help()
196196
elif args.command == "shell" or args.command is None:
197197
from icortex.kernel import get_icortex_kernel
198+
198199
kernel = get_icortex_kernel()
199200
if kernel is None:
200201
ZMQTerminalICortexApp.launch_instance()

icortex/config.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ def set_service_var(self, var_name: str, var_value) -> bool:
2525
service_name = self.get_service_name()
2626

2727
if service_name is None:
28-
print("No service selected. Initialize a service by running `service init`.")
28+
print(
29+
"No service selected. Initialize a service by running `service init`."
30+
)
2931
return False
3032

3133
try:
@@ -138,8 +140,8 @@ def format_current_service(self):
138140
output_dict = {}
139141
if "service" in self.dict:
140142
service_name = self.dict["service"]
141-
output_dict["service"]= service_name
143+
output_dict["service"] = service_name
142144
if service_name in self.dict:
143145
output_dict[service_name] = self.dict[service_name]
144146

145-
return toml.dumps(output_dict)
147+
return toml.dumps(output_dict)

icortex/install.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
from IPython.utils.tempdir import TemporaryDirectory
88

99
kernel_json = {
10-
"argv": [sys.executable, "-m", "icortex", "-f", "{connection_file}"],
10+
"argv": [sys.executable, "-m", "icortex.kernel", "-f", "{connection_file}"],
1111
"display_name": "ICortex",
12-
"language": "text",
12+
"language": "python",
1313
}
1414

1515

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

2525
print("Installing Jupyter kernel spec")
26-
ksm.install_kernel_spec(
27-
td, "icortex", user=user, prefix=prefix
28-
)
26+
ksm.install_kernel_spec(td, "icortex", user=user, prefix=prefix)
2927
else:
3028
try:
3129
ksm.remove_kernel_spec("icortex")

0 commit comments

Comments
 (0)