mq_email_notifier
Introduction
A set of utilities that provides standard methods to place messages that on a queue that have data to be emailed.
Technology Stack
Language
Python
Development Operations
Docker Compose
Configuration
This package reads configuration values from environment variables.
Installation
$ pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/lts-mqemailnotifier
$ python
>>> from mqresources import mqutils
>>> mqutils.notify_email_message("My Subject", "My Text Body", email@domain.com)
Local Development Environment Setup Instructions
1: Clone the repository to a local directory
git clone git@github.huit.harvard.edu:harvard-lts/mq_email_notifier.git
2: Create app config
Create config file for environment variables
- Make a copy of the config example file
./env-example.txt - Rename the file to
.env - Replace placeholder values as necessary
Note: The config file .env is specifically excluded in .gitignore and .dockerignore, since it contains credentials it should NOT ever be committed to any repository.
3: Start
START
To build the image without the cache, run the build command with the --no-cache option. The no cache option is required when updating any dependencies.
docker-compose -f docker-compose-local.yml up -d --build --force-recreate
4: Open a shell in the container
Run docker exec to execute a shell in the container by name
Open a shell using the exec command to access the 'email_notifier container.
docker exec -it email_notifier bash
5: Run tests
pytest
6: Install dependencies
This step is only required if additional python dependencies must be installed. Update the requirements.txt inside the container to install new python packages in the project. If the dependencies are required for the package to run, they also must be included in the install_requires section of setup.py.
Install a new pip package
Once inside the mps-mqutils container, run the pip install command to install a new package and update the requirements text file.
pip install packagename && pip freeze > requirements.txt
Add dependencies to setup
Add the names of the dependencies to the install_requires section of setup.py. Read more about adding dependencies in this article Specifying dependencies.
7: Build and publish the package
Step 7A: Prepare the distribution
- Update the version number in
setup.py - To publish a pre-release version, add a letter and a number after the version number e.g.
0.0.1a1 - Remove the old
dist/directory from the previous build if necessary
Step 7B: Build the distribution
Once inside the container, build the distribution.
python3 setup.py sdist bdist_wheel
A new directory dist will be created in the container.
Step 7C: Register for an account
Register for an account on the test python package repository. Enable two-factor authentication for logins. Create a token.
Step 7D: Upload package to the test repository
Publish the package to the test repository testpypi before publishing it to the production repository.
python3 -m twine upload --repository testpypi dist/*
Step 7E: Test the package
Open the package in the repository and view the version history.
https://test.pypi.org/project/lts-mqemailnotifier/1.0.0/
Read Installation in this document for instructions on how to install and test the package in another project or environment.
8: Stop
STOP AND REMOVE
This command stops and removes all containers specified in the docker-compose-local.yml configuration. This command can be used in place of the 'stop' and 'rm' commands.
docker-compose -f docker-compose-local.yml down
More information
Read the documenation for more information on building and publishing the distribution.
Metadata
Release files for lts-mqemailnotifier 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lts-mqemailnotifier-0.0.2.tar.gz | 4.4 kB | Without provenance | Details for lts-mqemailnotifier-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lts_mqemailnotifier-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for lts_mqemailnotifier-0.0.2-py3-none-any.whl |
Total release size: 8.9 kB
Release files / lts-mqemailnotifier-0.0.2.tar.gz
| Download URL | lts-mqemailnotifier-0.0.2.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
59a379b16ee004dca9247b48401eb3d0e3198f3335aac5e42b873144ada21ebe
|
|
BLAKE2b-256 checksum How to use checksums |
c284dd8822bb0049522cfb5cb71f3ed592761b28535d2089e409135c3fef24b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / lts_mqemailnotifier-0.0.2-py3-none-any.whl
| Download URL | lts_mqemailnotifier-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67a43d74439b85a97addd306521b4b1ed8d2d67a776275c0003c3d7c45ea4a0b
|
|
BLAKE2b-256 checksum How to use checksums |
6e053b4877f92c85a21224d9f67679d08c4d99598ab3cd3282c8b4359e56c5b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for lts-mqemailnotifier 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.