Code Monkey home page Code Monkey logo

pkgu's Introduction

pkgu

Find the out-dated packages installed by the Pip tool and update them. Inspired by πŸ‘‰depu(Go). However, pkgu supports full and partial updates, which is more convenient and flexible. It also supports cross-platform(Windows, linux, macos). πŸ€“ To retrieve the data more fast after the first-time(Or don't have to execute command again), I use sqlite as cache db to store the data and can quickly read it from db and present it to the consoleπŸ’».

πŸ‘‰ However, only python3.10 and above are available now.

Usage

  • Run code from source code

First, you need to install dependencies.

if you don't have poetry tool, please install it first. πŸ”—: poetry installation, otherwise, install packages directly.

poetry install

and then, run pkgu.py script.

python3 pkgu.py
  • Use it through pip - Highly Recommended
pip3 install pkgu

after the installation is complete, pkgu executable file will be written to the python bin directory and you can enter pkgu -h command on your terminal to learn how to use it.

# Usage
usage: pkgu [-h] [-v] {update,remove} ...

Upgrade and uninstall python package.

options:
  -h, --help       show this help message and exit
  -v, --version    Display pkgu version and information

Available commands:
  {update,remove}  Available commands
    update         Update python package.
    remove         remove python package with its dependencies.

# ------ update ------
options:
  -h, --help            show this help message and exit
  -a, --async_upgrade   Update the library asynchronously. Default: False
  -d CACHE_FOLDER, --cache_folder CACHE_FOLDER
                        The cache.db file. Default: ~/.cache/cache.db
  -e EXPIRE_TIME, --expire_time EXPIRE_TIME
                        The expiration time. Default: 43200
  --no-cache            Whether to use db cache. Default: False

# ------ remove ------
options:
  -h, --help    show this help message and exit
  -l, --list    list unused dependencies, but don't uninstall them.
  -L, --leaves  list leaves (packages which are not used by any others).
  -y, --yes     don't ask for confirmation of uninstall deletions.
  -f, --freeze  list leaves (packages which are not used by any others) in requirements.txt format

ScreenShoot

  1. No packages need to be upgraded.

img.png

  1. Upgrade some expired packages.

img_4.png img_2.png img_3.png

  1. Update the pkg synchronously

img_1.png

  1. Update the pkg asynchronously

img_5.png

We can see that the async method is faster than sync method about 9 seconds(Only in this test situation). So now it can support to update the python libraries asynchronously. πŸ₯³

  1. Support for selectable update packages
  • List all availbable packages

img_6.png

  • Select ths part of package to be updated

img_7.png

  1. Support to use cache result from sqlite db file.

This improve the expirence that how we list the out-dated packages when they are huge to collect, and then there also is a cli flag --no-cache to control whether should to use cache.

  1. !!!New - Support to uninstall package with its dependencies together.

img_8.png

pkgu's People

Contributors

abeautifulsnow avatar

Stargazers

 avatar  avatar

Watchers

 avatar

pkgu's Issues

pkgu cann't be used on windows platform

Desktop (please complete the following information):

  • OS: Windows

Additional context

Traceback (most recent call last):
  File "C:\personal_folder\software\Python\Python311\Lib\site-packages\simple_term_menu.py", line 37, in <module>
    import termios
ModuleNotFoundError: No module named 'termios'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\personal_folder\software\Python\Python311\Scripts\pkgu.exe\__main__.py", line 4, in <module>
  File "C:\personal_folder\software\Python\Python311\Lib\site-packages\pkgu.py", line 26, in <module>
    from simple_term_menu import TerminalMenu
  File "C:\personal_folder\software\Python\Python311\Lib\site-packages\simple_term_menu.py", line 39, in <module>
    raise NotImplementedError('"{}" is currently not supported.'.format(platform.system())) from e
NotImplementedError: "Windows" is currently not supported.

Bugs

  1. Use python executable path as cache key
  2. Specify the python executable path explicitly.

Bug: There is a prompt to continue updating when there is no expired package.

Describe the bug

There is a prompt to continue updating when there is no expired package.

To Reproduce

Execute the pkgu command when there is no expired package.

Expected behavior

There should not be a prompt to continue updating when there is no expired package.

Screenshots
image

Desktop (please complete the following information):

  • OS: MacOS 12.6

[Feature]: Add new awesome features[Keep updating]

List the features you want to be supported

  • Support to select one/all out-dated package(s) to upgrade
  • Cache the result to improve the experience, and set expiration time to clear the cache automatically. [Sqlite3]
    • remove the sqlite old db record after do some updates 4e290aa
  • Add new cli command to not use cache mechanism, such as --no-cache. Cache mech is enabled by default.
  • Add support for windows(#10 )
  • Add support for uninstalling package and its dependencies. Based on pip-autoremove

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.