From ff20e46ae46bf9f70e3296f4a088b2ef531bdc53 Mon Sep 17 00:00:00 2001 From: Thom Carlin Date: Mon, 22 Jul 2024 18:46:39 -0400 Subject: [PATCH 1/3] Add python 3.12 --- .github/workflows/pull_request.yml | 9 +++++---- .gitignore | 3 ++- Makefile | 2 +- README.md | 16 ++++++++-------- packaging/container/Dockerfile | 12 ++++++------ receptorctl/README.md | 18 ++++++++++-------- receptorctl/noxfile.py | 6 +++--- .../container-builder/Containerfile | 2 +- 8 files changed, 36 insertions(+), 32 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index e886eff19..d3ae8cbf7 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -7,7 +7,7 @@ on: # yamllint disable-line rule:truthy env: DESIRED_GO_VERSION: '1.20' DESIRED_GOLANGCI_LINT_VERSION: 'v1.56' - DESIRED_PYTHON_VERSION: '3.11' + DESIRED_PYTHON_VERSION: '3.12' jobs: lint-receptor: @@ -103,10 +103,11 @@ jobs: # NOTE: The highest and the lowest versions come # NOTE: first as their statuses are most likely to # NOTE: signal problems early: - - 3.11 + - 3.12 - 3.8 - >- - 3.10 + - 3.11 + - 3.10 - 3.9 uses: ./.github/workflows/reusable-nox.yml with: @@ -125,7 +126,7 @@ jobs: - check_format uses: ./.github/workflows/reusable-nox.yml with: - python-version: '3.11' + python-version: '3.12' session: ${{ matrix.session }} container: diff --git a/.gitignore b/.gitignore index 365417ca3..480255957 100644 --- a/.gitignore +++ b/.gitignore @@ -7,10 +7,10 @@ receptor.exe receptor.app recepcert /net -receptorctl-test-venv/ .container-flag* .VERSION kubectl +/receptorctl/.nox /receptorctl/.VERSION /receptorctl/AUTHORS /receptorctl/ChangeLog @@ -18,6 +18,7 @@ kubectl /receptor-python-worker/ChangeLog /receptor-python-worker/AUTHORS /receptorctl/venv/ +receptorctl-test-venv/ .vagrant/ /docs/build /dist diff --git a/Makefile b/Makefile index b678fc679..bee7b90d8 100644 --- a/Makefile +++ b/Makefile @@ -96,7 +96,7 @@ kubectl: lint: @golint cmd/... pkg/... example/... -receptorctl-lint: receptorctl/.VERSION +receptorctl-lint: receptor receptorctl/.VERSION @cd receptorctl && nox -s lint format: diff --git a/README.md b/README.md index 641ce9677..fed0ddaa2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -Receptor -======== +# Receptor [![codecov](https://codecov.io/gh/ansible/receptor/branch/devel/graph/badge.svg?token=RAW5Bvh3hM)](https://codecov.io/gh/ansible/receptor) @@ -7,7 +6,7 @@ Receptor is an overlay network intended to ease the distribution of work across See the readthedocs page for Receptor at: -https://ansible.readthedocs.io/projects/receptor/ + ## Terminology and Concepts @@ -24,7 +23,8 @@ https://ansible.readthedocs.io/projects/receptor/ ## How to Get It The easiest way to check out Receptor is to run it as a container. Images are kept on the Quay registry. To use this, run: -``` + +```bash [docker|podman] pull quay.io/ansible/receptor [docker|podman] run -d -v /path/to/receptor.conf:/etc/receptor/receptor.conf:Z receptor ``` @@ -33,8 +33,8 @@ The easiest way to check out Receptor is to run it as a container. Images are k This code can be imported and used from Go programs. The main libraries are: -* _Netceptor_: https://pkg.go.dev/github.com/ansible/receptor/pkg/netceptor -* _Workceptor_: https://pkg.go.dev/github.com/ansible/receptor/pkg/workceptor +* _Netceptor_: +* _Workceptor_: See the `example/` directory for examples of using these libraries from Go. @@ -46,7 +46,7 @@ The command line is organized into entities which take parameters, like: `recept Receptor can also take its configuration from a file in YAML format. The allowed directives are the same as on the command line, with a top-level list of entities and each entity receiving zero or more parameters as a dict. The above command in YAML format would look like this: -``` +```bash --- - entity1: param1: value1 @@ -58,4 +58,4 @@ Receptor can also take its configuration from a file in YAML format. The allowe ## Python Receptor and the 0.6 versions -As of June 25th, this repo is the Go implementation of Receptor. If you are looking for the older Python version of Receptor, including any 0.6.x version, it is now located at https://github.com/project-receptor/python-receptor. +As of June 25th, this repo is the Go implementation of Receptor. If you are looking for the older Python version of Receptor, including any 0.6.x version, it is now located at . diff --git a/packaging/container/Dockerfile b/packaging/container/Dockerfile index 071d93388..bc45d0a2c 100644 --- a/packaging/container/Dockerfile +++ b/packaging/container/Dockerfile @@ -2,8 +2,8 @@ FROM quay.io/centos/centos:stream9 as builder ARG VERSION RUN dnf -y update && \ - dnf install -y golang make python3.11 python3.11-pip git -RUN pip3.11 install wheel + dnf install -y golang make python3.12 python3.12-pip git +RUN pip3.12 install wheel ADD source.tar.gz /source WORKDIR /source @@ -22,11 +22,11 @@ COPY receptor_python_worker-${VERSION}-py3-none-any.whl /tmp COPY receptor.conf /etc/receptor/receptor.conf RUN dnf -y update && \ - dnf -y install python3.11-pip && \ + dnf -y install python3.12-pip && \ dnf clean all && \ - pip3.11 install --no-cache-dir wheel && \ - pip3.11 install --no-cache-dir dumb-init && \ - pip3.11 install --no-cache-dir /tmp/*.whl && \ + pip3.12 install --no-cache-dir wheel && \ + pip3.12 install --no-cache-dir dumb-init && \ + pip3.12 install --no-cache-dir /tmp/*.whl && \ rm /tmp/*.whl COPY --from=builder /source/receptor /usr/bin/receptor diff --git a/receptorctl/README.md b/receptorctl/README.md index ae9a20bfd..8cea752ff 100644 --- a/receptorctl/README.md +++ b/receptorctl/README.md @@ -1,6 +1,8 @@ +# Receptorctl + Receptorctl is a front-end CLI and importable Python library that interacts with Receptor over its control socket interface. -# Setting up nox +## Setting up nox This project includes a `nox` configuration to automate tests, checks, and other functions in a reproducible way using isolated environments. Before you submit a PR, you should install `nox` and verify your changes. @@ -21,7 +23,7 @@ You can use unpinned dependencies as follows: PINNED=false nox -s lint ``` -# Checking changes to Receptorctl +## Checking changes to Receptorctl Run the following `nox` sessions to check for code style and formatting issues: @@ -49,7 +51,7 @@ Run the following `nox` sessions to check for code style and formatting issues: nox -s format ``` -# Running Receptorctl tests +## Running Receptorctl tests Run the following `nox` sessions to test Receptorctl changes: @@ -62,24 +64,24 @@ Run the following `nox` sessions to test Receptorctl changes: * Run tests against a specific Python version. ```bash - # For example, this command tests Receptorctl against Python 3.11. - nox -s tests-3.11 + # For example, this command tests Receptorctl against Python 3.12. + nox -s tests-3.12 ``` -# Updating dependencies +## Updating dependencies Update dependencies in the `requirements` directory as follows: 1. Add any packages or pins to the `*.in` file. 2. Do one of the following from the `receptorctl` directory: - - Update all dependencies. +* Update all dependencies. ```bash nox -s pip-compile ``` - - Generate the full dependency tree for a single set of dependencies, for example: +* Generate the full dependency tree for a single set of dependencies, for example: ```bash nox -s "pip-compile-3.12(tests)" diff --git a/receptorctl/noxfile.py b/receptorctl/noxfile.py index 6681cf47b..9fc3198b8 100644 --- a/receptorctl/noxfile.py +++ b/receptorctl/noxfile.py @@ -5,9 +5,9 @@ import nox.command -LATEST_PYTHON_VERSION = ["3.11"] +LATEST_PYTHON_VERSION = ["3.12"] -python_versions = ["3.8", "3.9", "3.10", "3.11"] +python_versions = ["3.8", "3.9", "3.10", "3.11", "3.12"] LINT_FILES: tuple[str, ...] = (*iglob("**/*.py"),) PINNED = os.environ.get("PINNED", "true").lower() in {"1", "true"} @@ -120,7 +120,7 @@ def lint(session: nox.Session): session.notify("check_format") -@nox.session(name="pip-compile", python=["3.11"]) +@nox.session(name="pip-compile", python=["3.12"]) @nox.parametrize(["req"], arg_values_list=requirements_files, ids=requirements_files) def pip_compile(session: nox.Session, req: str): """Generate lock files from input files or upgrade packages in lock files.""" diff --git a/tests/environments/container-builder/Containerfile b/tests/environments/container-builder/Containerfile index a860677e7..c86ed8f60 100644 --- a/tests/environments/container-builder/Containerfile +++ b/tests/environments/container-builder/Containerfile @@ -1,7 +1,7 @@ FROM quay.io/centos/centos:stream9 # Python options = [3.9, 3.11, 3.12] -ARG PYTHON_VERSION=3.11 +ARG PYTHON_VERSION=3.12 ENV PATH=${PATH}:/usr/local/go/bin From f59b8d6c107ddbe50080bd70893bbe79e502fed2 Mon Sep 17 00:00:00 2001 From: Thom Carlin Date: Tue, 23 Jul 2024 05:05:04 -0400 Subject: [PATCH 2/3] Fix typo --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index d3ae8cbf7..d2c82c187 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -106,7 +106,7 @@ jobs: - 3.12 - 3.8 - >- - - 3.11 + 3.11 - 3.10 - 3.9 uses: ./.github/workflows/reusable-nox.yml From c10d4054df203fe7c519aa6cae686585e80c8ace Mon Sep 17 00:00:00 2001 From: Thom Carlin Date: Tue, 23 Jul 2024 05:19:12 -0400 Subject: [PATCH 3/3] Fix typo try 2 --- .github/workflows/pull_request.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index d2c82c187..4d3e34696 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -105,9 +105,8 @@ jobs: # NOTE: signal problems early: - 3.12 - 3.8 - - >- - 3.11 - - 3.10 + - 3.11 + - "3.10" - 3.9 uses: ./.github/workflows/reusable-nox.yml with: