GithubHelp home page GithubHelp logo

temporaer / autoupgrade Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vuolter/autoupgrade

0.0 0.0 0.0 43 KB

Automatic upgrade of PyPI packages from within Python scripts

Home Page: https://pypi.python.org/pypi/autoupgrade-ng

License: MIT License

Python 100.00%

autoupgrade's Introduction

AutoUpgrade

[PyPI] (https://pypi.python.org/pypi/autoupgrade-ng) [GitHub issues] (https://github.com/vuolter/autoupgrade/issues) [PyPI] (https://pypi.python.org/pypi/autoupgrade-ng) [PyPI] (https://pypi.python.org/pypi/autoupgrade-ng) [PyPI] (https://pypi.python.org/pypi/autoupgrade-ng) [PyPI] (https://pypi.python.org/pypi/autoupgrade-ng) [PyPI] (https://pypi.python.org/pypi/autoupgrade-ng) [Twitter] (https://twitter.com/intent/tweet?text=Wow:&url=%5Bobject%20Object%5D)

Automatic upgrade of PyPI packages.

Table of contents

Quick Start

from autoupgrade import Package
Package(<packagename>).smartupgrade()

Example:

from autoupgrade import Package
Package('pip').smartupgrade()

The above will upgrade the Python package pip only if there is a new version available on the PyPI. The upgrade will be unattended and the python script will be restarted.

Old methods are still supported; you can accomplish the same task calling:

from autoupgrade import AutoUpgrade
AutoUpgrade('pip').upgrade_if_needed()

Installation

pip install autoupgrade-ng

All the modules will be installed under the autoupgrade package, so make sure you have already removed the old [AutoUpgrade package] (https://pypi.python.org/pypi/autoupgrade) before install this to avoid an installation conflict.

Usage

Classes

class Package(__builtin__.object)

Decription: Basic package class, holds one package.

class AutoUpgrade(__builtin__.object)

Decription: Legacy class refering to Package one.

Methods

__init__(self, pkg, index=None, verbose=False)

Decription: None.

Arguments:

  • pkg (str) name of package.
  • index (str) alternative index, if not given default from pip will be used. Include full index url (e.g. https://example.com/simple).

Return: None.

check(self)

Decription: Check if pkg has a later version.

Arguments: None.

Return: True if later version exists, else False.

restart(self)

Decription: Restart application with same args as it was started.

Arguments: None.

Return: None.

upgrade(self, dependencies=False, prerelease=False, force=False)

Decription: Upgrade the package unconditionaly.

Arguments:

  • dependencies update dependencies if True (see pip --no-deps).
  • prerelease update to pre-release and development versions.
  • force reinstall all packages even if they are already up-to-date.

Return: None.

smartupgrade(self, restart=True, dependencies=False, prerelease=False)

Decription: Upgrade the package if there is a later version available.

Arguments:

  • restart restart app if True.
  • dependencies update dependencies if True (see pip --no-deps).
  • prerelease update to pre-release and development versions.

Return: None.

upgrade_if_needed(self, restart=True, dependencies=False, prerelease=False)

Decription: Legacy method refering to smartupgrade one.

Arguments: Same as smartupgrade.

Return: Same as smartupgrade.

Licensing

Please refer to the included LICENSE for the extended license.


© 2017 Walter Purcaro

autoupgrade's People

Contributors

jorgen-k avatar vuolter avatar

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.