Skip to main content

Keep your Python dependencies fresh

Project description

PyPI Python Version

FreshDeps

FreshDeps is a Python tool designed to keep your project's dependencies up-to-date by automatically updating your requirements.txt file from requirements.in.

It integrates with GitLab to create merge requests (MRs) for dependency updates, ensuring that you always have fresh and secure dependencies in your project.

Features

  • Automatically updates Python dependencies using pip-compile.
  • Creates GitLab merge requests with updated dependencies.
  • Supports assigning MRs to specific users.
  • Prevents duplicate or conflicting MRs by checking existing ones.
  • Allows multiple open MRs if needed.

Installation

You can install FreshDeps via pip:

pip install freshdeps

Usage GitLab CI

To use FreshDeps add job and create scheduled pipeline:

stages:
 - update-dependencies

variables:
 PIP_INDEX_URL: "https://pypi.org/simple"
 GITLAB_URL: "https://gitlab.com"
 GITLAB_PROJECT_ID: $CI_PROJECT_ID
 GITLAB_PRIVATE_TOKEN: $CI_JOB_TOKEN
 GITLAB_DEFAULT_BRANCH: "main"

update_dependencies:
 stage: update-dependencies
 image: python:3.9-slim
 script:
   - pip install freshdeps pip-tools
   - fresh-deps requirements.in --output-file requirements.txt \
       --pypi-index-url=$PIP_INDEX_URL \
       --gitlab-url=$GITLAB_URL \
       --gitlab-project-id=$GITLAB_PROJECT_ID \
       --gitlab-private-token=$GITLAB_PRIVATE_TOKEN \
       --gitlab-default-branch=$GITLAB_DEFAULT_BRANCH

only:
   - schedules   # This job will only run on scheduled pipelines (you can adjust this as needed)

Command-line Arguments:

Argument Description
requirements_in Path to the input file (.in) containing unpinned requirements.
--output-file Path to output file (.txt) where pinned requirements will be written.
--pypi-index-url PyPI index URL (default: https://pypi.org/simple).
--gitlab-url The URL of your GitLab instance (default: https://gitlab.com).
--gitlab-project-id The ID of the GitLab project where MRs should be created.
--gitlab-private-token Your private token for authenticating with GitLab API.
--gitlab-assignee Username of a user who should be assigned to review the MR (optional).
--gitlab-default-branch Default branch name in your repository (default: main).
--gitlab-allow-multiple-mrs Allow multiple open merge requests at once (optional flag).

Handling Merge Requests:

  • If there are no changes detected between current and newly generated dependency files, no MR will be created.

  • If an MR already exists for similar changes, FreshDeps prevents creating duplicates unless explicitly allowed via flags.

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

freshdeps-1.0.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

freshdeps-1.0.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file freshdeps-1.0.1.tar.gz.

File metadata

  • Download URL: freshdeps-1.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for freshdeps-1.0.1.tar.gz
Algorithm Hash digest
SHA256 784972a48ba1901bcbda4b6ab155d0ccf290fb51639129a2d36a378dc94d38d5
MD5 775cb8948a7c78f94010eaf012037bf6
BLAKE2b-256 6864e4efa3e461508f3a7ef8c27e69e8114e5739b85019c0d40ee11d0fa2342c

See more details on using hashes here.

File details

Details for the file freshdeps-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: freshdeps-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for freshdeps-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e0e4dc2fb1eaabf6461be4251bcd67940ea164e29a14b90d81d8f990ecdd03e0
MD5 cd4055ddd5fe8cf37ff57e59fedd60ec
BLAKE2b-256 6a375e7f7f2b070670ae212e7b46deac7796d20508f07f2d20d938ccd4306bc3

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