Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

env:
python-version: 3.12
python-version: 3.14

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:
python-version:
required: false
type: string
default: "3.12"
default: "3.14"
plone-version:
required: false
type: string
default: "6.1.1"
default: "6.2.1"
outputs:
backend:
description: "Flag reporting if we should run the backend jobs"
Expand Down
19 changes: 16 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,23 @@ jobs:
needs:
- config
strategy:
fail-fast: false
matrix:
python-version: ["3.13", "3.12", "3.11", "3.10"]
plone-version: ["6.1-latest", "6.0-latest"]
include:
- python-version: "3.14"
plone-version: "6.2-latest"
- python-version: "3.13"
plone-version: "6.2-latest"
- python-version: "3.12"
plone-version: "6.2-latest"
- python-version: "3.11"
plone-version: "6.2-latest"
- python-version: "3.13"
plone-version: "6.1-latest"
- python-version: "3.12"
plone-version: "6.1-latest"
- python-version: "3.11"
plone-version: "6.1-latest"
with:
python-version: ${{ matrix.python-version }}
plone-version: ${{ matrix.plone-version }}
Expand All @@ -34,7 +48,6 @@ jobs:
uses: plone/meta/.github/workflows/backend-pytest-coverage.yml@2.x
needs:
- config
- test
with:
python-version: ${{ needs.config.outputs.python-version }}
plone-version: ${{ needs.config.outputs.plone-version }}
Expand Down
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"recommendations": [
"charliermarsh.ruff",
"ms-python.python"
"ms-python.python",
"ms-python.vscode-python-envs"
]
}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"flake8.args": ["--config=pyproject.toml"],
"ruff.organizeImports": true,
"python-envs.workspaceSearchPaths": [
".venv"
],
"python.terminal.activateEnvironment": true,
"python.testing.pytestArgs": [
"tests"
Expand Down
39 changes: 20 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ BACKEND_FOLDER=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
ifdef PLONE_VERSION
PLONE_VERSION := $(PLONE_VERSION)
else
PLONE_VERSION := 6.1.1
PLONE_VERSION := 6.2.1
endif

export PYTHON_VERSION := 3.14

ifdef CI
UV_VENV_ARGS :=
else
UV_VENV_ARGS := --python=$(PYTHON_VERSION)
endif

VENV_FOLDER=$(BACKEND_FOLDER)/.venv
Expand All @@ -47,42 +55,35 @@ all: build
help: ## This help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

############################################
# Config
############################################
instance/etc/zope.ini instance/etc/zope.conf: ## Create instance configuration
@echo "$(GREEN)==> Create instance configuration$(RESET)"
@uvx cookiecutter -f --no-input -c 2.1.1 --config-file instance.yaml gh:plone/cookiecutter-zope-instance

.PHONY: config
config: instance/etc/zope.ini

############################################
# Installation
############################################
requirements-mxdev.txt: ## Generate constraints file
requirements-mxdev.txt: pyproject.toml mx.ini ## Generate constraints file
@echo "$(GREEN)==> Generate constraints file$(RESET)"
@echo '-c https://dist.plone.org/release/$(PLONE_VERSION)/constraints.txt' > requirements.txt
@uvx mxdev -c mx.ini
@uvx 'mxdev[uv]' -c mx.ini

$(VENV_FOLDER): requirements-mxdev.txt ## Install dependencies
@echo "$(GREEN)==> Install environment$(RESET)"
@uv venv $(VENV_FOLDER)
@if [[ -d "$(VENV_FOLDER)" ]]; then echo "$(YELLOW)==> Environment already exists at $(VENV_FOLDER)$(RESET)"; else uv venv $(UV_VENV_ARGS) $(VENV_FOLDER); fi
@uv pip install -r requirements-mxdev.txt

.PHONY: sync
sync: $(VENV_FOLDER) ## Sync project dependencies
@echo "$(GREEN)==> Sync project dependencies$(RESET)"
@uv pip install -r requirements-mxdev.txt

instance/etc/zope.ini instance/etc/zope.conf: instance.yaml ## Create instance configuration
@echo "$(GREEN)==> Create instance configuration$(RESET)"
@uvx cookiecutter -f --no-input -c 2.4.1 --config-file instance.yaml gh:plone/cookiecutter-zope-instance

.PHONY: config
config: instance/etc/zope.ini

.PHONY: install
install: $(VENV_FOLDER) config ## Install Plone and dependencies

.PHONY: clean
clean: ## Clean installation and instance
@echo "$(RED)==> Cleaning environment and build$(RESET)"
@rm -rf $(VENV_FOLDER) pyvenv.cfg .installed.cfg instance .venv .pytest_cache .ruff_cache constraints* requirements*
$(MAKE) -C "./docs" clean
@rm -rf $(VENV_FOLDER) pyvenv.cfg .installed.cfg instance/etc .venv .pytest_cache .ruff_cache constraints* requirements*

############################################
# Instance
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ There are some differences in configuration:

## Integration with Entra ID

Enumeration PAS plugin: if you're using **pas.plugins.authomatic** with *Microsoft Entra ID*, we recommend pairing it with [pas.plugins.eea](https://github.com/eea/pas.plugins.eea) for proper user enumeration and metadata synchronization. This complementary plugin enables listing all the Entra ID users and groups and is compatible with both Plone 5 and Plone 6.
Enumeration PAS plugin: if you're using **pas.plugins.authomatic** with *Microsoft Entra ID*, we recommend pairing it with [pas.plugins.eea](https://github.com/eea/pas.plugins.eea) for proper user enumeration and metadata synchronization. This complementary plugin enables listing all the Entra ID users and groups and is compatible with Plone 6.1 and 6.2.

## Source Code and Contributions

Expand All @@ -222,7 +222,7 @@ We appreciate any contribution and if a release is needed to be done on PyPI, pl

### Development

You need a working `python` environment (system, virtualenv, pyenv, etc) version 3.7 or superior.
You need a working `python` environment (system, virtualenv, pyenv, etc) version 3.11 or superior.

Then install the dependencies and a development instance using:

Expand All @@ -246,9 +246,9 @@ By default we use the latest Plone version in the 6.x series.

### Changelog entries

The `CHANGES.md` file is managed using [towncrier](https://towncrier.readthedocs.io/). All non trivial changes must be accompanied by an entry in the `news` directory. Using such a tool instead of editing the file directly, has the following benefits:
The `CHANGELOG.md` file is managed using [towncrier](https://towncrier.readthedocs.io/). All non trivial changes must be accompanied by an entry in the `news` directory. Using such a tool instead of editing the file directly, has the following benefits:

* It avoids merge conflicts in CHANGES.md.
* It avoids merge conflicts in CHANGELOG.md.
* It avoids news entries ending up under the wrong version header.

The best way of adding news entries is this:
Expand All @@ -260,12 +260,14 @@ The best way of adding news entries is this:
* For bug fixes: 42.bugfix.
* For new features: 42.feature.
* For internal changes: 42.internal.
* For breaking changs: 42.breaking.
* For breaking changes: 42.breaking.
* For documentation changes: 42.documentation.
* For test changes: 42.tests.
* Any other extensions are ignored.

* The contents of this file should be markdown formatted text that will be used as the content of the CHANGES.md entry.
* The contents of this file should be markdown formatted text that will be used as the content of the CHANGELOG.md entry.

Towncrier will automatically add a reference to the issue when rendering the CHANGES.md file.
Towncrier will automatically add a reference to the issue when rendering the CHANGELOG.md file.

### Releasing `pas.plugins.authomatic`

Expand Down
1 change: 1 addition & 0 deletions news/+coverage.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ran the CI coverage job in parallel with the test matrix instead of waiting for it to finish. @ericof
1 change: 1 addition & 0 deletions news/+fail-fast.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disabled `fail-fast` in the CI test matrix so a single failing job no longer cancels the others. @ericof
1 change: 1 addition & 0 deletions news/+logging.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Consolidated the package logger into a single `pas.plugins.authomatic.logger` and removed the redundant `log.py` module. @ericof
1 change: 1 addition & 0 deletions news/+matrix.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Excluded the unsupported Python 3.14 / Plone 6.1 combination from the CI test matrix. @ericof
1 change: 1 addition & 0 deletions news/+pytest-plone.tests
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reused the built-in `anon_request` and `functional_portal` fixtures from pytest-plone 1.0.0 instead of the local re-implementations. @ericof
1 change: 1 addition & 0 deletions news/+readme.documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated the README: bumped the minimum Python to 3.11, corrected the changelog filename to `CHANGELOG.md`, and documented the `documentation` and `tests` news fragment types. @ericof
1 change: 1 addition & 0 deletions news/105.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Converted the package to a PEP 420 native namespace, dropping the legacy `pkg_resources` namespace declarations. @ericof
1 change: 1 addition & 0 deletions news/106.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added support for Plone 6.2. @ericof
1 change: 1 addition & 0 deletions news/107.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dropped support for Plone 6.0. @ericof
1 change: 1 addition & 0 deletions news/108.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added support for Python 3.14. @ericof
1 change: 1 addition & 0 deletions news/109.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dropped support for Python 3.10. @ericof
19 changes: 9 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dynamic = ["version"]
description = "Provides OAuth2/OpenID login for Plone using Authomatic."
readme = "README.md"
license = {text = "GNU General Public License v2 (GPLv2)"}
requires-python = ">=3.10"
requires-python = ">=3.11"
authors = [
{ name = "Jens Klein", email = "dev@bluedynamics.com" },
{ name = "Érico Andrei", email = "ericof@plone.org" },
Expand All @@ -21,23 +21,22 @@ classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Plone",
"Framework :: Plone :: 6.0",
"Framework :: Plone :: 6.1",
"Framework :: Plone :: 6.2",
"Framework :: Plone :: Addon",
"Framework :: Zope",
"Framework :: Zope :: 5",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dependencies = [
"Products.CMFPlone>=6.0",
"Products.CMFPlone>=6.1",
"authomatic>=1.3.0",
"plone.restapi>=9.10.0",
"plone.restapi",
"plone.api",
]

Expand All @@ -49,9 +48,9 @@ test = [
"plone.restapi[test]",
"zest.releaser[recommended]",
"pytest-cov",
"pytest-plone>=1.0.0a1",
"zest-releaser[recommended]>=9.5.0",
"zestreleaser-towncrier>=1.3.0",
"pytest-plone>=1.0.0",
"zest-releaser[recommended]",
"zestreleaser-towncrier",
]

[project.urls]
Expand Down Expand Up @@ -140,7 +139,7 @@ enable-unstable-feature = [
]

[tool.ruff]
target-version = "py310"
target-version = "py311"
line-length = 88
fix = true
lint.select = [
Expand Down
1 change: 0 additions & 1 deletion src/pas/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion src/pas/plugins/__init__.py

This file was deleted.

8 changes: 6 additions & 2 deletions src/pas/plugins/authomatic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from pas.plugins.authomatic.patches import apply_patches

import logging

__version__ = "2.0.1.dev0"

__version__ = "3.0.0.dev0"


PACKAGE_NAME = "pas.plugins.authomatic"


apply_patches()
logger = logging.getLogger(PACKAGE_NAME)

apply_patches(logger)


def initialize(context):
Expand Down
8 changes: 2 additions & 6 deletions src/pas/plugins/authomatic/browser/view.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from authomatic import Authomatic
from pas.plugins.authomatic import logger
from pas.plugins.authomatic.integration import ZopeRequestAdapter
from pas.plugins.authomatic.interfaces import _
from pas.plugins.authomatic.utils import authomatic_cfg
from pas.plugins.authomatic.utils import authomatic_settings
from plone import api
from plone.app.layout.navigation.interfaces import INavigationRoot
from plone.base.interfaces.siteroot import INavigationRoot
from plone.protect.interfaces import IDisableCSRFProtection
from Products.CMFCore.interfaces import ISiteRoot
from Products.Five.browser import BrowserView
Expand All @@ -13,11 +14,6 @@
from zope.interface import implementer
from zope.publisher.interfaces import IPublishTraverse

import logging


logger = logging.getLogger(__file__)


def is_root(obj):
"""Check if current context is Navigation root or a Portal."""
Expand Down
7 changes: 2 additions & 5 deletions src/pas/plugins/authomatic/integration/restapi.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
from authomatic.adapters import BaseAdapter

import logging


logger = logging.getLogger(__file__)
from pas.plugins.authomatic import logger


Headers = dict | None
Expand All @@ -12,6 +8,7 @@
class RestAPIAdapter(BaseAdapter):
"""Adapter for plone.restapi usage."""

headers: dict[str, str]
frontend_route: str = "login-authomatic"

def __init__(
Expand Down
7 changes: 2 additions & 5 deletions src/pas/plugins/authomatic/integration/zope.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from authomatic.adapters import BaseAdapter
from pas.plugins.authomatic import logger

import http
import logging


logger = logging.getLogger(__file__)


class ZopeRequestAdapter(BaseAdapter):
Expand Down Expand Up @@ -53,7 +50,7 @@ def set_header(self, key, value):
self.view.request.response.setHeader(key, value)

def set_status(self, status):
code, message = status.split(" ")
code, _ = status.split(" ")
code = int(code)
logger.debug(f"set_status {code}")
self.view.request.response.setStatus(code)
6 changes: 0 additions & 6 deletions src/pas/plugins/authomatic/log.py

This file was deleted.

7 changes: 5 additions & 2 deletions src/pas/plugins/authomatic/patches/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
def apply_patches():
from logging import Logger


def apply_patches(logger: Logger):
"""Apply patches."""
from .authomatic import patch_base_provider_fetch

patch_base_provider_fetch()
patch_base_provider_fetch(logger)
Loading
Loading