Skip to content

Commit

Permalink
Merge branch 'master' into pyramid2
Browse files Browse the repository at this point in the history
  • Loading branch information
jssuzanne committed Jul 31, 2023
2 parents 62d2dcf + 889f395 commit c106571
Show file tree
Hide file tree
Showing 74 changed files with 1,731 additions and 1,266 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/lint.yaml
@@ -0,0 +1,15 @@
name: Python linting
on: [push, pull_request]
jobs:
test:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit hooks
run: pre-commit run --all-files --show-diff-on-failure
174 changes: 174 additions & 0 deletions .github/workflows/tests.yaml
@@ -0,0 +1,174 @@
name: Tests
on:
push:
paths-ignore:
- 'docs/**'
branches:
- main
- master
tags:
- '**'
pull_request:
branches:
- '**'
jobs:
Postgres:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: anyblok_test
# Set health checks to wait until PostgreSQL has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Wheel
run: pip install -U pip wheel
- name: Install test dependencies
run: pip install -U -r requirements.test.txt
- name: Install pytest
run: pip install pytest pytest-cov mock coverage-lcov
- name: Install AnyBlok Pyramid
run: pip install .[oidc]
- name: Run framework tests
env:
ANYBLOK_DATABASE_DRIVER: postgresql
ANYBLOK_DATABASE_NAME: anyblok_test
ANYBLOK_DATABASE_PORT: 5432
ANYBLOK_DATABASE_HOST: localhost
ANYBLOK_DATABASE_USER: postgres
ANYBLOK_DATABASE_PASSWORD: postgres
run: pytest anyblok_pyramid/tests
- name: Drop db
env:
PGHOST: localhost
PGPASSWORD: postgres
PGPORT: 5432
run: psql -U postgres -c 'DROP DATABASE anyblok_test;'
- name: Run anyblok_createdb with auth
env:
ANYBLOK_DATABASE_DRIVER: postgresql
ANYBLOK_DATABASE_NAME: anyblok_test
ANYBLOK_DATABASE_PORT: 5432
ANYBLOK_DATABASE_HOST: localhost
ANYBLOK_DATABASE_USER: postgres
ANYBLOK_DATABASE_PASSWORD: postgres
run: anyblok_createdb --install-bloks auth
- name: Run bloks tests on auth
env:
ANYBLOK_DATABASE_DRIVER: postgresql
ANYBLOK_DATABASE_NAME: anyblok_test
ANYBLOK_DATABASE_PORT: 5432
ANYBLOK_DATABASE_HOST: localhost
ANYBLOK_DATABASE_USER: postgres
ANYBLOK_DATABASE_PASSWORD: postgres
run: pytest --cov-append anyblok_pyramid/bloks/auth
- name: Drop db
env:
PGHOST: localhost
PGPASSWORD: postgres
PGPORT: 5432
run: psql -U postgres -c 'DROP DATABASE anyblok_test;'
- name: Run anyblok_createdb with auth-password
env:
ANYBLOK_DATABASE_DRIVER: postgresql
ANYBLOK_DATABASE_NAME: anyblok_test
ANYBLOK_DATABASE_PORT: 5432
ANYBLOK_DATABASE_HOST: localhost
ANYBLOK_DATABASE_USER: postgres
ANYBLOK_DATABASE_PASSWORD: postgres
run: anyblok_createdb --install-bloks auth-password
- name: Run bloks tests on auth-password
env:
ANYBLOK_DATABASE_DRIVER: postgresql
ANYBLOK_DATABASE_NAME: anyblok_test
ANYBLOK_DATABASE_PORT: 5432
ANYBLOK_DATABASE_HOST: localhost
ANYBLOK_DATABASE_USER: postgres
ANYBLOK_DATABASE_PASSWORD: postgres
run: pytest --cov-append anyblok_pyramid/bloks/password
- name: Drop db
env:
PGHOST: localhost
PGPASSWORD: postgres
PGPORT: 5432
run: psql -U postgres -c 'DROP DATABASE anyblok_test;'
- name: Run anyblok_createdb with authorization
env:
ANYBLOK_DATABASE_DRIVER: postgresql
ANYBLOK_DATABASE_NAME: anyblok_test
ANYBLOK_DATABASE_PORT: 5432
ANYBLOK_DATABASE_HOST: localhost
ANYBLOK_DATABASE_USER: postgres
ANYBLOK_DATABASE_PASSWORD: postgres
run: anyblok_createdb --install-bloks authorization
- name: Run bloks tests on authorization
env:
ANYBLOK_DATABASE_DRIVER: postgresql
ANYBLOK_DATABASE_NAME: anyblok_test
ANYBLOK_DATABASE_PORT: 5432
ANYBLOK_DATABASE_HOST: localhost
ANYBLOK_DATABASE_USER: postgres
ANYBLOK_DATABASE_PASSWORD: postgres
run: pytest --cov-append anyblok_pyramid/bloks/authorization
- name: Drop db
env:
PGHOST: localhost
PGPASSWORD: postgres
PGPORT: 5432
run: psql -U postgres -c 'DROP DATABASE anyblok_test;'
- name: Run anyblok_createdb with user identity
env:
ANYBLOK_DATABASE_DRIVER: postgresql
ANYBLOK_DATABASE_NAME: anyblok_test
ANYBLOK_DATABASE_PORT: 5432
ANYBLOK_DATABASE_HOST: localhost
ANYBLOK_DATABASE_USER: postgres
ANYBLOK_DATABASE_PASSWORD: postgres
run: anyblok_createdb --install-bloks user-identity
- name: Run bloks tests on user-identity
env:
ANYBLOK_DATABASE_DRIVER: postgresql
ANYBLOK_DATABASE_NAME: anyblok_test
ANYBLOK_DATABASE_PORT: 5432
ANYBLOK_DATABASE_HOST: localhost
ANYBLOK_DATABASE_USER: postgres
ANYBLOK_DATABASE_PASSWORD: postgres
run: pytest --cov-append anyblok_pyramid/bloks/user_identity
- name: Generate lcov
run: coverage-lcov
- name: Coveralls
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
flag-name: ${{ github.job }}
path-to-lcov: lcov.info

finish:
needs: [Postgres]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
path-to-lcov: lcov.info
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -24,4 +24,3 @@ etc/
develop-eggs/

gmon.out

30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,30 @@
exclude: "addons-thirdparty/"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- id: fix-encoding-pragma
args: ["--remove"]
- id: check-added-large-files
- id: check-merge-conflict
- id: check-yaml
- id: check-case-conflict
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/PyCQA/flake8
rev: "6.0.0"
hooks:
- id: flake8
name: flake8
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
args: ["-l", "80"]
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -24,6 +24,7 @@ services:
install:
- pip install -U pip wheel
- pip install -U -r requirements.test.txt
- pip install -e git+http://git@github.com/seantis/zope.sqlalchemy.git@sqlalchemy-2.0#egg=zope.sqlalchemy
- pip install .[oidc]

env:
Expand Down
118 changes: 59 additions & 59 deletions README.rst
@@ -1,59 +1,59 @@
.. This file is a part of the AnyBlok / Pyramid project
..
.. Copyright (C) 2015 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
.. Copyright (C) 2019 Jean-Sebastien SUZANNE <js.suzanne@gmail.com>
..
.. This Source Code Form is subject to the terms of the Mozilla Public License,
.. v. 2.0. If a copy of the MPL was not distributed with this file,You can
.. obtain one at http://mozilla.org/MPL/2.0/.
.. image:: https://img.shields.io/pypi/pyversions/anyblok_delivery.svg?longCache=True
:alt: Python versions

.. image:: https://travis-ci.org/AnyBlok/Anyblok_Pyramid.svg?branch=master
:target: https://travis-ci.org/AnyBlok/Anyblok_Pyramid
:alt: Build status

.. image:: https://coveralls.io/repos/github/AnyBlok/Anyblok_Pyramid/badge.svg?branch=master
:target: https://coveralls.io/github/AnyBlok/Anyblok_Pyramid?branch=master
:alt: Coverage

.. image:: https://img.shields.io/pypi/v/Anyblok_Pyramid.svg
:target: https://pypi.python.org/pypi/Anyblok_Pyramid/
:alt: Version status
.. image:: https://readthedocs.org/projects/anyblok-pyramid/badge/?version=latest
:alt: Documentation Status
:scale: 100%
:target: https://doc.anyblok-pyramid.anyblok.org/en/latest/?badge=latest


AnyBlok / Pyramid
=================

AnyBlok / Pyramid make the link between `AnyBlok <http://doc.anyblok.org>`_ and
`Pyramid <http://pyramid.readthedocs.org/>`_

It also gives you some bloks for adding user http authentication and role
based authorization to your project.


+-------------------+--------------+----------------------------------------------------------+
| Blok | Dependencies | Description |
+===================+==============+==========================================================+
| **Pyramid** | | Add hooks to connect Pyramid authentification, OIDC |
| | | Relying Party and authorization |
+-------------------+--------------+----------------------------------------------------------+
| **auth** | **pyramid** | Add 'User' and 'User.Role' models. |
+-------------------+--------------+----------------------------------------------------------+
| **auth-password** | **auth** | Add 'User.CredentialStore' model, a simple |
| | | login, password table |
+-------------------+--------------+----------------------------------------------------------+
| **authorization** | **auth** | Add 'User.Authorization' model for managing permissions |
+-------------------+--------------+----------------------------------------------------------+
| **user_identity** | **auth** | Add some column on model **Model.Pyramid.User** |
+-------------------+--------------+----------------------------------------------------------+

AnyBlok / Pyramid is released under the terms of the `Mozilla Public License`.

See the `latest documentation <http://doc.anyblok-pyramid.anyblok.org/>`_
.. This file is a part of the AnyBlok / Pyramid project
..
.. Copyright (C) 2015 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
.. Copyright (C) 2019 Jean-Sebastien SUZANNE <js.suzanne@gmail.com>
..
.. This Source Code Form is subject to the terms of the Mozilla Public License,
.. v. 2.0. If a copy of the MPL was not distributed with this file,You can
.. obtain one at http://mozilla.org/MPL/2.0/.
.. image:: https://img.shields.io/pypi/pyversions/anyblok_delivery.svg?longCache=True
:alt: Python versions

.. image:: https://travis-ci.org/AnyBlok/Anyblok_Pyramid.svg?branch=master
:target: https://travis-ci.org/AnyBlok/Anyblok_Pyramid
:alt: Build status

.. image:: https://coveralls.io/repos/github/AnyBlok/Anyblok_Pyramid/badge.svg?branch=master
:target: https://coveralls.io/github/AnyBlok/Anyblok_Pyramid?branch=master
:alt: Coverage

.. image:: https://img.shields.io/pypi/v/Anyblok_Pyramid.svg
:target: https://pypi.python.org/pypi/Anyblok_Pyramid/
:alt: Version status

.. image:: https://readthedocs.org/projects/anyblok-pyramid/badge/?version=latest
:alt: Documentation Status
:scale: 100%
:target: https://doc.anyblok-pyramid.anyblok.org/en/latest/?badge=latest


AnyBlok / Pyramid
=================

AnyBlok / Pyramid make the link between `AnyBlok <http://doc.anyblok.org>`_ and
`Pyramid <http://pyramid.readthedocs.org/>`_

It also gives you some bloks for adding user http authentication and role
based authorization to your project.


+-------------------+--------------+----------------------------------------------------------+
| Blok | Dependencies | Description |
+===================+==============+==========================================================+
| **Pyramid** | | Add hooks to connect Pyramid authentification, OIDC |
| | | Relying Party and authorization |
+-------------------+--------------+----------------------------------------------------------+
| **auth** | **pyramid** | Add 'User' and 'User.Role' models. |
+-------------------+--------------+----------------------------------------------------------+
| **auth-password** | **auth** | Add 'User.CredentialStore' model, a simple |
| | | login, password table |
+-------------------+--------------+----------------------------------------------------------+
| **authorization** | **auth** | Add 'User.Authorization' model for managing permissions |
+-------------------+--------------+----------------------------------------------------------+
| **user_identity** | **auth** | Add some column on model **Model.Pyramid.User** |
+-------------------+--------------+----------------------------------------------------------+

AnyBlok / Pyramid is released under the terms of the `Mozilla Public License`.

See the `latest documentation <http://doc.anyblok-pyramid.anyblok.org/>`_
20 changes: 10 additions & 10 deletions anyblok_pyramid/__init__.py
Expand Up @@ -6,21 +6,21 @@
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file,You can
# obtain one at http://mozilla.org/MPL/2.0/.
from anyblok.blok import BlokManager
import inspect
from .common import ( # noqa: F401
merge,
PERM_READ,
PERM_WRITE,
PERM_C___,
PERM__R__,
PERM___U_,
PERM____D,
)

from anyblok.blok import BlokManager

from .common import PERM_READ, PERM_WRITE, merge # noqa: F401

from .common import PERM_C___ # noqa isort:skip
from .common import PERM__R__ # noqa isort:skip
from .common import PERM___U_ # noqa isort:skip
from .common import PERM____D # noqa isort:skip


def anyblok_init_config(unittest=False):
from anyblok import config # noqa import anyblok.config

from . import config # noqa import config definition


Expand Down

0 comments on commit c106571

Please sign in to comment.