mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Modernize packaging
Switch to pyproject.toml packaging, using hatchling. - Replace all uses of setup.py with updated equivalent - BREAKING: Change extra name `amazon_ses` to `amazon-ses`, to comply with Python packaging name normalization - Use hatch custom build hook to freeze version number in readme (previously custom setup.py code) - Move separate requirements for dev, docs, tests into their own requirements.txt files - Fix AnymailImproperlyInstalled to correctly refer to package extra name - Update testing documentation - Update docs readme rendering to match PyPI (and avoid setup.py) - In tox tests, use isolated builds and update pip - Remove AUTHORS.txt (it just referred to GitHub)
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
# Expose package version at root of package
|
||||
from django import VERSION as DJANGO_VERSION
|
||||
from ._version import VERSION, __version__
|
||||
|
||||
from ._version import VERSION, __version__ # NOQA: F401
|
||||
__all__ = [
|
||||
"VERSION",
|
||||
"__version__",
|
||||
]
|
||||
|
||||
if DJANGO_VERSION < (3, 2, 0):
|
||||
default_app_config = "anymail.apps.AnymailBaseConfig"
|
||||
try:
|
||||
import django
|
||||
except ImportError:
|
||||
# (don't require django just to get package version)
|
||||
pass
|
||||
else:
|
||||
if django.VERSION < (3, 2, 0):
|
||||
# (No longer required -- and causes deprecation warning -- in Django 3.2+)
|
||||
default_app_config = "anymail.apps.AnymailBaseConfig"
|
||||
__all__.append("default_app_config")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
VERSION = (9, 2)
|
||||
# Don't import this file directly (unless you are a build system).
|
||||
# Instead, load version info from the package root.
|
||||
|
||||
#: major.minor.patch or major.minor.devN
|
||||
__version__ = ".".join([str(x) for x in VERSION])
|
||||
__version__ = "10.0.dev0"
|
||||
|
||||
#: Sphinx's X.Y "version"
|
||||
__minor_version__ = ".".join([str(x) for x in VERSION[:2]])
|
||||
VERSION = __version__.split(",")
|
||||
|
||||
@@ -13,7 +13,7 @@ try:
|
||||
from botocore.exceptions import BotoCoreError, ClientError, ConnectionError
|
||||
except ImportError as err:
|
||||
raise AnymailImproperlyInstalled(
|
||||
missing_package="boto3", backend="amazon_ses"
|
||||
missing_package="boto3", install_extra="amazon-ses"
|
||||
) from err
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ try:
|
||||
from botocore.exceptions import BotoCoreError, ClientError, ConnectionError
|
||||
except ImportError as err:
|
||||
raise AnymailImproperlyInstalled(
|
||||
missing_package="boto3", backend="amazon_sesv2"
|
||||
missing_package="boto3", install_extra="amazon-ses"
|
||||
) from err
|
||||
|
||||
|
||||
|
||||
@@ -171,11 +171,13 @@ class AnymailConfigurationError(ImproperlyConfigured):
|
||||
class AnymailImproperlyInstalled(AnymailConfigurationError, ImportError):
|
||||
"""Exception for Anymail missing package dependencies"""
|
||||
|
||||
def __init__(self, missing_package, backend="<backend>"):
|
||||
def __init__(self, missing_package, install_extra="<esp>"):
|
||||
# install_extra must be the package "optional extras name" for the ESP
|
||||
# (not the backend's esp_name)
|
||||
message = (
|
||||
"The %s package is required to use this ESP, but isn't installed.\n"
|
||||
"(Be sure to use `pip install django-anymail[%s]` "
|
||||
"with your desired ESPs.)" % (missing_package, backend)
|
||||
'(Be sure to use `pip install "django-anymail[%s]"` '
|
||||
"with your desired ESP name(s).)" % (missing_package, install_extra)
|
||||
)
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ except ImportError:
|
||||
# This module gets imported by anymail.urls, so don't complain about boto3 missing
|
||||
# unless one of the Amazon SES webhook views is actually used and needs it
|
||||
boto3 = _LazyError(
|
||||
AnymailImproperlyInstalled(missing_package="boto3", backend="amazon_ses")
|
||||
AnymailImproperlyInstalled(missing_package="boto3", install_extra="amazon-ses")
|
||||
)
|
||||
ClientError = object
|
||||
_get_anymail_boto3_params = _LazyError(
|
||||
AnymailImproperlyInstalled(missing_package="boto3", backend="amazon_ses")
|
||||
AnymailImproperlyInstalled(missing_package="boto3", install_extra="amazon-ses")
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,9 @@ except ImportError:
|
||||
# This module gets imported by anymail.urls, so don't complain about cryptography
|
||||
# missing unless one of the Postal webhook views is actually used and needs it
|
||||
error = _LazyError(
|
||||
AnymailImproperlyInstalled(missing_package="cryptography", backend="postal")
|
||||
AnymailImproperlyInstalled(
|
||||
missing_package="cryptography", install_extra="postal"
|
||||
)
|
||||
)
|
||||
serialization = error
|
||||
hashes = error
|
||||
|
||||
Reference in New Issue
Block a user