Python
General
Learning
Guides
Tutorials
Reference
Standard library
Installing
Certain packages like libsqlite3-dev and libreadline-dev need to be installed before hand.
to check
- pythonz is a program to automate the building and installation of Python in the users $HOME. This is a fork of the original project, pythonbrew.
Compiling
./configure --prefix=/opt/python2.7 --with-threads --enable-shared make; make install
Setup aliases and path.
If error while loading shared libraries: libpython2.7.so.1.0
echo "/opt/python2.7/lib" > /etc/ld.so.conf.d/libpython2.7.conf ldconfig
curl http://python-distribute.org/distribute_setup.py | python
Articles
Packages
PyPI
The Python Package Index is a repository of software for the Python programming language.
pip
- pip is a tool for installing and managing Python packages, such as those found in the Python Package Index. It’s a replacement for easy_install.
Tools
Tools
- https://github.com/prompt-toolkit/ptpython - A better Python REPL
- https://github.com/Microsoft/pyright - Static type checker for Python
- https://github.com/klen/pylama - Code audit tool for Python and JavaScript. Pylama wraps these tools: pycodestyle (formerly pep8), pydocstyle, PyFlakes, Mccabe, Pylint, Radon, gjslint
- https://github.com/shmuelamar/cbox - convert any python function to unix-style command
- https://github.com/cool-RR/pysnooper - a poor man's debugger. Never use print for debugging again . [1]
- VizTracer - a low-overhead logging/debugging/profiling tool that can trace and visualize your python code to help you intuitively understand your code and figure out the time consuming part of your code. VizTracer can display every function executed and the corresponding entry/exit time from the beginning of the program to the end, which is helpful for programmers to catch sporadic performance issues.
IDE
See also Development#IDE
- IDLE - Python’s Integrated Development and Learning Environment.
- PyCharm - provides smart code completion, code inspections, on-the-fly error highlighting and quick-fixes, along with automated code refactorings and rich navigation capabilities.
- YouTube: Python IDE - Pycharm Pros and Cons
- The Eric Python IDE - a full featured Python editor and IDE, written in Python. It is based on the cross platform Qt UI toolkit, integrating the highly flexible Scintilla editor control. It is designed to be usable as everdays' quick and dirty editor as well as being usable as a professional project management tool integrating many advanced features Python offers the professional coder. eric includes a plug-in system, which allows easy extension of the IDE functionality with plug-ins downloadable from the net.
- Spyder IDE - The Scientific PYthon Development EnviRonment is a powerful interactive development environment written in Python for Python, with advanced editing, interactive testing, debugging, introspection features and a computing environment for the desktop!
- NINJA IDE - from the recursive acronym: "Ninja-IDE Is Not Just Another IDE", is a cross-platform integrated development environment (IDE). NINJA-IDE runs on Linux/X11, Mac OS X and Windows desktop operating systems, and allows developers to create applications for several purposes using all the tools and utilities of NINJA-IDE, making the task of writing software easier and more enjoyable.
- PyDev - a Python IDE for Eclipse, which may be used in Python, Jython and IronPython development.
- PyScripter - an open-source Python Integrated Development Environment (IDE) created with the ambition to become competitive in functionality with commercial IDEs available for other languages. It is a feature-rich but also lightweight.
- Light Table - the next generation code editor
- Thonny - Python IDE for beginners
- Code With Mu - a simple Python editor for beginner programmers. [2]
- Leo's Home Page - a PIM, IDE and outliner that accelerates the work flow of programmers, authors and web designers. Outline nodes may appear in more than one place, allowing multiple organizations of data within a single outline. [3]
Project environment
virtualenv
- virtualenv is a tool to create isolated Python environments. The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.7/site-packages (or whatever your platform’s standard location is), it’s easy to end up in a situation where you unintentionally upgrade an application that shouldn’t be upgraded.
"Now, you’re ready to create your virtualenv. BUT FIRST…you have a decision to make. Do you want this virtualenv to use packages from your system site-packages on install them in the virtualenv’s site-packages? By default, virtualenv will symlink to your system’s site-packages if you install a package in the virtualenv that is already installed on your system. If you want a totally (well, as much as is possible) isolated virtualenv, you’ll want to do the latter. To do this, you pass in the -–no-site-packages switch when creating your virtualenv."
pip -E [envname] [package] install package in specific virtual environment
Or install pip seperatly in an env and use from there.
pyenv
pipx
- https://github.com/pipxproject/pipx - execute binaries from Python packages in isolated environments
Implementations
- Cython: C-Extensions for Python - an optimising static compiler for both the Python programming language and the extended Cython programming language (based on Pyrex). It makes writing C extensions for Python as easy as Python itself.
- https://github.com/pannous/angle - the Python implementation of English as a programming language. Since Angle compiles to Python bytecode, it is can be used as a drop-in-replacement for classic Python and is fully debuggable, even in PyCharm. It is currently in development to be run directly in WASM via wasp.The main purpose of this language is to facilitate programming computers via voice. Angle is the first speakable programing language and thus makes programing accessible to many more people.
Interfaces
- ctypes — A foreign function library for Python — Python 3.9.4 documentation - a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python.
Web
python -m SimpleHTTPServer start http server on port 8000 [6] python -m SimpleHTTPServer 3131 start http server on poty 3131
- https://github.com/zauberzeug/nicegui - Create UI. For the web. With Python. The nice way.
Libraries and modules
- Aaargh - an astonishingly awesome application argument helper
- sh - a full-fledged subprocess interface for Python that allows you to call any program as if it were a function
- attrs - the Python package that will bring back the joy of writing classes by relieving you from the drudgery of implementing object protocols (aka dunder methods).Its main goal is to help you to write concise and correct software without slowing down your code.
- https://github.com/pybind/pybind11 - Seamless operability between C++11 and Python
Maths
- https://github.com/pyro-ppl/funsor - Functional tensors for probabilistic programming
Serialisation
- https://github.com/martinblech/xmltodict - Python module that makes working with XML feel like you are working with JSON
Interactive
- https://github.com/python-cmd2/cmd2 - a tool for building interactive command line applications in Python. Its goal is to make it quick and easy for developers to build feature-rich and user-friendly interactive command line applications. It provides a simple API which is an extension of Python's built-in cmd module. cmd2 provides a wealth of features on top of cmd to make your life easier and eliminates much of the boilerplate code which would be necessary when using cmd.
- Click - a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It’s the “Command Line Interface Creation Kit”. It’s highly configurable but comes with sensible defaults out of the box.It aims to make the process of writing command line tools quick and fun while also preventing any frustration caused by the inability to implement an intended CLI API.
TUI
- http://excess.org/urwid - Console user interface library for Python
- https://github.com/Mckinsey666/bullet - Beautiful Python prompts made simple.
Network
- Eve - an open source Python REST API framework designed for human beings. It allows to effortlessly build and deploy highly customizable, fully featured RESTful Web Services. Eve is powered by Flask and Cerberus and it offers native support for MongoDB data stores. Support for SQL, Elasticsearch and Neo4js backends is provided by community extensions.
- https://github.com/peterhudec/authomatic - Simple yet powerful authorization / authentication client library for Python web applications.
Web
- Syte - a really simple but powerful packaged personal site that has social integrations like Twitter, GitHub, Dribbble, Instagram, Foursquare, Tumblr, Last.fm, SoundCloud and Bitbucket. You can see it in action on my personal site.
- Pattern - a web mining module for the Python programming language. It bundles tools for: Data Mining: Google + Twitter + Wikipedia API, web spider, HTML DOM parser, Natural Language Processing: tagger/chunker, n-gram search, sentiment analysis, WordNet, Machine Learning: vector space model, k-means clustering, Naive Bayes + k-NN + SVM classifiers, Network Analysis: graph centrality and visualization.
- Tornado - an open source version of the scalable, non-blocking web server and tools that power FriendFeed.
- https://github.com/requests/requests - Python HTTP Requests for Humans
Data
- dataset - Because managing databases in Python should be as simple as reading and writing JSON files.
- https://github.com/JulienPalard/Pipe - A Python library to use infix notation in Python
Visual
See also Visulisation
- Python Imaging Library (PIL) adds image processing capabilities to your Python interpreter. This library supports many file formats, and provides powerful image processing and graphics capabilities.
- Colour Science for Python - a Python colour science package implementing a comprehensive number of colour theory transformations and algorithms. [7] [8]
Frameworks
Django
python manage.py runserver 0.0.0.0:8181 for public ip
Docs
Guides
to sort
- http://ankursethi.in/journal/2012/Aug/19/a-django-admin-wishlist/
- http://mezzanine.jupo.org/
- http://www.sparklewise.com/django-settings-for-production-and-development-best-practices/
- http://arunrocks.com/blog/2012/03/05/building_a_blog_in_30_mins_with_django_%28screencast%29/
- http://brack3t.com/ajax-and-django-views.html
- http://lincolnloop.com/django-best-practices/
- https://github.com/jacobian/djangobook.com/
- http://www.djangobook.com/en/2.0/index.html
- http://django-haystack.readthedocs.org/en/latest/toc.html - modular search
Twisted
Pyramid
Learnt from Zope 3, Grok, Cromlech, etc.
http://trac.dolmen-project.org/
Zope
Plone
Other
- PythonOnWheels (or short PoW) is a small and quick rapid web application generator framework for Python.
- web2py - full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications. Written and programmable in Python. LGPLv3 License.
- http://flask.pocoo.org/
- http://maximebf.com/blog/2012/10/building-websites-in-python-with-flask/
- https://github.com/rochacbruno/quokka
- TurboGear - will help you to create a database-driven, ready-to-extend application in minutes. All with code that is as natural as writing a function, designer friendly templates, easy AJAX on the browser side and on the server side and with an incredibly powerful and flexible Object Relational Mapper (ORM).
- Kivy: Cross-platform Python Framework for NUI Development - Open source Python library for rapid development of applicationsthat make use of innovative user interfaces, such as multi-touch apps.
Prefect
- Prefect - Modern Workflow Orchestration. Prefect is an orchestrator for data-intensive workflows. It's the simplest way to transform any Python function into a unit of work that can be observed and orchestrated. With Prefect, you can build resilient, dynamic workflows that react to the world around them and recover from unexpected changes. With just a few decorators, Prefect supercharges your code with features like automatic retries, distributed execution, scheduling, caching, and much more. Every activity is tracked and can be monitored with the Prefect server or Prefect Cloud dashboard.
- https://github.com/Pocket/data-flows - Pocket data flows orchestrated using Prefect.
Cross language
- Php2Python - Python alternatives for PHP functions, classes and libraries
- Brython - A Python 3 implementation for client-side web programming
- Pyjs - a Rich Internet Application (RIA) Development Platform for both Web and Desktop. It contains a Python-to-JavaScript compiler, an AJAX framework and a Widget Set API. Pyjs started life as a Python port of Google Web Toolkit, the Java-to-JavaScript compiler.
to sort
- http://blog.hartleybrody.com/2012/01/google-python/
- http://marakana.com/bookshelf/python_fundamentals_tutorial/index.html
- http://people.csail.mit.edu/pgbovine/python/tutor.html#mode=edit
- http://me.veekun.com/blog/2012/05/05/python-faq-webdev/
- http://www.scribd.com/doc/58306088/Bad-Ideas
- http://news.ycombinator.com/item?id=4853019
- http://hynek.me/articles/python-deployment-anti-patterns/
- http://satyajit.ranjeev.in/2012/05/17/python-a-few-things-to-remember.html
- mypy is an experimental Python variant that aims to combine the benefits of dynamic (or "duck") typing and static typing. Our goal is to have the expressive power and convenience of Python, and also compile-time type checking and efficient compilation to native code, without the need of a heavy-weight VM.
- NLTK is a leading platform for building Python programs to work with human language data. It provides easy-to-use interfaces to over 50 corpora and lexical resources such as WordNet, along with a suite of text processing libraries for classification, tokenization, stemming, tagging, parsing, and semantic reasoning.
- http://www.aaronsw.com/weblog/rewritingreddit - perl to python/django
- Pygame is a set of Python modules designed for writing games. Pygame adds functionality on top of the excellent SDL library. This allows you to create fully featured games and multimedia programs in the python language. Pygame is highly portable and runs on nearly every platform and operating system. Pygame itself has been downloaded millions of times, and has had millions of visits to its website.
- https://github.com/hylang/hy - A dialect of Lisp that's embedded in Python
Testing
tox
- Welcome to the tox automation project — tox 3.7.1.dev10 documentation - aims to automate and standardize testing in Python. It is part of a larger vision of easing the packaging, testing and release process of Python software.