Skip to content
/ upreq Public

a small helper cli for python's requirements.txt

Notifications You must be signed in to change notification settings

robswc/upreq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

upreq-logo(1)

Why? Because...

len(pip freeze > requirements.txt) > len(upreq)

twitter

Upreq

Upreq is a simple CLI tool that provides shortcuts and feedback for updating your Python project's requirements.txt file. It's written in Go and uses Cobra as the CLI framework. It started as a bash script, after I found myself typing pip freeze > etc one too many times and well, here we are.

Features

  • Comparing your requirements.txt file to your current environment
  • Reduces carpel tunnel by turning pip freeze > requirements.txt into upreq
  • Provides feedback on what packages were added/removed
  • Flag for automatically adding new requirements to git

Installation

Since Upreq is a binary executable, you can download the latest release from the releases page and copy it to your PATH. Below is an example of how to do this on each major OS.

Linux

curl -s https://api.github.com/repos/robswc/upreq/releases/latest | grep "browser_download_url.*upreq-linux" | cut -d : -f 2,3 | tr -d \" | wget -qi -
chmod +x upreq-linux
sudo mv upreq-linux /usr/local/bin/upreq

MacOs

curl -s https://api.github.com/repos/robswc/upreq/releases/latest | grep "browser_download_url.*upreq-darwin" | cut -d : -f 2,3 | tr -d \" | wget -qi -
chmod +x upreq-darwin
sudo mv upreq-darwin /usr/local/bin/upreq

Windows (powershell)

Invoke-WebRequest -Uri
"
https://api.github.com/repos/robswc/upreq/releases/latest
" | Select-Object -ExpandProperty content | ConvertFrom-Json | Select-Object -ExpandProperty assets | Select-Object -ExpandProperty browser_download_url | Select-String -Pattern "upreq-windows" | Invoke-WebRequest -OutFile upreq-windows.exe
mkdir "C:\Program Files\upreq"
mv .\upreq-windows.exe "C:\Program Files\upreq\upreq.exe"
$env:Path += ";C:\Program Files\upreq"

Usage

Usage is pretty simple. Just run upreq in your project's root directory.

Note: Be sure to activate your virtual environment before running.

Running just upreq will run pip freeze and compare it to your current requirements.txt file. If there are any differences, it will print them out with a + or - to indicate if it was added or removed. Finally, it will write any new requirements to your requirements.txt file.

Basic Usage

upreq

Advanced Usage

upreq --git  # Automatically add new requirements to git

Help

upreq --help