Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
Jupyter Docker Stacks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Jupyter Docker Stacks
Commits
94cd03d6
Commit
94cd03d6
authored
Jun 25, 2020
by
Ayaz Salikhov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix python codestyle
parent
229c7fea
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
37 additions
and
43 deletions
+37
-43
base-notebook/jupyter_notebook_config.py
base-notebook/jupyter_notebook_config.py
+2
-2
base-notebook/test/test_container_options.py
base-notebook/test/test_container_options.py
+17
-13
base-notebook/test/test_pandoc.py
base-notebook/test/test_pandoc.py
+0
-3
conftest.py
conftest.py
+2
-1
datascience-notebook/test/test_julia.py
datascience-notebook/test/test_julia.py
+2
-4
docs/conf.py
docs/conf.py
+1
-6
pyspark-notebook/test/test_spark.py
pyspark-notebook/test/test_spark.py
+2
-2
scipy-notebook/test/data/matplotlib_1.py
scipy-notebook/test/data/matplotlib_1.py
+1
-2
scipy-notebook/test/test_matplotlib.py
scipy-notebook/test/test_matplotlib.py
+1
-2
test/helpers.py
test/helpers.py
+8
-7
test/test_packages.py
test/test_packages.py
+1
-1
No files found.
base-notebook/jupyter_notebook_config.py
View file @
94cd03d6
...
@@ -7,7 +7,7 @@ import os
...
@@ -7,7 +7,7 @@ import os
import
errno
import
errno
import
stat
import
stat
c
=
get_config
()
c
=
get_config
()
# noqa: F821
c
.
NotebookApp
.
ip
=
'0.0.0.0'
c
.
NotebookApp
.
ip
=
'0.0.0.0'
c
.
NotebookApp
.
port
=
8888
c
.
NotebookApp
.
port
=
8888
c
.
NotebookApp
.
open_browser
=
False
c
.
NotebookApp
.
open_browser
=
False
...
...
base-notebook/test/test_container_options.py
View file @
94cd03d6
...
@@ -70,8 +70,10 @@ def test_nb_user_change(container):
...
@@ -70,8 +70,10 @@ def test_nb_user_change(container):
running_container
=
container
.
run
(
running_container
=
container
.
run
(
tty
=
True
,
tty
=
True
,
user
=
"root"
,
user
=
"root"
,
environment
=
[
f
"NB_USER={nb_user}"
,
environment
=
[
"CHOWN_HOME=yes"
],
f
"NB_USER={nb_user}"
,
"CHOWN_HOME=yes"
],
working_dir
=
f
"/home/{nb_user}"
,
working_dir
=
f
"/home/{nb_user}"
,
command
=
[
'start.sh'
,
'bash'
,
'-c'
,
'sleep infinity'
]
command
=
[
'start.sh'
,
'bash'
,
'-c'
,
'sleep infinity'
]
)
)
...
@@ -100,10 +102,11 @@ def test_chown_extra(container):
...
@@ -100,10 +102,11 @@ def test_chown_extra(container):
c
=
container
.
run
(
c
=
container
.
run
(
tty
=
True
,
tty
=
True
,
user
=
'root'
,
user
=
'root'
,
environment
=
[
'NB_UID=1010'
,
environment
=
[
'NB_UID=1010'
,
'NB_GID=101'
,
'NB_GID=101'
,
'CHOWN_EXTRA=/opt/conda'
,
'CHOWN_EXTRA=/opt/conda'
,
'CHOWN_EXTRA_OPTS=-R'
,
'CHOWN_EXTRA_OPTS=-R'
],
],
command
=
[
'start.sh'
,
'bash'
,
'-c'
,
'stat -c
\'
%
n:
%
u:
%
g
\'
/opt/conda/LICENSE.txt'
]
command
=
[
'start.sh'
,
'bash'
,
'-c'
,
'stat -c
\'
%
n:
%
u:
%
g
\'
/opt/conda/LICENSE.txt'
]
)
)
...
@@ -118,8 +121,9 @@ def test_chown_home(container):
...
@@ -118,8 +121,9 @@ def test_chown_home(container):
c
=
container
.
run
(
c
=
container
.
run
(
tty
=
True
,
tty
=
True
,
user
=
'root'
,
user
=
'root'
,
environment
=
[
'CHOWN_HOME=yes'
,
environment
=
[
'CHOWN_HOME_OPTS=-R'
,
'CHOWN_HOME=yes'
,
'CHOWN_HOME_OPTS=-R'
],
],
command
=
[
'start.sh'
,
'bash'
,
'-c'
,
'chown root:root /home/jovyan && ls -alsh /home'
]
command
=
[
'start.sh'
,
'bash'
,
'-c'
,
'chown root:root /home/jovyan && ls -alsh /home'
]
)
)
...
...
base-notebook/test/test_pandoc.py
View file @
94cd03d6
...
@@ -3,8 +3,6 @@
...
@@ -3,8 +3,6 @@
import
logging
import
logging
import
pytest
LOGGER
=
logging
.
getLogger
(
__name__
)
LOGGER
=
logging
.
getLogger
(
__name__
)
...
@@ -17,4 +15,3 @@ def test_pandoc(container):
...
@@ -17,4 +15,3 @@ def test_pandoc(container):
logs
=
c
.
logs
(
stdout
=
True
)
.
decode
(
"utf-8"
)
logs
=
c
.
logs
(
stdout
=
True
)
.
decode
(
"utf-8"
)
LOGGER
.
debug
(
logs
)
LOGGER
.
debug
(
logs
)
assert
"<p><strong>BOLD</strong></p>"
in
logs
assert
"<p><strong>BOLD</strong></p>"
in
logs
conftest.py
View file @
94cd03d6
...
@@ -13,6 +13,7 @@ from requests.adapters import HTTPAdapter
...
@@ -13,6 +13,7 @@ from requests.adapters import HTTPAdapter
LOGGER
=
logging
.
getLogger
(
__name__
)
LOGGER
=
logging
.
getLogger
(
__name__
)
@
pytest
.
fixture
(
scope
=
'session'
)
@
pytest
.
fixture
(
scope
=
'session'
)
def
http_client
():
def
http_client
():
"""Requests session with retries and backoff."""
"""Requests session with retries and backoff."""
...
...
datascience-notebook/test/test_julia.py
View file @
94cd03d6
...
@@ -2,18 +2,16 @@
...
@@ -2,18 +2,16 @@
# Distributed under the terms of the Modified BSD License.
# Distributed under the terms of the Modified BSD License.
import
logging
import
logging
import
pytest
LOGGER
=
logging
.
getLogger
(
__name__
)
LOGGER
=
logging
.
getLogger
(
__name__
)
def
test_julia
(
container
):
def
test_julia
(
container
):
"""Basic julia test"""
"""Basic julia test"""
LOGGER
.
info
(
f
"Test that julia is correctly installed ..."
)
LOGGER
.
info
(
"Test that julia is correctly installed ..."
)
running_container
=
container
.
run
(
running_container
=
container
.
run
(
tty
=
True
,
command
=
[
"start.sh"
,
"bash"
,
"-c"
,
"sleep infinity"
]
tty
=
True
,
command
=
[
"start.sh"
,
"bash"
,
"-c"
,
"sleep infinity"
]
)
)
command
=
f
"julia --version"
command
=
"julia --version"
cmd
=
running_container
.
exec_run
(
command
)
cmd
=
running_container
.
exec_run
(
command
)
output
=
cmd
.
output
.
decode
(
"utf-8"
)
output
=
cmd
.
output
.
decode
(
"utf-8"
)
assert
cmd
.
exit_code
==
0
,
f
"Command {command} failed {output}"
assert
cmd
.
exit_code
==
0
,
f
"Command {command} failed {output}"
...
...
docs/conf.py
100644 → 100755
View file @
94cd03d6
...
@@ -21,11 +21,6 @@
...
@@ -21,11 +21,6 @@
# import sys
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# sys.path.insert(0, os.path.abspath('.'))
# For conversion from markdown to html
import
recommonmark.parser
from
recommonmark.transform
import
AutoStructify
# -- General configuration ------------------------------------------------
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# If your documentation needs a minimal Sphinx version, state it here.
...
...
pyspark-notebook/test/test_spark.py
View file @
94cd03d6
# Copyright (c) Jupyter Development Team.
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
# Distributed under the terms of the Modified BSD License.
import
time
import
logging
import
logging
import
pytest
LOGGER
=
logging
.
getLogger
(
__name__
)
LOGGER
=
logging
.
getLogger
(
__name__
)
def
test_spark_shell
(
container
):
def
test_spark_shell
(
container
):
"""Checking if Spark (spark-shell) is running properly"""
"""Checking if Spark (spark-shell) is running properly"""
c
=
container
.
run
(
c
=
container
.
run
(
...
@@ -18,6 +17,7 @@ def test_spark_shell(container):
...
@@ -18,6 +17,7 @@ def test_spark_shell(container):
LOGGER
.
debug
(
logs
)
LOGGER
.
debug
(
logs
)
assert
'res0: Int = 2'
in
logs
assert
'res0: Int = 2'
in
logs
def
test_pyspark
(
container
):
def
test_pyspark
(
container
):
"""PySpark should be in the Python path"""
"""PySpark should be in the Python path"""
c
=
container
.
run
(
c
=
container
.
run
(
...
...
scipy-notebook/test/data/matplotlib_1.py
View file @
94cd03d6
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
# Optional test with [Matplotlib Jupyter Integration](https://github.com/matplotlib/ipympl)
# Optional test with [Matplotlib Jupyter Integration](https://github.com/matplotlib/ipympl)
# %matplotlib widget
# %matplotlib widget
import
matplotlib
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
import
numpy
as
np
import
numpy
as
np
import
os
import
os
...
...
scipy-notebook/test/test_matplotlib.py
View file @
94cd03d6
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
import
logging
import
logging
import
pytest
import
os
import
os
LOGGER
=
logging
.
getLogger
(
__name__
)
LOGGER
=
logging
.
getLogger
(
__name__
)
...
@@ -15,7 +14,7 @@ def test_matplotlib(container):
...
@@ -15,7 +14,7 @@ def test_matplotlib(container):
cont_data_dir
=
"/home/jovyan/data"
cont_data_dir
=
"/home/jovyan/data"
test_file
=
"matplotlib_1.py"
test_file
=
"matplotlib_1.py"
output_dir
=
"/tmp"
output_dir
=
"/tmp"
LOGGER
.
info
(
f
"Test that matplotlib is able to plot a graph and write it as an image ..."
)
LOGGER
.
info
(
"Test that matplotlib is able to plot a graph and write it as an image ..."
)
command
=
"sleep infinity"
command
=
"sleep infinity"
running_container
=
container
.
run
(
running_container
=
container
.
run
(
volumes
=
{
host_data_dir
:
{
"bind"
:
cont_data_dir
,
"mode"
:
"ro"
}},
volumes
=
{
host_data_dir
:
{
"bind"
:
cont_data_dir
,
"mode"
:
"ro"
}},
...
...
test/helpers.py
View file @
94cd03d6
...
@@ -64,7 +64,7 @@ class CondaPackageHelper:
...
@@ -64,7 +64,7 @@ class CondaPackageHelper:
def
installed_packages
(
self
):
def
installed_packages
(
self
):
"""Return the installed packages"""
"""Return the installed packages"""
if
self
.
installed
is
None
:
if
self
.
installed
is
None
:
LOGGER
.
info
(
f
"Grabing the list of installed packages ..."
)
LOGGER
.
info
(
"Grabing the list of installed packages ..."
)
self
.
installed
=
CondaPackageHelper
.
_packages_from_json
(
self
.
installed
=
CondaPackageHelper
.
_packages_from_json
(
self
.
_execute_command
(
CondaPackageHelper
.
_conda_export_command
())
self
.
_execute_command
(
CondaPackageHelper
.
_conda_export_command
())
)
)
...
@@ -73,7 +73,7 @@ class CondaPackageHelper:
...
@@ -73,7 +73,7 @@ class CondaPackageHelper:
def
specified_packages
(
self
):
def
specified_packages
(
self
):
"""Return the specifications (i.e. packages installation requested)"""
"""Return the specifications (i.e. packages installation requested)"""
if
self
.
specs
is
None
:
if
self
.
specs
is
None
:
LOGGER
.
info
(
f
"Grabing the list of specifications ..."
)
LOGGER
.
info
(
"Grabing the list of specifications ..."
)
self
.
specs
=
CondaPackageHelper
.
_packages_from_json
(
self
.
specs
=
CondaPackageHelper
.
_packages_from_json
(
self
.
_execute_command
(
CondaPackageHelper
.
_conda_export_command
(
True
))
self
.
_execute_command
(
CondaPackageHelper
.
_conda_export_command
(
True
))
)
)
...
@@ -87,7 +87,7 @@ class CondaPackageHelper:
...
@@ -87,7 +87,7 @@ class CondaPackageHelper:
@
staticmethod
@
staticmethod
def
_packages_from_json
(
env_export
):
def
_packages_from_json
(
env_export
):
"""Extract packages and versions from the lines returned by the list of specifications"""
"""Extract packages and versions from the lines returned by the list of specifications"""
#dependencies = filter(lambda x: isinstance(x, str), json.loads(env_export).get("dependencies"))
#
dependencies = filter(lambda x: isinstance(x, str), json.loads(env_export).get("dependencies"))
dependencies
=
json
.
loads
(
env_export
)
.
get
(
"dependencies"
)
dependencies
=
json
.
loads
(
env_export
)
.
get
(
"dependencies"
)
# Filtering packages installed through pip in this case it's a dict {'pip': ['toree==0.3.0']}
# Filtering packages installed through pip in this case it's a dict {'pip': ['toree==0.3.0']}
# Since we only manage packages installed through conda here
# Since we only manage packages installed through conda here
...
@@ -112,7 +112,7 @@ class CondaPackageHelper:
...
@@ -112,7 +112,7 @@ class CondaPackageHelper:
"""Return the available packages"""
"""Return the available packages"""
if
self
.
available
is
None
:
if
self
.
available
is
None
:
LOGGER
.
info
(
LOGGER
.
info
(
f
"Grabing the list of available packages (can take a while) ..."
"Grabing the list of available packages (can take a while) ..."
)
)
# Keeping command line output since `conda search --outdated --json` is way too long ...
# Keeping command line output since `conda search --outdated --json` is way too long ...
self
.
available
=
CondaPackageHelper
.
_extract_available
(
self
.
available
=
CondaPackageHelper
.
_extract_available
(
...
@@ -135,7 +135,7 @@ class CondaPackageHelper:
...
@@ -135,7 +135,7 @@ class CondaPackageHelper:
installed
=
self
.
installed_packages
()
installed
=
self
.
installed_packages
()
available
=
self
.
available_packages
()
available
=
self
.
available_packages
()
self
.
comparison
=
list
()
self
.
comparison
=
list
()
for
pkg
,
inst_vs
in
self
.
installed
.
items
():
for
pkg
,
inst_vs
in
installed
.
items
():
if
not
specifications_only
or
pkg
in
specs
:
if
not
specifications_only
or
pkg
in
specs
:
avail_vs
=
sorted
(
avail_vs
=
sorted
(
list
(
available
[
pkg
]),
key
=
CondaPackageHelper
.
semantic_cmp
list
(
available
[
pkg
]),
key
=
CondaPackageHelper
.
semantic_cmp
...
@@ -158,7 +158,8 @@ class CondaPackageHelper:
...
@@ -158,7 +158,8 @@ class CondaPackageHelper:
"""Manage semantic versioning for comparison"""
"""Manage semantic versioning for comparison"""
def
mysplit
(
string
):
def
mysplit
(
string
):
version_substrs
=
lambda
x
:
re
.
findall
(
r"([A-z]+|\d+)"
,
x
)
def
version_substrs
(
x
):
return
re
.
findall
(
r"([A-z]+|\d+)"
,
x
)
return
list
(
chain
(
map
(
version_substrs
,
string
.
split
(
"."
))))
return
list
(
chain
(
map
(
version_substrs
,
string
.
split
(
"."
))))
def
str_ord
(
string
):
def
str_ord
(
string
):
...
...
test/test_packages.py
View file @
94cd03d6
...
@@ -131,7 +131,7 @@ def _import_packages(package_helper, filtered_packages, check_function, max_fail
...
@@ -131,7 +131,7 @@ def _import_packages(package_helper, filtered_packages, check_function, max_fail
Note: using a list of packages instead of a fixture for the list of packages since pytest prevents use of multiple yields
Note: using a list of packages instead of a fixture for the list of packages since pytest prevents use of multiple yields
"""
"""
failures
=
{}
failures
=
{}
LOGGER
.
info
(
f
"Testing the import of packages ..."
)
LOGGER
.
info
(
"Testing the import of packages ..."
)
for
package
in
filtered_packages
:
for
package
in
filtered_packages
:
LOGGER
.
info
(
f
"Trying to import {package}"
)
LOGGER
.
info
(
f
"Trying to import {package}"
)
try
:
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment