Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Improve pythonPath config for Open-Needs #40

Merged
merged 12 commits into from
Feb 23, 2022
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"ms-python.vscode-pylance",
"ms-python.python"
]
}
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Launch Extension Dummy",
"type": "extensionHost",
"request": "launch",
"args": [
//"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}/vscode_ext",
"${workspaceFolder}/temp-envs/project_dummy_needls_test",
],
"outFiles": ["${workspaceFolder}/out/test_dummy/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Setup Envs",
"type": "python",
Expand Down
49 changes: 49 additions & 0 deletions docs/arch.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Installation routine
====================

Process to install needls:

.. uml::

@startuml
start

:Trigger\n 1. open-needs-ide.load\n 2. open .rst file;

:Check needls.pythonPath specified in workspace setting;

if (needls.pythonPath specified and valid?) then (no)

#palegreen:repeat :Prompt inputbox to ask user to specify;
if (user specify?) then (yes)
:user specify python path or use default;
:press ENTER;
#yellow:check and validate given python path;
else (no)
#darkorange:press ESC;
end

endif

repeat while (valid?) is (no)
->yes;

else (yes)

endif

:Use specified valid pythonPath to install needls;
if (needls installed?) then (no)
#yellowgreen:install needls;
if (user confirm?) then (yes)
:needls install success;
else (no)
end
endif

else (yes)

endif

stop
@enduml
10 changes: 9 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
Changelog
=========

0.0.15
0.0.16
------

**released**: under development

0.0.15
------

**released**: 23.02.2022

* Improvement: Supporting ``pythonPath`` config in settings of Open-Needs IDE. Default is system python path. :issue:`38`
* Bugfix: Mutliple little changes


0.0.14
------
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinxcontrib.plantuml",
"sphinxcontrib.needs",
"sphinx_panels",
"sphinx_issues",
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Content
.. toctree::
:maxdepth: 2

arch
installation
settings
features
Expand Down
1 change: 1 addition & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Installation of the extension

#. Update the **Build Path**. E.g. ``/home/my-user/my-project/docs/_build/need``.
#. Update the **Docs Root**. E.g. ``/home/my-user/my-project/docs``
#. Update the **pythonPath**. E.g. ``/home/my-user/my-project/.venv/bin/python``. Default is system python path. E.g. ``/usr/bin/python``.


#. Open a reStructuredText file (`*.rst`) in workspace to trigger the activation of the extension.
Expand Down
3 changes: 3 additions & 0 deletions docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This extension contributes the following settings:
expected. This file is created using using the
`sphinx-needs builder <https://sphinxcontrib-needs.readthedocs.io/en/latest/builders.html>`__

:needls.pythonPath: Python path used to install `Open-Needs-IDE:needls`. Default system python path `/usr/bin/python` will be used if this setting is not configured.

Supported variables
-------------------
**Open-Needs IDE** supports the usage of template variables, which get replaced during runtime.
Expand All @@ -26,6 +28,7 @@ Inside a ``.vscode/settings.json`` file a configuration can look like::
{
"needls.docsRoot": "${workspaceFolder}/docs"
"needls.buildPath": "${workspaceFolder}/docs/_build/need",
"needls.pythonPath": "${workspaceFolder}/.venv/bin/python",
}

Settings menu
Expand Down
2 changes: 1 addition & 1 deletion needls/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.14"
__version__ = "0.0.15"
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

setup(
name="open-needs-ls",
# Don't forget package.json, changelog and needls.version
version=main_ns["__version__"],
url="https://open-needs.org",
author="Daniel Woste",
Expand Down
3 changes: 2 additions & 1 deletion test-envs/_basics/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"needls.buildPath": "{{build_path}}",
"needls.docsRoot": "{{docs_root}}"
"needls.docsRoot": "{{docs_root}}",
"needls.pythonPath": "{{pythonPath}}",
}
8 changes: 6 additions & 2 deletions test-envs/setup_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def __init__(self, name: str, reuse: bool = False) -> None:

self.test_envs_path = os.path.join(os.path.dirname(__file__))
self.basics_path = os.path.join(self.test_envs_path, "_basics")

self.temp_env_path = os.path.join(self.test_envs_path, "../temp-envs")

self.env_path = os.path.join(self.temp_env_path, name)

def setup(self):
Expand Down Expand Up @@ -75,6 +75,7 @@ def parse_templates(self):
".vscode/settings.json": {
"build_path": "${workspaceFolder}/docs/_build",
"docs_root": "${workspaceFolder}/docs",
"pythonPath": "",
}
}

Expand All @@ -100,6 +101,9 @@ def start():
project1 = ProjectEnv("project_no_needls", reuse=True)
project1.setup()

project2 = ProjectEnv("project_dummy_needls_test", reuse=True)
project2.setup()


if "main" in __name__:
start()
6 changes: 5 additions & 1 deletion vscode_ext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "https://github.com/open-needs/open-needs-ide.git"
},
"homepage": "https://open-needs.org/open-needs-ide/",
"version": "0.0.14",
"version": "0.0.15",
"engines": {
"vscode": "^1.52.0"
},
Expand Down Expand Up @@ -68,6 +68,10 @@
"type": "string",
"default": "/build",
"description": "Sphinx build directory. This is an absolute path!"
},
"needls.pythonPath": {
"type": "string",
"description": "Python path configured by the user. This is an absolute path!"
}
}
}
Expand Down