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:
Mike Edmunds
2023-05-03 16:55:08 -07:00
committed by GitHub
parent 9fba58237d
commit e8df0ec8e0
31 changed files with 418 additions and 292 deletions

View File

@@ -38,6 +38,20 @@ tests regularly. That requires the ESP have a free tier (testing is
extremely low volume), a sandbox API, or that they offer developer
accounts for open source projects like Anymail.
## Boilerplate
You should add entries for your ESP in:
- pyproject.toml:
- in the `[project]` metadata section under `description` and `keywords`
- in the `[project.optional-dependencies]` section
- integration-test.yml in the test matrix
- tox.ini in the `[testenv]` section under `setenv`
- if your ESP requires any extra dependencies, also update the tox.ini
`[testenv] extras` and the "partial installation" at the bottom of
`[tox] envlist`
- README.rst in the list of ESPs
## EmailBackend and payload
Anymail abstracts a lot of common functionality into its base classes;
@@ -99,9 +113,6 @@ Need to parse JSON in the API response? Use `self.deserialize_json_response()`
Good starting points: Test backend; SparkPost
Don't forget add an `'extras_require'` entry for your ESP in setup.py.
Also update `'tests_require'`.
If the client lib supports the notion of a reusable API "connection"
(or session), you should override `open()` and `close()` to provide
API state caching. See the notes in the base implementation.