Skip to main content

Helpers to develop Pyramid applications

Project description

Pyramid-Helpers

Pyramid-Helpers is a set of helpers to develop applications using Pyramid framework.

It includes authentication, forms, i18n and pagination helpers.

Prerequisites

The project is managed using Poetry

PostgreSQL adapter (Optional)

In order to use a PostgreSQL database, it is recommended to install the psycopg adapter. You should check the build prerequisites in order to install this package (source only).

LDAP client (Optional)

LDAP client relies on the python-ldap client. You should check the build prerequisites in order to install this package.

Development

# Create virtualenv
mkdir .venv
python3 -m venv .venv

# Activate virtualenv
source .venv/bin/activate

# Update virtualenv
pip install -U pip setuptools

# Install Poetry
pip install wheel
pip install poetry

# Install application in development mode
poetry install --extras "[api-doc] [auth-ldap] [auth-radius]"
poetry run invoke i18n.generate

# Copy and adapt conf/ directory
cp -a conf .conf

# Initialize database
phelpers-init-db .conf/application.ini

# Run web server in development mode
poetry run invoke service.httpd --config-uri=.conf/application.ini --env=.conf/environment

# Run static and functional tests:
poetry run invoke test

Tests

Static code validation

# ESLint
poetry run invoke test.eslint

# flake8
poetry run invoke test.flake8

# pylint
poetry run invoke test.pylint

# All
poetry run invoke test.static

Functional tests

# Validators
poetry run invoke test.functional --test='tests/test_01_validators.py'

# Forms
poetry run invoke test.functional --test='tests/test_02_forms.py'

# Authentication client
poetry run invoke test.functional --test='tests/test_10_auth_client.py'

# LDAP client
poetry run invoke test.functional --test='tests/test_11_ldap_client.py'

# RADIUS client
poetry run invoke test.functional --test='tests/test_12_radius_client.py'

# Common views
poetry run invoke test.functional --test='tests/test_50_common_views.py'

# API views
poetry run invoke test.functional --test='tests/test_51_api_views.py'

# Articles views
poetry run invoke test.functional --test='tests/test_52_articles_views.py'

# All
poetry run invoke test.functional

I18n

Extract messages

poetry run invoke i18n.extract i18n.update

Compile catalogs and update JSON files

poetry run invoke i18n.generate

Create new language

poetry run invoke i18n.init {locale_name}

Installation

pip install pyramid-helpers

# And optionally:
phelpers-init-db conf/application.ini

Files list

.
├── .coveragerc                         Coverage configuration file
├── .eslintrc.json                      ESLint configuration file
├── babel.cfg                           Babel configuration file (i18n)
├── CHANGES.md
├── pylintrc                            Pylint configuration file
├── pyproject.toml                      Poetry configuration file
├── README.md                           This file
├── setup.cfg
├── conf
│   ├── application.ini                 main configuration file
│   ├── auth.ini                        authentication configuration
│   ├── ldap.ini                        LDAP configuration file (auth)
│   └── radius.ini                      RADIUS configuration file (auth)
├── pyramid_helpers
│   ├── __init__.py                     initialization
│   ├── api_doc.py                      API documentation helper
│   ├── auth.py                         authentication helper
│   ├── ldap.py                         LDAP client
│   ├── models.py                       SQLAlchemy model for demo app
│   ├── paginate.py                     pagination class, decorator and setup
│   ├── predicates.py                   custom route predicates (Enum, Numeric)
│   ├── radius.py                       RADIUS client
│   ├── resources.py                    basic resource file for demo app
│   ├── forms
│   │   ├── __init__.py                 form class, decorator and setup, largely inspired from formhelpers[1]
│   │   ├── articles.py                 formencode schemas for articles for demo app
│   │   ├── auth.py                     formencode schema for authentication for demo app
│   │   └── validators.py               various formencode validators
│   ├── funcs
│   │   └── articles.py                 functions for articles management
│   ├── i18n.py                         i18n setup and helpers
│   ├── locale
│   │   ├── fr
│   │   │   └── LC_MESSAGES
│   │   │       └── pyramid-helpers.po
│   │   └── pyramid-helpers.pot
│   ├── scripts
│   │   └── initializedb.py             script for database initialization
│   ├── static
│   │   ├── css
│   │   │   ├── api-doc-bs3.css         javascript code for API documentation (Bootstrap 3)
│   │   │   ├── api-doc-bs4.css         javascript code for API documentation (Bootstrap 4)
│   │   │   ├── api-doc-bs5.css         javascript code for API documentation (Bootstrap 5)
│   │   │   └── pyramid-helpers.css     stylesheet for demo app
│   │   └── js
│   │       ├── api-doc.js              javascript code for API documentation
│   │       └── pyramid-helpers.js      javascript code for demo app
│   ├── templates                       Mako templates
│   │   ├── articles                    Mako templates for demo app
│   │   │   ├── edit.mako
│   │   │   ├── index.mako
│   │   │   └── view.mako
│   │   ├── confirm.mako
│   │   ├── errors.mako
│   │   ├── form-tags.mako              Mako template for forms rendering - derivates from formhelpers[1]
│   │   ├── login.mako
│   │   ├── paginate.mako               Mako template for pagination rendering
│   │   ├── site.mako                   Main template for demo app
│   │   └── validators.mako             Mako template to test validators
│   └── views                           views for demo app
│       ├── api
│       │   └── articles.py
│       └── articles.py
├── tasks                               Invoke tasks
│   ├── __init__.py                     initialization
│   ├── common.py                       common file
│   ├── i18n.py                         i18n tasks
│   ├── service.py                      service tasks
│   └── test.py                         test tasks
└── tests                               functional tests (pytest)
    ├── conftest.py                     configuration file for pytest
    ├── test_01_validators.py           test functions for forms validators
    ├── test_02_forms.py                test functions for forms
    ├── test_03_utils.py                test functions for utilities
    ├── test_10_auth_client.py          test functions for authentication
    ├── test_11_ldap_client.py          test functions for LDAP client
    ├── test_12_radius_client.py        test functions for radius client
    ├── test_50_common_views.py         test functions for common views
    ├── test_51_api_views.py            test functions for articles API
    └── test_52_articles_views.py       test functions for articles views

Useful documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyramid_helpers-1.9.2.tar.gz (85.4 kB view details)

Uploaded Source

Built Distribution

pyramid_helpers-1.9.2-py3-none-any.whl (123.4 kB view details)

Uploaded Python 3

File details

Details for the file pyramid_helpers-1.9.2.tar.gz.

File metadata

  • Download URL: pyramid_helpers-1.9.2.tar.gz
  • Upload date:
  • Size: 85.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.1 CPython/3.11.8 Linux/6.7.9-amd64

File hashes

Hashes for pyramid_helpers-1.9.2.tar.gz
Algorithm Hash digest
SHA256 8381b3b273392ecc26ea274ba2e6446f66f71ff9ca905bc7dcdd9a4c099500d6
MD5 acdd29ee36fb1271735533d8d324aaba
BLAKE2b-256 881178471daf3bfc60c44faf167f29870be934985ff767ebb9ac7c4db7637925

See more details on using hashes here.

File details

Details for the file pyramid_helpers-1.9.2-py3-none-any.whl.

File metadata

  • Download URL: pyramid_helpers-1.9.2-py3-none-any.whl
  • Upload date:
  • Size: 123.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.1 CPython/3.11.8 Linux/6.7.9-amd64

File hashes

Hashes for pyramid_helpers-1.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b77364645f09a77a6f3d26f0abdbb2126911a677af1c4c835768ad74d0ff39c5
MD5 bb373836298e7727689c3ea858ad3f96
BLAKE2b-256 2e1e146552480c314816af8c451c0eb884a38f5baeb4bc5277b4e106c021e219

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page