seporaitis / pip-lock

Check for differences between requirements.txt files and your environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pip-lock

image

image

Check for differences between requirements.txt files and your environment.

At YPlan, we automatically call check_requirements() during development and testing to provide developers instant feedback if their environment is out of sync with the current requirements.txt. This ensures that developers do not experience unexpected behaviour or errors related to out of sync requirements.

Installation

Install with pip:

Example usage

At YPlan, we call check_requirements() within our Django manage.py which checks the requirements every time Django starts or tests are run. We recommend checking the environment to ensure it is not run in a production environment, to avoid slowing down application startup.

API

check_requirements(requirements_file_path, post_text='')

Exit with exit code 1 and output to stderr if there are mismatches between the environment and requirements file.

requirements_file_path is the path to the requirements.txt file - we recommend using an absolute file path.

post_text is optional text which is displayed after the stderr message. This can be used to display instructions on how to update the requirements.

Example:

get_mismatches(requirements_file_path, post_text='')

Return a dictionary of package names to tuples of (expected_version, actual_version) for mismatched packages.

requirements_file_path is the path to the requirements.txt file - we recommend using an absolute file path.

Example:

About

Check for differences between requirements.txt files and your environment

License:ISC License


Languages

Language:Python 100.0%