Skip to content

Commit

Permalink
Merge branch 'containers:main' into auth_header_encoding_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
apozsuse authored Apr 4, 2024
2 parents 219b2c6 + ca024cc commit 6db1724
Show file tree
Hide file tree
Showing 60 changed files with 690 additions and 223 deletions.
4 changes: 2 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ env:
####
#### Cache-image names to test with (double-quotes around names are critical)
####
FEDORA_NAME: "fedora-38"
FEDORA_NAME: "fedora-39"

# Google-cloud VM Images
IMAGE_SUFFIX: "c20230614t132754z-f38f37d13"
IMAGE_SUFFIX: "c20240320t153921z-f39f38d13"
FEDORA_CACHE_IMAGE_NAME: "fedora-podman-py-${IMAGE_SUFFIX}"


Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ on:

jobs:
commit:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
# Only check commits on pull requests.
if: github.event_name == 'pull_request'
steps:
- name: get pr commits
id: 'get-pr-commits'
uses: tim-actions/[email protected].0
uses: tim-actions/[email protected].1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: check subject line length
uses: tim-actions/[email protected].1
uses: tim-actions/[email protected].2
with:
commits: ${{ steps.get-pr-commits.outputs.commits }}
pattern: '^.{0,72}(\n.*)*$'
Expand Down
24 changes: 12 additions & 12 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
# See the documentation for more information:
# https://packit.dev/docs/configuration/

# Build targets can be found at:
# https://copr.fedorainfracloud.org/coprs/rhcontainerbot/packit-builds/

downstream_package_name: python-podman
specfile_path: rpm/python-podman.spec
upstream_tag_template: v{version}

srpm_build_deps:
- make

jobs:
- &copr
job: copr_build
- job: copr_build
trigger: pull_request
owner: rhcontainerbot
project: packit-builds
enable_net: true
srpm_build_deps:
- make
targets:
- fedora-all
- centos-stream-8
- centos-stream-9

- <<: *copr
# Run on commit to main branch
# Run on commit to main branch
- job: copr_build
trigger: commit
branch: main
owner: rhcontainerbot
project: podman-next

- job: propose_downstream
Expand Down
20 changes: 17 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

formats:
- pdf
- epub

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
jobs:
pre_build:
- sphinx-apidoc --separate --no-toc --force --templatedir docs/source/_templates/apidoc -o docs/source/ podman podman/tests

# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
version: "3.6"
install:
- requirements: requirements.txt
- requirements: requirements.txt

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py
fail_on_warning: false

14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DESTDIR ?=
EPOCH_TEST_COMMIT ?= $(shell git merge-base $${DEST_BRANCH:-main} HEAD)
HEAD ?= HEAD

export PODMAN_VERSION ?= "4.5.0"
export PODMAN_VERSION ?= "5.0.0"

.PHONY: podman
podman:
Expand Down Expand Up @@ -60,13 +60,9 @@ release:

.PHONY: docs
docs:
mkdir -p _build/doctrees
cp -R docs/source/* _build/doctrees
sphinx-apidoc --separate --no-toc --force --templatedir build/docs/source/_templates/apidoc \
-o _build/doctrees \
podman podman/tests
# Previous Command: sphinx-build _build/doctrees _build/html
#
sphinx-apidoc --separate --no-toc --force --templatedir docs/source/_templates/apidoc \
-o docs/source/ podman podman/tests

# HARD CODED COMMAND from readthedocs! We must conform!
# -T : traceback
# -E : do not use saved environment, always read all files
Expand All @@ -76,7 +72,7 @@ docs:
# -D language=en : define language as en
# . : source directory
# _build/html : target
cd _build/doctrees && python3 -m sphinx -T -E -W --keep-going -b html -d _build/doctrees -D language=en . _build/html
cd docs/source && python3 -m sphinx -T -E -W --keep-going -b html -d _build/doctrees -D language=en . _build/html

.PHONY: rpm
rpm: ## Build rpm packages
Expand Down
11 changes: 8 additions & 3 deletions docs/source/_templates/apidoc/module.rst_t
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{%- if show_headings %}
{{- basename | replace("podman.", "") | e | heading }}

{%- if "podman.errors" in basename %}
{{- basename | replace("podman.errors.", "") | e | heading }}
{% elif "podman.client" in basename -%}
{{- basename | replace("podman.client", "client") | e | heading }}
{% else -%}
{{- basename | replace("podman.domain.", "") | e | heading }}
{% endif -%}
{% endif -%}

.. automodule:: {{ qualname }}
{%- for option in automodule_options %}
:{{ option }}:
{%- endfor %}

6 changes: 5 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# sphinx.ext.napoleon: Support for NumPy and Google style docstrings
# sphinx.ext.viewcode: Add links to highlighted source code
# isort: unique-list
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx.ext.viewcode']
extensions = ['sphinx.ext.napoleon', 'sphinx.ext.autodoc', 'sphinx.ext.viewcode']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -51,6 +51,10 @@
exclude_patterns = [
'podman.api.*rst',
'podman.rst',
'podman.version.rst',
'podman.tlsconfig.rst',
'podman.errors.rst',
'podman.domain.rst',
]


Expand Down
22 changes: 12 additions & 10 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Example
.. toctree::
:caption: Podman Client
:maxdepth: 2
:hidden:

podman.client

Expand All @@ -53,17 +53,19 @@ Example
:glob:
:hidden:

podman.domain.containers
podman.domain.containers_manager
podman.domain.images
podman.domain.images_manager
podman.domain.events*
podman.domain.manifests*
podman.domain.config
podman.domain.containers*
podman.domain.images*
podman.domain.ipam
podman.domain.events
podman.domain.manager
podman.domain.manifests
podman.domain.networks*
podman.domain.pods*
podman.domain.secrets*
podman.domain.system*
podman.domain.volume*
podman.domain.registry_data
podman.domain.secrets
podman.domain.system
podman.domain.volumes
podman.errors.exceptions

Indices and tables
Expand Down
1 change: 1 addition & 0 deletions podman/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Podman client module."""

import sys

assert sys.version_info >= (3, 6), "Python 3.6 or greater is required."
Expand Down
1 change: 1 addition & 0 deletions podman/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tools for connecting to a Podman service."""

import re

from podman.api.cached_property import cached_property
Expand Down
1 change: 1 addition & 0 deletions podman/api/adapter_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for working with Adapters."""

from typing import NamedTuple, Mapping


Expand Down
1 change: 1 addition & 0 deletions podman/api/cached_property.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide cached_property for Python <=3.8 programs."""

import functools

try:
Expand Down
31 changes: 25 additions & 6 deletions podman/api/client.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"""APIClient for connecting to Podman service."""

import json
import warnings
import urllib.parse
from typing import Any, ClassVar, IO, Iterable, List, Mapping, Optional, Tuple, Type, Union

import requests
from requests.adapters import HTTPAdapter

from podman import api
from podman import api # pylint: disable=cyclic-import
from podman.api.ssh import SSHAdapter
from podman.api.uds import UDSAdapter
from podman.errors import APIError, NotFound
Expand All @@ -27,6 +29,16 @@
"""Type alias for request timeout parameter."""


class ParameterDeprecationWarning(DeprecationWarning):
"""
Custom DeprecationWarning for deprecated parameters.
"""


# Make the ParameterDeprecationWarning visible for user.
warnings.simplefilter('always', ParameterDeprecationWarning)


class APIResponse:
"""APIResponse proxy requests.Response objects.
Expand Down Expand Up @@ -88,7 +100,7 @@ def __init__(
num_pools: Optional[int] = None,
credstore_env: Optional[Mapping[str, str]] = None,
use_ssh_client=True,
max_pools_size=None,
max_pool_size=None,
**kwargs,
): # pylint: disable=unused-argument
"""Instantiate APIClient object.
Expand Down Expand Up @@ -116,10 +128,17 @@ def __init__(
self.base_url = self._normalize_url(base_url)

adapter_kwargs = kwargs.copy()

# The HTTPAdapter doesn't handle the "**kwargs", so it needs special structure
# where the parameters are set specifically.
http_adapter_kwargs = {}

if num_pools is not None:
adapter_kwargs["pool_connections"] = num_pools
if max_pools_size is not None:
adapter_kwargs["pool_maxsize"] = max_pools_size
http_adapter_kwargs["pool_connections"] = num_pools
if max_pool_size is not None:
adapter_kwargs["pool_maxsize"] = max_pool_size
http_adapter_kwargs["pool_maxsize"] = max_pool_size
if timeout is not None:
adapter_kwargs["timeout"] = timeout

Expand All @@ -132,8 +151,8 @@ def __init__(
self.mount("https://", SSHAdapter(self.base_url.geturl(), **adapter_kwargs))

elif self.base_url.scheme == "http":
self.mount("http://", HTTPAdapter(**adapter_kwargs))
self.mount("https://", HTTPAdapter(**adapter_kwargs))
self.mount("http://", HTTPAdapter(**http_adapter_kwargs))
self.mount("https://", HTTPAdapter(**http_adapter_kwargs))
else:
assert False, "APIClient.supported_schemes changed without adding a branch here."

Expand Down
1 change: 1 addition & 0 deletions podman/api/http_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for working with URLs."""

import base64
import collections.abc
import json
Expand Down
1 change: 1 addition & 0 deletions podman/api/parse_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helper functions for parsing strings."""

import base64
import ipaddress
import json
Expand Down
3 changes: 2 additions & 1 deletion podman/api/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
See Podman go bindings for more details.
"""

import collections
import functools
import logging
Expand Down Expand Up @@ -202,7 +203,7 @@ def connect(self) -> None:
class SSHConnectionPool(urllib3.HTTPConnectionPool):
"""Specialized HTTPConnectionPool for holding SSH connections."""

ConnectionCls = SSHConnection
ConnectionCls = SSHConnection # pylint: disable=invalid-name


class SSHPoolManager(urllib3.PoolManager):
Expand Down
1 change: 1 addition & 0 deletions podman/api/tar_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for working with tarballs."""

import pathlib
import random
import shutil
Expand Down
6 changes: 4 additions & 2 deletions podman/api/typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,8 @@ class AsyncContextManager(

__all__.append('AsyncContextManager')
elif sys.version_info[:2] >= (3, 5):
exec("""
exec(
"""
class AsyncContextManager(typing.Generic[T_co]):
__slots__ = ()
Expand All @@ -970,7 +971,8 @@ def __subclasshook__(cls, C):
return NotImplemented
__all__.append('AsyncContextManager')
""")
"""
)

if hasattr(typing, 'DefaultDict'):
DefaultDict = typing.DefaultDict
Expand Down
3 changes: 2 additions & 1 deletion podman/api/uds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Specialized Transport Adapter for UNIX domain sockets."""

import collections
import functools
import logging
Expand Down Expand Up @@ -89,7 +90,7 @@ def connect(self) -> None:
class UDSConnectionPool(urllib3.HTTPConnectionPool):
"""Specialization of HTTPConnectionPool for holding UNIX domain sockets."""

ConnectionCls = UDSConnection
ConnectionCls = UDSConnection # pylint: disable=invalid-name


class UDSPoolManager(urllib3.PoolManager):
Expand Down
Loading

0 comments on commit 6db1724

Please sign in to comment.