Skip to main content

Simple utility to parse PyPI packages and send notifications

Project description

PyPi Notifier

A script to notify you about new releases of Python packages via Discord webhooks. The script checks for updates on the specified packages at regular intervals, stores the information in a SQLite database, and sends notifications when a new version is released.

Upon initial launch, no notifications will be sent until a new update is detected.

Supported Notification Clients:

  • Discord

Prerequisites

  • Python 3.10 or higher
  • Docker (if using Docker setup)

Setup

Options for Use

  • Docker
  • Package

Running the Script as a Package

  1. Install the package

    poetry add pypi-notifier
    # or
    pip install pypi-notifier
    
  2. Use in your Python code

    from pypi_notifier import PyPiNotifier
    notifier = PyPiNotifier(
         discord_webhook="https://discord.com/api/webhooks/...",
         tracked_packages={
             "PySide6": "https://pypi.org/rss/project/PySide6/releases.xml",
             "TkFontSelector": "https://pypi.org/rss/project/tkfontselector/releases.xml",
         },
         cron_schedule="0 * * * *",  # Cron schedule format for checking updates every hour
    )
    
    # Run the notifier once
    notifier.run()
    
    # Or run continuously as scheduled by cron
    notifier.run_forever()
    

Running the Docker Container

To run the Docker container with the appropriate environment variables, use the following command:

docker run -e "DISCORD_WEBHOOK=<your_webhook_url>" -e "TRACKED_PACKAGES=<your_tracked_packages_json>" -e "CRON_SCHEDULE=0 * * * *" -v "app_data:/app_data"
  • Replace <your_webhook_url> with your Discord webhook URL.
  • Replace <your_tracked_packages_json> with the JSON string of your tracked packages, for example:
{
  "PySide6": "https://pypi.org/rss/project/PySide6/releases.xml",
  "TkFontSelector": "https://pypi.org/rss/project/tkfontselector/releases.xml"
}

This command will mount the app_data volume to persist the database and logs across container restarts.

Checking Logs

Outside of Docker, you can view the logs in ./app_data/logs/.

Notes

  • The app_data volume is used for persistent storage, including the SQLite database and logs.
  • If you're running the script outside Docker, the app_data folder will be created in your local directory to store logs and the database.
  • The cron_schedule format follows standard cron syntax for scheduling tasks. For example, 0 * * * * runs the script every hour.
  • If no updates are detected for a package, no notifications will be sent until a newer version is found.

Troubleshooting

  • Error Logs: If something goes wrong, check the logs at ./app_data/logs/ for more details.
  • Database Issues: Ensure that the SQLite database is properly initialized and accessible.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypi_notifier-0.1.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypi_notifier-0.1.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file pypi_notifier-0.1.1.tar.gz.

File metadata

  • Download URL: pypi_notifier-0.1.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Windows/10

File hashes

Hashes for pypi_notifier-0.1.1.tar.gz
Algorithm Hash digest
SHA256 29a0710bd8f119d6ec3a27b3247a11810bf9bb78349e5c98e491ed39c8cf47ce
MD5 bc8934283b342940b7fc67d9868a6477
BLAKE2b-256 3fa3e900fbf9730879114200ab911d2af5067dc37502187d803d53dac5bddfe2

See more details on using hashes here.

File details

Details for the file pypi_notifier-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pypi_notifier-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Windows/10

File hashes

Hashes for pypi_notifier-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 04587c1a97ab5e9fe5d012268228119ced1d344b4400b4cc5048dca27567af03
MD5 f3be6b32bedb244e9ec4389feddee6c1
BLAKE2b-256 7822ba5b4d22e8451af259880f360c6580c0912552f07231086d416b25844c43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page