command line cheatsheet for developers - BappyTechTips

Pip


Install a library
pip install <lib-name>
Install a wheel
pip install -m <wheel_name>

  • To install a package from PyPI for only yourself:
1
$ pip install --user foobar
This installs the package files to ~/.local/lib/python2.x/site-packages.
  • To uninstall a package that was installed for all users:
1
$ sudo pip uninstall foobar
  • To uninstall a package that was installed only for you:
1
$ pip uninstall --user foobar
  • To upgrade an installed package:
1
$ pip install --upgrade foobar
  • To list all installed packages and their versions:
1
$ pip list
  • To search PyPI for a package by name:
1
$ pip search foobar
  • To list the installed file paths of a package:
1
$ pip show -f foobar

To keep your file structure with commands and nicely separate your dependencies from your dependencies’ dependencies:
pip freeze -r requirements-to-freeze.txt > requirements.txt
instead of just:
pip freeze > requirements.txt

Sometimes we are asked to install microsoft build tools for installing certain libraries but I don't want since it takes a lot of space and don't require it so in that case we can use pre-built binary package of those lib.

https://www.lfd.uci.edu/~gohlke/pythonlibs/

Composer

composer
shows list of available commands
composer list
shows a list of commands available

composer init
create composer.json file
  • --name: Name of the package.
  • --description: Description of the package.
  • --author: Author name of the package.
  • --type: Type of package.
  • --homepage: Homepage of the package.
  • --require: Package to require with a version constraint. Should be in format foo/bar:1.0.0.
  • --require-dev: Development requirements, see --require.
  • --stability (-s): Value for the minimum-stability field.
  • --license (-l): License of package.
  • --repository: Provide one (or more) custom repositories. They will be stored in the generated composer.json, and used for auto-completion when prompting for the list of requires. Every repository can be either an HTTP URL pointing to a composer repository or a JSON string which similar to what the repositories key accepts.
composer require package-name
The require command adds new packages to the composer.json file from the current directory. If no file exists one will be created on the fly.
composer require
After adding/changing the requirements, the modified requirements will be installed or updated.
If you do not want to choose requirements interactively, you can pass them to the command.
composer require vendor/package:2.* vendor/package2:dev-master
If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of matches to require.

composer install
Installs all the package in composer.json

composer update
Updates the installed packages
composer remove
Remove the specified package

Post a Comment

Your feedback is welcome. Be it positive or negative. Please do not post any irrelevant comment or abuse anyway.

Previous Post Next Post