Skip to content

TheGittyPerson/PyPacks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPacks

A simple Python helper that automatically installs third-party dependencies using pip.

By Morpheus

How to use

Install from a requirements file

At the top of your file, insert the following:

import pypacks

pypacks.install_requirements()

Make sure you place this code before the third-party import statements. By default, install_requirements() reads from requirements.txt in the current working directory.

You can also point at a different file:

import pypacks

pypacks.install_requirements("deps/prod.txt")

Install specific packages in code

Use install() when you want to declare dependencies directly in code:

import pypacks

pypacks.install(
    "requests>=2.31.0",
    "rich==13.7.0",
)

You can also pass a (name, specifier) pair:

import pypacks

pypacks.install(
    ("requests", ">=2.31.0"),
    ("rich", "13.7.0"),
)

install() accepts any number of packages. Each package can be a string specifier (like requests>=2.31.0) or a two-item iterable where the first value is the package name and the second value is the version specifier.

Optional behavior

Both install() and install_requirements() accept:

  • check_updates: When True (default), upgrade packages if a newer version is available and allowed by the specifier.
  • update_pip: When True (default), upgrade pip before the first install.

Example:

import pypacks

pypacks.install_requirements(check_updates=False, update_pip=False)

About

A simple Python script that automatically installs third-party dependencies using pip.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages