Merge pull request #1333 from jupyterhub/pre-commit-ci-update-config

[pre-commit.ci] pre-commit autoupdate
pull/1338/head
Erik Sundell 2024-02-06 08:22:46 +01:00 zatwierdzone przez GitHub
commit a20dd1cf97
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
22 zmienionych plików z 37 dodań i 18 usunięć

Wyświetl plik

@ -23,7 +23,7 @@ repos:
# Autoformat: Python code # Autoformat: Python code
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 23.12.1 rev: 24.1.1
hooks: hooks:
- id: black - id: black
args: args:

Wyświetl plik

@ -7,6 +7,7 @@ Usage:
python -m repo2docker https://github.com/you/your-repo python -m repo2docker https://github.com/you/your-repo
""" """
import getpass import getpass
import json import json
import logging import logging

Wyświetl plik

@ -3,6 +3,7 @@ Base information for using R in BuildPacks.
Keeping this in r.py would lead to cyclic imports. Keeping this in r.py would lead to cyclic imports.
""" """
from ..semver import parse_version as V from ..semver import parse_version as V

Wyświetl plik

@ -1,4 +1,5 @@
"""BuildPack for conda environments""" """BuildPack for conda environments"""
import os import os
import re import re
import warnings import warnings
@ -193,15 +194,15 @@ class CondaBuildPack(BaseImage):
raise ValueError( raise ValueError(
f"Python version {py_version} on {conda_platform} is not supported!" f"Python version {py_version} on {conda_platform} is not supported!"
) )
files[ files[f"conda/{lockfile_name}"] = self._kernel_environment_file = (
f"conda/{lockfile_name}" "/tmp/env/kernel-environment.lock"
] = self._kernel_environment_file = "/tmp/env/kernel-environment.lock" )
requirements_file_name = f"requirements.py-{py_version}.pip" requirements_file_name = f"requirements.py-{py_version}.pip"
if os.path.exists(os.path.join(HERE, requirements_file_name)): if os.path.exists(os.path.join(HERE, requirements_file_name)):
files[ files[f"conda/{requirements_file_name}"] = (
f"conda/{requirements_file_name}" self._kernel_requirements_file
] = self._kernel_requirements_file = "/tmp/env/kernel-requirements.txt" ) = "/tmp/env/kernel-requirements.txt"
else: else:
# server and kernel are the same # server and kernel are the same
server_py_version = py_version server_py_version = py_version
@ -216,15 +217,15 @@ class CondaBuildPack(BaseImage):
f"Python version {server_py_version} on {conda_platform} is not supported!" f"Python version {server_py_version} on {conda_platform} is not supported!"
) )
files[ files["conda/" + conda_frozen_name] = self._nb_environment_file = (
"conda/" + conda_frozen_name "/tmp/env/environment.lock"
] = self._nb_environment_file = "/tmp/env/environment.lock" )
# add requirements.txt, if present # add requirements.txt, if present
if os.path.exists(os.path.join(HERE, pip_frozen_name)): if os.path.exists(os.path.join(HERE, pip_frozen_name)):
files[ files["conda/" + pip_frozen_name] = self._nb_requirements_file = (
"conda/" + pip_frozen_name "/tmp/env/requirements.txt"
] = self._nb_requirements_file = "/tmp/env/requirements.txt" )
files.update(super().get_build_script_files()) files.update(super().get_build_script_files())
return files return files

Wyświetl plik

@ -1,5 +1,6 @@
"""Generates a variety of Dockerfiles based on an input matrix """Generates a variety of Dockerfiles based on an input matrix
""" """
import os import os
import docker import docker

Wyświetl plik

@ -1,4 +1,5 @@
"""Generates a Dockerfile based on an input matrix for Julia""" """Generates a Dockerfile based on an input matrix for Julia"""
import functools import functools
import os import os
from functools import lru_cache from functools import lru_cache

Wyświetl plik

@ -175,7 +175,7 @@ class JuliaRequireBuildPack(PythonBuildPack):
r""" r"""
julia /tmp/install-repo-dependencies.jl "%(require)s" julia /tmp/install-repo-dependencies.jl "%(require)s"
""" """
% {"require": require} % {"require": require},
# TODO: For some reason, `rm`ing the file fails with permission denied. # TODO: For some reason, `rm`ing the file fails with permission denied.
# && rm /tmp/install-repo-dependencies.jl # && rm /tmp/install-repo-dependencies.jl
) )

Wyświetl plik

@ -7,6 +7,7 @@ and IPython kernel.
Note: This buildpack has been deprecated. Note: This buildpack has been deprecated.
""" """
import logging import logging

Wyświetl plik

@ -1,4 +1,5 @@
"""BuildPack for nixpkgs environments""" """BuildPack for nixpkgs environments"""
import os import os
from functools import lru_cache from functools import lru_cache

Wyświetl plik

@ -173,9 +173,11 @@ class PipfileBuildPack(CondaBuildPack):
pipenv --clear \\ pipenv --clear \\
)""".format( )""".format(
working_directory=working_directory, working_directory=working_directory,
install_option="--ignore-pipfile" install_option=(
if os.path.exists(pipfile_lock) "--ignore-pipfile"
else "--skip-lock", if os.path.exists(pipfile_lock)
else "--skip-lock"
),
), ),
) )
) )

Wyświetl plik

@ -1,4 +1,5 @@
"""Generates Dockerfiles based on an input matrix based on Python.""" """Generates Dockerfiles based on an input matrix based on Python."""
import os import os
from functools import lru_cache from functools import lru_cache

Wyświetl plik

@ -4,6 +4,7 @@ Base classes for repo2docker ContentProviders
ContentProviders accept a `spec` of various kinds, and ContentProviders accept a `spec` of various kinds, and
provide the contents from the spec to a given output directory. provide the contents from the spec to a given output directory.
""" """
import logging import logging
import os import os

Wyświetl plik

@ -10,7 +10,6 @@ matcher functors take a version string and return True if it passes its
constraints. constraints.
""" """
import re import re
from functools import lru_cache from functools import lru_cache

Wyświetl plik

@ -1,6 +1,7 @@
""" """
Test argument parsing and r2d construction Test argument parsing and r2d construction
""" """
import os import os
import pytest import pytest

Wyświetl plik

@ -6,6 +6,7 @@ container requires a specific repository and commit to be checked out,
and that is the only thing that is tested. and that is the only thing that is tested.
""" """
import os import os
import subprocess import subprocess
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory

Wyświetl plik

@ -1,6 +1,7 @@
""" """
Test if the explict hostname is supplied correctly to the container Test if the explict hostname is supplied correctly to the container
""" """
import time import time
import requests import requests

Wyświetl plik

@ -1,6 +1,7 @@
""" """
Test that environment variables may be defined Test that environment variables may be defined
""" """
import os import os
import subprocess import subprocess
import sys import sys

Wyświetl plik

@ -1,4 +1,5 @@
"""Test if assemble scripts from outside of r2d repo are accepted.""" """Test if assemble scripts from outside of r2d repo are accepted."""
import time import time
from repo2docker.app import Repo2Docker from repo2docker.app import Repo2Docker

Wyświetl plik

@ -1,6 +1,7 @@
""" """
Test if labels are supplied correctly to the container Test if labels are supplied correctly to the container
""" """
from unittest.mock import Mock from unittest.mock import Mock
import pytest import pytest

Wyświetl plik

@ -1,6 +1,7 @@
""" """
Test if the subdirectory is correctly navigated to Test if the subdirectory is correctly navigated to
""" """
import os import os
import escapism import escapism

Wyświetl plik

@ -1,6 +1,7 @@
""" """
Test that User name and ID mapping works Test that User name and ID mapping works
""" """
import os import os
import subprocess import subprocess
import tempfile import tempfile

Wyświetl plik

@ -1,6 +1,7 @@
""" """
Tests for repo2docker/utils.py Tests for repo2docker/utils.py
""" """
import os import os
import platform import platform
import subprocess import subprocess