mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-09 11:02:57 +00:00
Bunch of small refactorings and updates
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v3.1.0
|
rev: v3.4.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
files: .*\.(yaml|yml)$
|
files: .*\.(yaml|yml)$
|
||||||
- repo: https://github.com/adrienverge/yamllint.git
|
- repo: https://github.com/adrienverge/yamllint.git
|
||||||
rev: v1.23.0
|
rev: v1.26.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: yamllint
|
- id: yamllint
|
||||||
args: ['-d {extends: relaxed, rules: {line-length: disable}}', '-s']
|
args: ['-d {extends: relaxed, rules: {line-length: disable}}', '-s']
|
||||||
@@ -17,10 +17,10 @@ repos:
|
|||||||
- id: bashate
|
- id: bashate
|
||||||
args: ['--ignore=E006']
|
args: ['--ignore=E006']
|
||||||
- repo: https://gitlab.com/pycqa/flake8
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
rev: 3.8.3
|
rev: 3.9.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
- repo: https://github.com/pre-commit/mirrors-autopep8
|
- repo: https://github.com/pre-commit/mirrors-autopep8
|
||||||
rev: v1.5.4
|
rev: v1.5.6
|
||||||
hooks:
|
hooks:
|
||||||
- id: autopep8
|
- id: autopep8
|
||||||
|
@@ -12,6 +12,6 @@ sphinx:
|
|||||||
formats: all
|
formats: all
|
||||||
|
|
||||||
python:
|
python:
|
||||||
version: 3.7
|
version: 3.8
|
||||||
install:
|
install:
|
||||||
- requirements: requirements-dev.txt
|
- requirements: requirements-dev.txt
|
||||||
|
2
Makefile
2
Makefile
@@ -152,6 +152,8 @@ pull/%: DARGS?=
|
|||||||
pull/%: ## pull a jupyter image
|
pull/%: ## pull a jupyter image
|
||||||
docker pull $(DARGS) $(OWNER)/$(notdir $@)
|
docker pull $(DARGS) $(OWNER)/$(notdir $@)
|
||||||
|
|
||||||
|
pull-all: $(foreach I,$(ALL_IMAGES),pull/$(I) ) ## pull all images
|
||||||
|
|
||||||
push/%: DARGS?=
|
push/%: DARGS?=
|
||||||
push/%: ## push all tags for a jupyter image
|
push/%: ## push all tags for a jupyter image
|
||||||
docker push --all-tags $(DARGS) $(OWNER)/$(notdir $@)
|
docker push --all-tags $(DARGS) $(OWNER)/$(notdir $@)
|
||||||
|
@@ -75,7 +75,7 @@ class CondaPackageHelper:
|
|||||||
if self.specs is None:
|
if self.specs is None:
|
||||||
LOGGER.info("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(from_history=True))
|
||||||
)
|
)
|
||||||
return self.specs
|
return self.specs
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ class CondaPackageHelper:
|
|||||||
return ddict
|
return ddict
|
||||||
|
|
||||||
def check_updatable_packages(self, specifications_only=True):
|
def check_updatable_packages(self, specifications_only=True):
|
||||||
"""Check the updatables packages including or not dependencies"""
|
"""Check the updatable packages including or not dependencies"""
|
||||||
specs = self.specified_packages()
|
specs = self.specified_packages()
|
||||||
installed = self.installed_packages()
|
installed = self.installed_packages()
|
||||||
available = self.available_packages()
|
available = self.available_packages()
|
||||||
@@ -145,9 +145,10 @@ class CondaPackageHelper:
|
|||||||
current = min(inst_vs, key=CondaPackageHelper.semantic_cmp)
|
current = min(inst_vs, key=CondaPackageHelper.semantic_cmp)
|
||||||
newest = avail_vs[-1]
|
newest = avail_vs[-1]
|
||||||
if avail_vs and current != newest:
|
if avail_vs and current != newest:
|
||||||
if CondaPackageHelper.semantic_cmp(
|
if (
|
||||||
current
|
CondaPackageHelper.semantic_cmp(current) <
|
||||||
) < CondaPackageHelper.semantic_cmp(newest):
|
CondaPackageHelper.semantic_cmp(newest)
|
||||||
|
):
|
||||||
self.comparison.append(
|
self.comparison.append(
|
||||||
{"Package": pkg, "Current": current, "Newest": newest}
|
{"Package": pkg, "Current": current, "Newest": newest}
|
||||||
)
|
)
|
||||||
@@ -180,10 +181,7 @@ class CondaPackageHelper:
|
|||||||
|
|
||||||
def get_outdated_summary(self, specifications_only=True):
|
def get_outdated_summary(self, specifications_only=True):
|
||||||
"""Return a summary of outdated packages"""
|
"""Return a summary of outdated packages"""
|
||||||
if specifications_only:
|
nb_packages = len(self.specs if specifications_only else self.installed)
|
||||||
nb_packages = len(self.specs)
|
|
||||||
else:
|
|
||||||
nb_packages = len(self.installed)
|
|
||||||
nb_updatable = len(self.comparison)
|
nb_updatable = len(self.comparison)
|
||||||
updatable_ratio = nb_updatable / nb_packages
|
updatable_ratio = nb_updatable / nb_packages
|
||||||
return f"{nb_updatable}/{nb_packages} ({updatable_ratio:.0%}) packages could be updated"
|
return f"{nb_updatable}/{nb_packages} ({updatable_ratio:.0%}) packages could be updated"
|
||||||
|
@@ -7,12 +7,12 @@ test_packages
|
|||||||
This test module tests if R and Python packages installed can be imported.
|
This test module tests if R and Python packages installed can be imported.
|
||||||
It's a basic test aiming to prove that the package is working properly.
|
It's a basic test aiming to prove that the package is working properly.
|
||||||
|
|
||||||
The goal is to detect import errors that can be caused by incompatibilities between packages for example:
|
The goal is to detect import errors that can be caused by incompatibilities between packages, for example:
|
||||||
|
|
||||||
- #1012: issue importing `sympy`
|
- #1012: issue importing `sympy`
|
||||||
- #966: isssue importing `pyarrow`
|
- #966: isssue importing `pyarrow`
|
||||||
|
|
||||||
This module checks dynmamically, through the `CondaPackageHelper`, only the specified packages i.e. packages requested by `conda install` in the `Dockerfiles`.
|
This module checks dynamically, through the `CondaPackageHelper`, only the specified packages i.e. packages requested by `conda install` in the `Dockerfile`s.
|
||||||
This means that it does not check dependencies. This choice is a tradeoff to cover the main requirements while achieving reasonable test duration.
|
This means that it does not check dependencies. This choice is a tradeoff to cover the main requirements while achieving reasonable test duration.
|
||||||
However it could be easily changed (or completed) to cover also dependencies `package_helper.installed_packages()` instead of `package_helper.specified_packages()`.
|
However it could be easily changed (or completed) to cover also dependencies `package_helper.installed_packages()` instead of `package_helper.specified_packages()`.
|
||||||
|
|
||||||
@@ -86,10 +86,7 @@ def packages(package_helper):
|
|||||||
|
|
||||||
def package_map(package):
|
def package_map(package):
|
||||||
"""Perform a mapping between the python package name and the name used for the import"""
|
"""Perform a mapping between the python package name and the name used for the import"""
|
||||||
_package = package
|
return PACKAGE_MAPPING.get(package, package)
|
||||||
if _package in PACKAGE_MAPPING:
|
|
||||||
_package = PACKAGE_MAPPING.get(_package)
|
|
||||||
return _package
|
|
||||||
|
|
||||||
|
|
||||||
def excluded_package_predicate(package):
|
def excluded_package_predicate(package):
|
||||||
@@ -136,9 +133,8 @@ def _import_packages(package_helper, filtered_packages, check_function, max_fail
|
|||||||
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:
|
||||||
assert (
|
assert check_function(package_helper, package) == 0, \
|
||||||
check_function(package_helper, package) == 0
|
f"Package [{package}] import failed"
|
||||||
), f"Package [{package}] import failed"
|
|
||||||
except AssertionError as err:
|
except AssertionError as err:
|
||||||
failures[package] = err
|
failures[package] = err
|
||||||
if len(failures) > max_failures:
|
if len(failures) > max_failures:
|
||||||
|
Reference in New Issue
Block a user