Skip to content

Commit

Permalink
Merge branch 'containers:main' into fix/455
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Sunglasses authored Feb 16, 2025
2 parents a22d666 + 3ec3122 commit b13e136
Show file tree
Hide file tree
Showing 14 changed files with 310 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
#### Cache-image names to test with (double-quotes around names are critical)
####
# Google-cloud VM Images
IMAGE_SUFFIX: "c20250107t132430z-f41f40d13"
IMAGE_SUFFIX: "c20250131t121915z-f41f40d13"
FEDORA_CACHE_IMAGE_NAME: "fedora-podman-py-${IMAGE_SUFFIX}"


Expand Down
118 changes: 118 additions & 0 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/podman
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/podman

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
22 changes: 22 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,25 @@ jobs:
targets:
- fedora-latest-stable
skip_build: true

- job: tests
trigger: pull_request
tmt_plan: /upstream/all
packages: [python-podman-fedora]
targets:
- fedora-all

- job: tests
trigger: pull_request
tmt_plan: /upstream/base
packages: [python-podman-centos]
targets:
- centos-stream-9
- centos-stream-10

- job: tests
trigger: pull_request
tmt_plan: /upstream/base
packages: [python-podman-rhel]
targets:
- epel-9
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export PODMAN_VERSION ?= "5.3.0"
.PHONY: podman
podman:
rm dist/* || :
$(PYTHON) -m pip install --user -r requirements.txt
$(PYTHON) -m pip install -q build
PODMAN_VERSION=$(PODMAN_VERSION) \
$(PYTHON) setup.py sdist bdist bdist_wheel
$(PYTHON) -m build

.PHONY: lint
lint: tox
Expand All @@ -26,6 +26,14 @@ tests: tox
# see tox.ini for environment variable settings
$(PYTHON) -m tox -e coverage,py39,py310,py311,py312,py313

.PHONY: tests-ci-base-python
tests-ci-base-python:
$(PYTHON) -m tox -e coverage,py

.PHONY: tests-ci-all-python
tests-ci-all-python:
$(PYTHON) -m tox -e coverage,py39,py310,py311,py312,py313

.PHONY: unittest
unittest:
coverage run -m unittest discover -s podman/tests/unit
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ pip install podman

## Dependencies

* For runtime dependencies, see [requirements.txt](https://github.com/containers/podman-py/blob/main/requirements.txt).
* For testing and development dependencies, see [test-requirements.txt](https://github.com/containers/podman-py/blob/main/test-requirements.txt).
* For runtime dependencies, see \[dependencies\] in [pyproject.toml](https://github.com/containers/podman-py/blob/main/pyproject.toml)
* For testing and development dependencies, see \[project.optional.dependencies\] in [pyproject.toml](https://github.com/containers/podman-py/blob/main/pyproject.toml)
* The package is split in \[progress\_bar\], \[docs\], and \[test\]

## Example usage

Expand Down
31 changes: 20 additions & 11 deletions plans/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ prepare:
- make
- podman
- python3-pip
- python3.9
- python3.10
- python3.11
- python3.12
- python3.13

- name: pip dependencies
how: shell
script:
- pip3 install -r test-requirements.txt
- pip3 install .[test]

- name: ssh configuration
how: shell
Expand All @@ -36,20 +31,34 @@ prepare:
# we want to change this to tag:stable once all the coverage tests are fixed
filter: tag:lint

/tests:
summary: Run Python Podman Tests on upstream PRs
/base:
summary: Run Python Podman Tests on Upstream PRs for base Python
discover+:
filter: tag:upstream
filter: tag:base

/all:
summary: Run Python Podman Tests on Upstream PRs for all Python versions
prepare+:
- name: install all python versions
how: install
package:
- python3.9
- python3.10
- python3.11
- python3.12
- python3.13
discover+:
filter: tag:matrix

adjust+:
enabled: false
when: initiator is not defined or initiator != packit

/downstream:
/tests:
/all:
summary: Run Python Podman Tests on bodhi / errata and dist-git PRs
discover+:
filter: tag:downstream
filter: tag:matrix

adjust+:
enabled: false
Expand Down
2 changes: 1 addition & 1 deletion podman/domain/containers_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ def create(
read_only (bool): Mount the container's root filesystem as read only.
read_write_tmpfs (bool): Mount temporary file systems as read write,
in case of read_only options set to True. Default: False
restart_policy (dict[str, Union[str, int]]): Restart the container when it exits.
remove (bool): Remove the container when it has finished running. Default: False.
restart_policy (dict[str, Union[str, int]]): Restart the container when it exits.
Configured as a dictionary with keys:
- Name: One of on-failure, or always.
Expand Down
1 change: 1 addition & 0 deletions podman/domain/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def connect(self, container: Union[str, Container], *_, **kwargs) -> None:
f"/networks/{self.name}/connect",
data=json.dumps(data),
headers={"Content-type": "application/json"},
**kwargs,
)
response.raise_for_status()

Expand Down
Loading

0 comments on commit b13e136

Please sign in to comment.