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.1.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.1-py3-none-any.whl (110.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyramid_helpers-2.2.1.tar.gz
  • Upload date:
  • Size: 73.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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.1.tar.gz
Algorithm Hash digest
SHA256 4f3887655b673ccb16b074d12f4556d40189c4d9ff9c690cc48bfb99cc103f2b
MD5 dfa7ea5ba3e7fb265ad561da49bb0bcc
BLAKE2b-256 22283662394f61f7a475aef6bddb6d0a4fc67884e0c74a047b220c6e6aa43ec6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyramid_helpers-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 110.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 85527a65dba4d4e0c57203f22515fa9a067daa5eafcd301143db4f31faa4d043
MD5 b4f80135ee87b03495112ba1bdd03834
BLAKE2b-256 2e5ddf126d796a3775fadf23afd70baba9bd8fa89e0e0a578969e6a8e129a15d

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