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

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

The project is managed using direnv and uv:

# Enable direnv and create virtualenv if needed
direnv allow

# Upgrade venv
pip install -U setuptools pip wheel

# Install uv
pip install uv

# Install application in development mode
uv sync --active [--extra=ldap] [--extra=markdown] [--extra={pgsql-src|pgsql-bin}] [--extra=radius]
invoke i18n.generate

# Install ESLint
npm install --save-dev

# Copy and adapt configuration files
cp -a conf .conf
cp -a env.dist env.local

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

# Run web server in development mode
invoke service.httpd

# Run static and functional tests:
invoke test

Tests

Static code validation

# ESLint
invoke test.eslint

# flake8
invoke test.flake8

# pylint
invoke test.pylint

# All
invoke test.static

Functional tests

# Validators
invoke test.functional --test='test_01_validators.py'

# Forms
invoke test.functional --test='test_02_forms.py'

# Utils
invoke test.functional --test='test_03_utils.py'

# SQL utils
invoke test.functional --test='test_04_sql_utils.py'

# Authentication client
invoke test.functional --test='test_10_auth_client.py'

# LDAP client
invoke test.functional --test='test_11_ldap_client.py'

# RADIUS client
invoke test.functional --test='test_12_radius_client.py'

# Common views
invoke test.functional --test='test_50_common_views.py'

# API views
invoke test.functional --test='test_51_api_views.py'

# Articles views
invoke test.functional --test='test_52_articles_views.py'

# All
invoke test.functional

I18n

Extract messages

invoke i18n.extract i18n.update

Compile catalogs and update JSON files

invoke i18n.generate

Create new language

invoke i18n.init {locale_name}

Installation

pip install pyramid-helpers

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

Files list

.
├── .coveragerc                         Coverage configuration file
├── babel.cfg                           Babel configuration file (i18n)
├── CHANGES.md
├── eslint.config.js                    ESLint configuration file
├── package.json                        NPM package file for ESLint installation
├── 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_04_sql_utils.py            test functions for SQL 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-2.1.0.tar.gz (71.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyramid_helpers-2.1.0-py3-none-any.whl (107.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyramid_helpers-2.1.0.tar.gz
  • Upload date:
  • Size: 71.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for pyramid_helpers-2.1.0.tar.gz
Algorithm Hash digest
SHA256 b2cb488e93c1485cb80a5764ca40089198cd69ca906780fe4f21008f70cbea8a
MD5 47340a7abfa2332321b21baf59feff5f
BLAKE2b-256 a6c7184806c401359e50bc744f3c95bf1eb77dfb99f66fe4f71d9d54223e22fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramid_helpers-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c60a4f6e197b857b56d832653837608fc80a880d633364de1f96b7fbcee6a22b
MD5 d2c98cccd66f4a7a66b4481cfcdc10c3
BLAKE2b-256 852839b11174426fdbb67f38c2c68f3a6bcc3c051ee78a90a91b1cf4c499c7ae

See more details on using hashes here.

Supported by

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