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.2.0.tar.gz (73.7 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.2.0-py3-none-any.whl (110.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyramid_helpers-2.2.0.tar.gz
  • Upload date:
  • Size: 73.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":null,"id":"forky","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyramid_helpers-2.2.0.tar.gz
Algorithm Hash digest
SHA256 27012c61e1a73d59dfe856c0a9c268df788c5f750f282e80fb6c13d194c0f5e9
MD5 8bc97239de3a6a9aae60b0174fbe4608
BLAKE2b-256 e25db1bb1456a26f3cb4796b732d8e4840a7dcfbc0c2a3e457786e4f12a1f814

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyramid_helpers-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 110.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":null,"id":"forky","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyramid_helpers-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a608d98746f475c2db895fa4c6e8f9d64935190dec548abd1993968400dc51bd
MD5 ec7e4ae68b88ba52b872b4042a99cac7
BLAKE2b-256 f3fc45d2c947ef8aeacd4e727a62a83770e1122228982f7e46cd5e67cb2f9f5c

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