Giter VIP home page Giter VIP logo

python-resources's Introduction

python-resources

Python Resources

Why it's always a good idea to pin your Python packages

https://nvie.com/posts/pin-your-packages/

IDEs

Pycharm

Plug-ins and Other Nifty Tools

jedi-vim
botostubs

Tutorials

Learn Python with Socratica (YouTube)
The Python Tutorial
Real Python Tutorial
The Hitchhiker's Guide to Python

Cheatsheets

Pythonsheeets

Pycharm Tips

Change code font size using Mouse wheel

cntl + alt + s : General --> Change font size (Zoom) with Ctrl+Mouse Wheel <br>

Use Interactive Python

Tools --> Python console <br>

Managing Python Dependicies

Python Application Dependency Management in 2018

https://hynek.me/articles/python-app-deps-2018/

Virtual Environments

Useful commands

python3 -m venv ./venv    (invoked within a project directory)
source venv/bin/activate  (activates virtual environment)
deactivate                (leaves virtual environment)
rm -rf venv               (destroys virtual environment)

Why you should use virtual environments

Virtual environments:
  - keep your project dependencies isolated
  - help you avoid version conflicts between packages and different version of the Python runtime

As a best practice:
  - use virtual environments for all of your Python projects in order to store their dependencies
  - and be mindful of what packages you install in a non-virtual environment as such package installs
    will go into the global environment

Creating a virtual environment

Python 3.3+
$ mkdir foobar
$ cd foobar
$ python3 -m venv venv
$ source venv/bin/activate

Python 2.x
$ pip install virtualenv
$ virtualenv venv
$ source venv/bin/activate

Windows
C:\> python -m venv venv
C:\> venv\Scripts\activate

Useful pip commands

pip3 --version
pip3 --help
pip3 list [--outdated]
pip3 install [name]
pip3 show [name]
pip3 freeze > requirements.txt   (captures all dependencies, including secondary dependencies and their exact version numbers)
pip3 install -r requirements.txt
pip-comipile & pip-sync

Installing pip

Linux (Debian/Ubuntu)
$ sudo apt update
$ sudp apt install python-pip

macOS & Windows
Download https://bootstrap.pypa.io/get-pip.py
$ python get-pip.py

Python Packaging

Click here

Updating pip to the latest version

Linux (Debian/Ubuntu)
$ sudo apt update && sudo apt upgrade python-pip

macOS
$ sudo pip3 install --upgrade pip setuptools

Windows:
C:\>pip3 install --upgrade pip setuptools

Searching for packages on PyPI

Option 1 (Preferred): PyPI website -> pypi.python.org
Option 2 $ pip3 search [name] 

Installing packages with pip

$ pip3 install [name]

Installing packages with version specifiers

Examples:
  $ pip3 install requests==2.1.4 (specific version)
  $ pip3 install requests>=2,<3  (latest 2.x.x version)
  $ pip3 install requests~=2.1.4 (any 2.1.X version >= 2.1.4)

Installing packages from Git (and other sources)

$ pip3 install git+https://github.com/user/repo.git@branch

More examples:
  - $ pip3 install git+https://github.com/davidclin/cloudcustodian-policies.git@master   (install from branch)
  - $ pip3 install git+https://github.com/davidclin/cloudcustodian-policies.git@3adef5ca (install from hash)
  - $ pip3 install git+https://github.com/davidclin/[email protected]  (install from tag/release)

Note: Handle with care as installing using this approach is typically for accessing the "cutting edge" packages that may still be in   
      development. If possible, try and install packages from PyPI. 

Identifying & Updating Outdated Packages

$ pip3 list --outdated
$ pip3 install --upgrade [name]

Uninstalling packages

$ pip3 uninstall [name] (Note: pip uninstall DOES NOT uninstall secondary dependencies)

python-resources's People

Contributors

davidclin avatar

Watchers

James Cloos 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.