Skip to content

Commit a7c6095

Browse files
committed
Fixes #236
Signed-off-by: Chris Snow <[email protected]>
1 parent 25cda3d commit a7c6095

File tree

5 files changed

+169
-42
lines changed

5 files changed

+169
-42
lines changed

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"python.linting.enabled": true,
2828
"python.formatting.provider": "black",
2929
"python.formatting.blackPath": "/bin/black",
30-
"python.pythonPath": "/usr/bin/python3.5",
30+
"python.pythonPath": "/usr/bin/python",
3131
"python.envFile": "${workspaceFolder}/gitpod.env",
3232
"editor.formatOnSave": true,
3333
"files.insertFinalNewline": true,

Dockerfile

+63-34
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,72 @@
1-
FROM theiaide/theia-full:next
1+
ARG NODE_VERSION=10
2+
FROM node:${NODE_VERSION}
23

34
COPY requirements.txt /tmp
45

5-
RUN sudo apt-get update \
6-
# && sudo apt-get install -y software-properties-common \
7-
# && sudo add-apt-repository -y ppa:deadsnakes/ppa \
8-
&& sudo apt-get remove --purge -y python \
9-
&& sudo apt-get install -y python-pip python3-pip python3-sphinx vim
10-
# && sudo apt-get install -y python3.5 python3.6 python3.7 python3.8 python3.9 python3.9-distutils
11-
12-
RUN sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
13-
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
14-
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git \
15-
&& git clone https://github.com/pyenv/pyenv.git /home/theia/.pyenv \
16-
&& git clone https://github.com/momo-lab/xxenv-latest.git /home/theia/.pyenv/plugins/xxenv-latest \
17-
&& echo 'export PYENV_ROOT="/home/theia/.pyenv"' >> /home/theia/.bashrc \
18-
&& echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> /home/theia/.bashrc \
19-
&& echo 'if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)"; fi' >> /home/theia/.bashrc
20-
21-
RUN /home/theia/.pyenv/bin/pyenv latest install 2.7 \
22-
&& /home/theia/.pyenv/bin/pyenv latest install 3.5 \
23-
&& /home/theia/.pyenv/bin/pyenv latest install 3.6 \
24-
&& /home/theia/.pyenv/bin/pyenv latest install 3.7 \
25-
&& /home/theia/.pyenv/bin/pyenv latest install 3.8 \
26-
&& /home/theia/.pyenv/bin/pyenv install 3.9-dev \
27-
&& /home/theia/.pyenv/bin/pyenv local $(/home/theia/.pyenv/bin/pyenv versions --bare) \
28-
&& /home/theia/.pyenv/bin/pyenv versions
6+
USER root
7+
8+
# Python2 and Python3 are installed by parent Dockerfile:
9+
# https://github.com/theia-ide/theia-apps/blob/master/theia-full-docker/Dockerfile
10+
11+
# Save the preinstalled python paths - do this before setting up pyenv because pyenv may report
12+
# different binaries with which.
13+
14+
RUN which python > ~/python2_path
15+
RUN which python3 > ~/python3_path
16+
17+
RUN apt-get update \
18+
&& apt-get install -y vim yarn \
19+
&& apt-get install -y make build-essential libssl-dev zlib1g-dev \
20+
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
21+
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git \
22+
&& apt-get clean \
23+
&& apt-get auto-remove -y \
24+
&& rm -rf /var/cache/apt/* \
25+
&& rm -rf /var/lib/apt/lists/*
26+
27+
RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv \
28+
&& git clone https://github.com/momo-lab/xxenv-latest.git ~/.pyenv/plugins/latest \
29+
&& echo 'export PYENV_ROOT="~/.pyenv"' >> ~/.bashrc \
30+
&& echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc \
31+
&& echo 'if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)"; fi' >> ~/.bashrc
32+
33+
RUN /root/.pyenv/bin/pyenv latest install 2.7 \
34+
&& /root/.pyenv/bin/pyenv latest install 3.5 \
35+
&& /root/.pyenv/bin/pyenv latest install 3.6 \
36+
&& /root/.pyenv/bin/pyenv latest install 3.7 \
37+
&& /root/.pyenv/bin/pyenv latest install 3.8 \
38+
&& /root/.pyenv/bin/pyenv install 3.9-dev \
39+
&& /root/.pyenv/bin/pyenv local $(/root/.pyenv/bin/pyenv versions --bare) \
40+
&& /root/.pyenv/bin/pyenv versions
41+
42+
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
43+
&& python get-pip.py
2944

3045
RUN echo "Installing python modules" \
31-
&& PYENV_PATHS=$(ls -1 /home/theia/.pyenv/versions/*/bin/python?.?) \
32-
&& PYENV_3PATHS=$(ls -1 /home/theia/.pyenv/versions/*/bin/python3.?) \
33-
&& for v in ${PYENV_PATHS}; do ${v} -m pip install --upgrade pip; done \
34-
&& for v in ${PYENV_PATHS}; do ${v} -m pip install -U tox tox-pyenv ipython pylint pytest mock nose flake8-docstrings; done \
35-
&& /home/theia/.pyenv/versions/*/bin/python3.8 -m pip install -U black isort \
36-
&& sudo ln -f -s /home/theia/.pyenv/versions/*/bin/black /bin/ \
37-
&& sudo ln -f -s /home/theia/.pyenv/versions/*/bin/isort /bin/ \
38-
&& for v in ${PYENV_PATHS}; do ${v} -m pip install -r /tmp/requirements.txt; done
46+
&& PY_PATHS=$(ls -1 ~/.pyenv/versions/*/bin/python?.? && cat ~/python3_path && cat ~/python2_path) \
47+
&& PY_PATHS=$(cat ~/python3_path && cat ~/python2_path) \
48+
&& for v in ${PY_PATHS}; do ${v} -m pip install --upgrade pip setuptools wheel; done \
49+
&& for v in ${PY_PATHS}; do ${v} -m pip install --upgrade tox tox-pyenv ipython pylint pytest mock nose flake8 flake8-docstrings autopep8; done \
50+
&& ~/.pyenv/versions/*/bin/python3.8 -m pip install -U black isort python-language-server sphinx\
51+
&& ln -f -s ~/.pyenv/versions/*/bin/black /bin/ \
52+
&& ln -f -s ~/.pyenv/versions/*/bin/isort /bin/ \
53+
&& for v in ${PY_PATHS}; do ${v} -m pip install -r /tmp/requirements.txt; done
3954

40-
RUN echo 'PATH=$PATH:/home/theia/.local/bin/' >> /home/theia/.bashrc
55+
#RUN echo 'PATH=$PATH:/home/theia/.local/bin/' >> /home/theia/.bashrc
4156

4257
ENV PYTHONPATH=/home/project:$PYTHONPATH
4358

59+
RUN mkdir -p /home/theia \
60+
&& mkdir -p /home/project
61+
WORKDIR /home/theia
62+
63+
ARG version=latest
64+
ADD $version.package.json ./package.json
65+
ARG GITHUB_TOKEN
66+
RUN yarn --cache-folder ./ycache && rm -rf ./ycache && \
67+
NODE_OPTIONS="--max_old_space_size=4096" yarn theia build ; \
68+
yarn theia download:plugins
69+
EXPOSE 3000
70+
ENV SHELL=/bin/bash \
71+
THEIA_DEFAULT_PLUGINS=local-dir:/home/theia/plugins
72+
ENTRYPOINT [ "yarn", "theia", "start", "/home/project", "--hostname=0.0.0.0" ]

latest.package.json

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"private": true,
3+
"theia": {
4+
"frontend": {
5+
"config": {
6+
"applicationName": "Theia Python Example",
7+
"preferences": {
8+
"files.enableTrash": false
9+
}
10+
}
11+
}
12+
},
13+
"dependencies": {
14+
"@theia/editor-preview": "latest",
15+
"@theia/file-search": "latest",
16+
"@theia/getting-started": "latest",
17+
"@theia/git": "latest",
18+
"@theia/markers": "latest",
19+
"@theia/messages": "latest",
20+
"@theia/monaco": "latest",
21+
"@theia/navigator": "latest",
22+
"@theia/outline-view": "latest",
23+
"@theia/plugin-ext-vscode": "latest",
24+
"@theia/preferences": "latest",
25+
"@theia/preview": "latest",
26+
"@theia/search-in-workspace": "latest",
27+
"@theia/terminal": "latest",
28+
"@theia/vsx-registry": "latest"
29+
},
30+
"devDependencies": {
31+
"@theia/cli": "latest"
32+
},
33+
"theiaPluginsDir": "plugins",
34+
"theiaPlugins": {
35+
"vscode-builtin-bat": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/bat-1.39.1-prel.vsix",
36+
"vscode-builtin-clojure": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/clojure-1.39.1-prel.vsix",
37+
"vscode-builtin-coffeescript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/coffeescript-1.39.1-prel.vsix",
38+
"vscode-builtin-configuration-editing": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/configuration-editing-1.39.1-prel.vsix",
39+
"vscode-builtin-cpp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/cpp-1.39.1-prel.vsix",
40+
"vscode-builtin-csharp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/csharp-1.39.1-prel.vsix",
41+
"vscode-builtin-css": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/css-1.39.1-prel.vsix",
42+
"vscode-builtin-debug-auto-launch": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/debug-auto-launch-1.39.1-prel.vsix",
43+
"vscode-builtin-docker": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/docker-1.39.1-prel.vsix",
44+
"vscode-builtin-emmet": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/emmet-1.39.1-prel.vsix",
45+
"vscode-builtin-fsharp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/fsharp-1.39.1-prel.vsix",
46+
"vscode-builtin-go": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/go-1.39.1-prel.vsix",
47+
"vscode-builtin-groovy": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/groovy-1.39.1-prel.vsix",
48+
"vscode-builtin-grunt": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/grunt-1.39.1-prel.vsix",
49+
"vscode-builtin-gulp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/gulp-1.39.1-prel.vsix",
50+
"vscode-builtin-handlebars": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/handlebars-1.39.1-prel.vsix",
51+
"vscode-builtin-hlsl": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/hlsl-1.39.1-prel.vsix",
52+
"vscode-builtin-html": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/html-1.39.1-prel.vsix",
53+
"vscode-builtin-ini": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/ini-1.39.1-prel.vsix",
54+
"vscode-builtin-jake": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/jake-1.39.1-prel.vsix",
55+
"vscode-builtin-java": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/java-1.39.1-prel.vsix",
56+
"vscode-builtin-javascript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/javascript-1.39.1-prel.vsix",
57+
"vscode-builtin-json": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/json-1.39.1-prel.vsix",
58+
"vscode-builtin-json-language-features": "https://open-vsx.org/api/vscode/json-language-features/1.46.1/file/vscode.json-language-features-1.46.1.vsix",
59+
"vscode-builtin-less": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/less-1.39.1-prel.vsix",
60+
"vscode-builtin-log": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/log-1.39.1-prel.vsix",
61+
"vscode-builtin-lua": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/lua-1.39.1-prel.vsix",
62+
"vscode-builtin-make": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/make-1.39.1-prel.vsix",
63+
"vscode-builtin-markdown": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/markdown-1.39.1-prel.vsix",
64+
"vscode-builtin-merge-conflicts": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/merge-conflict-1.39.1-prel.vsix",
65+
"vscode-builtin-npm": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/npm-1.39.1-prel.vsix",
66+
"vscode-builtin-node-debug": "https://github.com/theia-ide/vscode-node-debug/releases/download/v1.35.3/node-debug-1.35.3.vsix",
67+
"vscode-builtin-node-debug2": "https://github.com/theia-ide/vscode-node-debug2/releases/download/v1.33.0/node-debug2-1.33.0.vsix",
68+
"vscode-builtin-objective-c": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/objective-c-1.39.1-prel.vsix",
69+
"vscode-builtin-perl": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/perl-1.39.1-prel.vsix",
70+
"vscode-builtin-powershell": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/powershell-1.39.1-prel.vsix",
71+
"vscode-builtin-pug": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/pug-1.39.1-prel.vsix",
72+
"vscode-builtin-python": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/python-1.39.1-prel.vsix",
73+
"vscode-builtin-r": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/r-1.39.1-prel.vsix",
74+
"vscode-builtin-razor": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/razor-1.39.1-prel.vsix",
75+
"vscode-builtin-ruby": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/ruby-1.39.1-prel.vsix",
76+
"vscode-builtin-rust": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/rust-1.39.1-prel.vsix",
77+
"vscode-builtin-scss": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/scss-1.39.1-prel.vsix",
78+
"vscode-builtin-shaderlab": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/shaderlab-1.39.1-prel.vsix",
79+
"vscode-builtin-shellscript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/shellscript-1.39.1-prel.vsix",
80+
"vscode-builtin-sql": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/sql-1.39.1-prel.vsix",
81+
"vscode-builtin-swift": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/swift-1.39.1-prel.vsix",
82+
"vscode-builtin-theme-abyss": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-abyss-1.39.1-prel.vsix",
83+
"vscode-builtin-theme-defaults": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-defaults-1.39.1-prel.vsix",
84+
"vscode-builtin-theme-kimbie-dark": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-kimbie-dark-1.39.1-prel.vsix",
85+
"vscode-builtin-theme-monokai": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-monokai-1.39.1-prel.vsix",
86+
"vscode-builtin-theme-dimmed": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-monokai-dimmed-1.39.1-prel.vsix",
87+
"vscode-builtin-theme-quietlight": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-quietlight-1.39.1-prel.vsix",
88+
"vscode-builtin-theme-red": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-red-1.39.1-prel.vsix",
89+
"vscode-builtin-theme-solarized-dark": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-solarized-dark-1.39.1-prel.vsix",
90+
"vscode-builtin-theme-tomorrow-night-blue": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-tomorrow-night-blue-1.39.1-prel.vsix",
91+
"vscode-builtin-typescript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/typescript-1.39.1-prel.vsix",
92+
"vscode-builtin-typescript-language-features": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/typescript-language-features-1.39.1-prel.vsix",
93+
"vscode-builtin-vb": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/vb-1.39.1-prel.vsix",
94+
"vscode-builtin-icon-theme-seti": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/vscode-theme-seti-1.39.1-prel.vsix",
95+
"vscode-builtin-xml": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/xml-1.39.1-prel.vsix",
96+
"vscode-builtin-yaml": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/yaml-1.39.1-prel.vsix",
97+
"vscode-editorconfig": "https://github.com/theia-ide/editorconfig-vscode/releases/download/v0.14.4/EditorConfig-0.14.4.vsix",
98+
"vscode-python": "https://github.com/microsoft/vscode-python/releases/download/2020.1.58038/ms-python-release.vsix"
99+
}
100+
}

pre_push_verifications.sh

+2-6
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@ if [[ -d /home/theia/ ]];
1414
then
1515
# ensure pyenvs are available to tox
1616
eval "$(pyenv init -)"
17-
pyenv shell $(/home/theia/.pyenv/bin/pyenv versions --bare)
18-
tox --recreate --tox-pyenv-no-fallback -- tests/
19-
else
20-
tox -- tests/
17+
pyenv shell $(/root/.pyenv/bin/pyenv versions --bare)
2118
fi
2219

23-
24-
echo "********** FIXME: 'tox -e py27' is broken **********"
20+
tox -- tests/
2521

2622
# coverage causes some tests to fail on PY3 so test it (issues 93)
2723
#coverage3 erase && coverage3 run --source hpecp,bin setup.py test && coverage3 report -m

tox.ini

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ python =
1818
[testenv]
1919
commands = nosetests {posargs}
2020
deps =
21-
future
2221
jinja2
2322
mock
2423
nose
2524
requests
2625
setenv = TOX_BUILD_DIR = {toxinidir}
2726

27+
[testenv:py27]
28+
recreate = true
29+
2830
[pytest]
2931
addopts = -s

0 commit comments

Comments
 (0)