ExtensionsΒΆ

Available ExtensionsΒΆ

pyApp DevelopedΒΆ

πŸ”Œ SQLAlchemy - pyapp.sqlalchemy

πŸ”Œ Redis - pyapp.redis

In BetaΒΆ

πŸ› Rollbar - pyapp.rollbar

πŸ“§ AIO SMTPlib - pyapp.aiosmtplib Extension for aiosmtplib

☁ Boto3 - pyapp.boto3

☁ AIOBotocore - pyapp.aiobotocore

πŸ“¨ Messaging - pyapp.messaging - Extension to provide abstract interfaces for Message Queues.

In developmentΒΆ

πŸ“§ SMTP - pyapp.SMTP

πŸ“¨ Aio-Pika - pyapp.aiopika - Messaging extension for pika (RabbitMQ/AMQP)

πŸ”Œ PySpark - pyapp.pyspark - Extension for PySpark

πŸ”Ž Elastic Search - pyapp.elasticsearch - Extension for Elasticsearch

Coming soonΒΆ

πŸ“¨ AMQP Messaging - Messaging extension for AMQP (RabbitMQ)

Note

The development status of these projects may have changed from when this documentation was generated, see the repository (or PyPi) of the extension package for up to date status.

Developing an ExtensionΒΆ

An extension is a standard Python package that exports a known entry point that pyApp uses to identify extensions. This entry point will reference a class with known attributes that pyApp recognises.

A Basic ProjectΒΆ

An extensions consists of a standard Python project structure eg:

β”œβ”¬ my_extension
β”‚β”” __init__.py
β”œ README.rst
β”œ pyproject.toml
β”œ setup.cfg
β”” setup.py

The contents of which are:

my_extension/__init__.py

The package init file, this file contains the extension entry point. While a package must container an Extension class every attribute on the class is optional.

class Extension:
    """
    My pyApp Extension
    """

    default_settings = ".default_settings"
    checks = ".checks"

    @staticmethod
    def register_commands(root):
        """
        Register custom commands with pyApp.
        """

    @staticmethod
    def ready():
        """
        Method called once pyApp has configured environment
        """

Tip

A gotcha when building extensions is attempting to access settings to early this is the reason for the ready event on the Extension class. Once ready has been called settings are setup and ready for use.

README.rst

While not strictly necessary a README document is highly recommended and is included in the package as the long description.

##################
My pyApp Extension
##################

Information about my extension

Using SetuptoolsΒΆ

setup.cfg

Defines the metadata and configuration used to build a package, this is also where the entry point used identify you extension is defined.

[metadata]
name = my-extension
version = "0.1"
author = Author
author-email = author@example.com
description = Blurb about my extension
long-description = file: README.rst
url = https://github.com/author/my-extension
platforms = any
license = BSD-3-Clause

[options]
python_requires = >=3.6
packages = find:
setup_requires =
    setuptools >=38.3
install_requires =
    pyapp >=4.3.0

[options.entry_points]
# Used by pyApp to recognise my_extension
pyapp.extensions =
    my-extension = my_extension:Extension
setup.py

Script that trigger setuptools to build a package.

import setuptools

setuptools.setup()

Using poetryΒΆ

pyproject.toml

Defines the metadata and configuration used to build a package, this is also where the entry point used identify you extension is defined.

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

[tool.poetry]
name = "my-extension"
version = "0.1"
description = "Blurb about my extension"
authors = ["Author <author@example.com>"]
license = "BSD-3-Clause"
packages = [
    { include = "my_extension" },
]
readme = "README.rst"
repository = "https://github.com/author/my-extension"

[tool.poetry.dependencies]
python = "^3.6"
pyapp = "^4.3.0"

[tool.poetry.dev-dependencies]
pytest = "^5.4.3"
pytest-cov = "^2.10.0"

[tool.poetry.plugins."pyapp.extensions"]
"my-extension" = "my_extension:Extension"