Skip to main content

pre-commit hook to keep requirements.txt updated

Project description

pre-commit-poetry-export

pre-commit hook to keep requirements.txt updated

Why?

Your life is easier and the build is faster if you use requirements.txt file to install dependencies inside a docker image. But, it's not hard to forget to update the requirements file using poetry export and remember only when CI can't build the image.

How it Works

In every commit this hook runs the following steps:

  • If requirements.txt doesn't exist

    • It will be created and hook fails
  • If requirements.txt exists

    • The hook will copy it's content to a file named old.requirements.txt
    • Then it will generate another requirements.txt using poetry export and compare the content of the two files
    • If they match you're good to go, if not the hook fails with 'requirements updated' message

If the hook has updated or created your requirements file, you can now git add requirements.txt and finish your commit.

Found any issues or want to suggest an improvement in the code? Please contribute, open an issue /here

Thanks! :)

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

pre-commit-poetry-export-0.1.2.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

pre_commit_poetry_export-0.1.2-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

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