# 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](https://poetry.eustace.io/docs/#installation)
### PostgreSQL adapter (Optional)
In order to use a PostgreSQL database, it is recommended to install the [psycopg](https://www.psycopg.org/) adapter. You should check the [build prerequisites](https://www.psycopg.org/docs/install.html#build-prerequisites) in order to install this package (source only).
### LDAP client (Optional)
LDAP client relies on the [python-ldap](https://www.python-ldap.org/en/latest/) client. You should check the [build prerequisites](https://www.python-ldap.org/en/latest/installing.html#build-prerequisites) in order to install this package.
## Development
```
# Enable direnv and create virtual environment if needed
direnv allow
# Update virtualenv
pip install -U pip setuptools wheel
# Install Poetry
pip install wheel
pip install poetry
# Install application in development mode
poetry install --extras "[api-doc] [auth-ldap] [auth-radius]"
invoke i18n.generate
# 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
├── .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_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
* https://docs.pylonsproject.org/projects/pyramid/en/latest/
* https://docs.pylonsproject.org/projects/pyramid/en/latest/#api-documentation
* https://techspot.zzzeek.org/2008/07/01/better-form-generation-with-mako-and-pylons/
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/yack/pyramid-helpers",
"name": "pyramid-helpers",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "web, wsgi, pylons, pyramid, helpers",
"author": "Cyril Lacoux",
"author_email": "clacoux@easter-eggs.com",
"download_url": "https://files.pythonhosted.org/packages/d6/47/deb85515aacabe4b0e54e7e19813d528ef0e03c8e8e7d067953b23f6af9b/pyramid_helpers-2.0.0.tar.gz",
"platform": null,
"description": "# Pyramid-Helpers\n\nPyramid-Helpers is a set of helpers to develop applications using Pyramid framework.\n\nIt includes authentication, forms, i18n and pagination helpers.\n\n\n## Prerequisites\nThe project is managed using [Poetry](https://poetry.eustace.io/docs/#installation)\n\n### PostgreSQL adapter (Optional)\nIn order to use a PostgreSQL database, it is recommended to install the [psycopg](https://www.psycopg.org/) adapter. You should check the [build prerequisites](https://www.psycopg.org/docs/install.html#build-prerequisites) in order to install this package (source only).\n\n### LDAP client (Optional)\nLDAP client relies on the [python-ldap](https://www.python-ldap.org/en/latest/) client. You should check the [build prerequisites](https://www.python-ldap.org/en/latest/installing.html#build-prerequisites) in order to install this package.\n\n\n## Development\n```\n# Enable direnv and create virtual environment if needed\ndirenv allow\n\n# Update virtualenv\npip install -U pip setuptools wheel\n\n# Install Poetry\npip install wheel\npip install poetry\n\n# Install application in development mode\npoetry install --extras \"[api-doc] [auth-ldap] [auth-radius]\"\ninvoke i18n.generate\n\n# Copy and adapt configuration files\ncp -a conf .conf\ncp -a env.dist env.local\n\n# Initialize database\nphelpers-init-db .conf/application.ini\n\n# Run web server in development mode\ninvoke service.httpd\n\n# Run static and functional tests:\ninvoke test\n```\n\n## Tests\n### Static code validation\n```\n# ESLint\ninvoke test.eslint\n\n# flake8\ninvoke test.flake8\n\n# pylint\ninvoke test.pylint\n\n# All\ninvoke test.static\n```\n\n### Functional tests\n```\n# Validators\ninvoke test.functional --test='test_01_validators.py'\n\n# Forms\ninvoke test.functional --test='test_02_forms.py'\n\n# Utils\ninvoke test.functional --test='test_03_utils.py'\n\n# SQL utils\ninvoke test.functional --test='test_04_sql_utils.py'\n\n# Authentication client\ninvoke test.functional --test='test_10_auth_client.py'\n\n# LDAP client\ninvoke test.functional --test='test_11_ldap_client.py'\n\n# RADIUS client\ninvoke test.functional --test='test_12_radius_client.py'\n\n# Common views\ninvoke test.functional --test='test_50_common_views.py'\n\n# API views\ninvoke test.functional --test='test_51_api_views.py'\n\n# Articles views\ninvoke test.functional --test='test_52_articles_views.py'\n\n# All\ninvoke test.functional\n```\n\n\n## I18n\nExtract messages\n```\ninvoke i18n.extract i18n.update\n```\n\nCompile catalogs and update JSON files\n```\ninvoke i18n.generate\n```\n\nCreate new language\n```\ninvoke i18n.init {locale_name}\n```\n\n\n## Installation\n\n```\npip install pyramid-helpers\n\n# And optionally:\nphelpers-init-db conf/application.ini\n```\n\n\n## Files list\n\n```\n.\n\u251c\u2500\u2500 .coveragerc Coverage configuration file\n\u251c\u2500\u2500 .eslintrc.json ESLint configuration file\n\u251c\u2500\u2500 babel.cfg Babel configuration file (i18n)\n\u251c\u2500\u2500 CHANGES.md\n\u251c\u2500\u2500 pylintrc Pylint configuration file\n\u251c\u2500\u2500 pyproject.toml Poetry configuration file\n\u251c\u2500\u2500 README.md This file\n\u251c\u2500\u2500 setup.cfg\n\u251c\u2500\u2500 conf\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 application.ini main configuration file\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 auth.ini authentication configuration\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ldap.ini LDAP configuration file (auth)\n\u2502 \u2514\u2500\u2500 radius.ini RADIUS configuration file (auth)\n\u251c\u2500\u2500 pyramid_helpers\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py initialization\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 api_doc.py API documentation helper\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 auth.py authentication helper\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ldap.py LDAP client\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 models.py SQLAlchemy model for demo app\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 paginate.py pagination class, decorator and setup\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 predicates.py custom route predicates (Enum, Numeric)\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 radius.py RADIUS client\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 resources.py basic resource file for demo app\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 forms\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py form class, decorator and setup, largely inspired from formhelpers[1]\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 articles.py formencode schemas for articles for demo app\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 auth.py formencode schema for authentication for demo app\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 validators.py various formencode validators\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 funcs\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 articles.py functions for articles management\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 i18n.py i18n setup and helpers\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 locale\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 fr\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 LC_MESSAGES\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 pyramid-helpers.po\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 pyramid-helpers.pot\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 scripts\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 initializedb.py script for database initialization\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 static\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 css\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 api-doc-bs3.css javascript code for API documentation (Bootstrap 3)\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 api-doc-bs4.css javascript code for API documentation (Bootstrap 4)\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 api-doc-bs5.css javascript code for API documentation (Bootstrap 5)\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 pyramid-helpers.css stylesheet for demo app\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 js\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u00a0\u00a0 \u251c\u2500\u2500 api-doc.js javascript code for API documentation\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u00a0\u00a0 \u2514\u2500\u2500 pyramid-helpers.js javascript code for demo app\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 templates Mako templates\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 articles Mako templates for demo app\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 edit.mako\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 index.mako\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 view.mako\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 confirm.mako\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 errors.mako\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 form-tags.mako Mako template for forms rendering - derivates from formhelpers[1]\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 login.mako\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 paginate.mako Mako template for pagination rendering\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 site.mako Main template for demo app\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 validators.mako Mako template to test validators\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 views views for demo app\n\u2502\u00a0\u00a0 \u00a0\u00a0 \u251c\u2500\u2500 api\n\u2502\u00a0\u00a0 \u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 articles.py\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 articles.py\n\u251c\u2500\u2500 tasks Invoke tasks\n\u2502 \u00a0 \u251c\u2500\u2500 __init__.py initialization\n\u2502 \u00a0 \u251c\u2500\u2500 common.py common file\n\u2502 \u00a0 \u251c\u2500\u2500 i18n.py i18n tasks\n\u2502 \u00a0 \u251c\u2500\u2500 service.py service tasks\n\u2502 \u00a0 \u2514\u2500\u2500 test.py test tasks\n\u2514\u2500\u2500 tests functional tests (pytest)\n \u251c\u2500\u2500 conftest.py configuration file for pytest\n \u251c\u2500\u2500 test_01_validators.py test functions for forms validators\n \u251c\u2500\u2500 test_02_forms.py test functions for forms\n \u251c\u2500\u2500 test_03_utils.py test functions for utilities\n \u251c\u2500\u2500 test_04_sql_utils.py test functions for SQL utilities\n \u251c\u2500\u2500 test_10_auth_client.py test functions for authentication\n \u251c\u2500\u2500 test_11_ldap_client.py test functions for LDAP client\n \u251c\u2500\u2500 test_12_radius_client.py test functions for radius client\n \u251c\u2500\u2500 test_50_common_views.py test functions for common views\n \u251c\u2500\u2500 test_51_api_views.py test functions for articles API\n \u2514\u2500\u2500 test_52_articles_views.py test functions for articles views\n```\n\n\n## Useful documentation\n\n* https://docs.pylonsproject.org/projects/pyramid/en/latest/\n* https://docs.pylonsproject.org/projects/pyramid/en/latest/#api-documentation\n* https://techspot.zzzeek.org/2008/07/01/better-form-generation-with-mako-and-pylons/\n",
"bugtrack_url": null,
"license": "AGPL-3.0-or-later",
"summary": "Helpers to develop Pyramid applications",
"version": "2.0.0",
"project_urls": {
"Homepage": "https://gitlab.com/yack/pyramid-helpers",
"Repository": "https://gitlab.com/yack/pyramid-helpers"
},
"split_keywords": [
"web",
" wsgi",
" pylons",
" pyramid",
" helpers"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "daf484209ebe59dd33d942e8366ceb2604fb1319128acabf9ff2d032072eb3e5",
"md5": "9b5f434a7c29d9832a7bca92138baccd",
"sha256": "db8ac69b1b597ec10089c57319ec0d7bfb32b351a89c95e2bf734ff42896d6bc"
},
"downloads": -1,
"filename": "pyramid_helpers-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9b5f434a7c29d9832a7bca92138baccd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 124598,
"upload_time": "2024-12-13T08:07:55",
"upload_time_iso_8601": "2024-12-13T08:07:55.770566Z",
"url": "https://files.pythonhosted.org/packages/da/f4/84209ebe59dd33d942e8366ceb2604fb1319128acabf9ff2d032072eb3e5/pyramid_helpers-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d647deb85515aacabe4b0e54e7e19813d528ef0e03c8e8e7d067953b23f6af9b",
"md5": "3cc819f75fd2fb350a6cf3ef8f5b19c7",
"sha256": "874706fedf1a5c48f05b468e63fb0b776237651325bd79a07e43a1e4d97347d9"
},
"downloads": -1,
"filename": "pyramid_helpers-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "3cc819f75fd2fb350a6cf3ef8f5b19c7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 85603,
"upload_time": "2024-12-13T08:07:58",
"upload_time_iso_8601": "2024-12-13T08:07:58.826111Z",
"url": "https://files.pythonhosted.org/packages/d6/47/deb85515aacabe4b0e54e7e19813d528ef0e03c8e8e7d067953b23f6af9b/pyramid_helpers-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-13 08:07:58",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "yack",
"gitlab_project": "pyramid-helpers",
"lcname": "pyramid-helpers"
}