| 1 |
.. _installation: |
| 2 |
|
| 3 |
Installation |
| 4 |
============ |
| 5 |
|
| 6 |
Python Version |
| 7 |
-------------- |
| 8 |
|
| 9 |
Our project supports Python 2.7 (for historical reasons), Python 3.4 and newer versions, as well as PyPy 2.7 and |
| 10 |
PyPy 3.6 and newer. We recommend using the latest version of Python 3 whenever possible. |
| 11 |
|
| 12 |
Dependencies |
| 13 |
------------ |
| 14 |
|
| 15 |
This library uses the `Wrapt`_ library as a basis to construct |
| 16 |
function wrappers and decorator functions. |
| 17 |
|
| 18 |
.. _Wrapt: http://wrapt.readthedocs.io/en/latest/ |
| 19 |
|
| 20 |
The table below shows the compatibility matrix between Python versions and the `wrapt` versions that have been |
| 21 |
tested to date. Recent versions are listed first. |
| 22 |
|
| 23 |
.. list-table:: Compatibility matrix (tested versions) |
| 24 |
:header-rows: 1 |
| 25 |
:widths: 25 9 9 9 9 9 9 9 9 9 |
| 26 |
|
| 27 |
* - Python / wrapt |
| 28 |
- 2.0 |
| 29 |
- 1.17 |
| 30 |
- 1.16 |
| 31 |
- 1.15 |
| 32 |
- 1.14 |
| 33 |
- 1.13 |
| 34 |
- 1.12 |
| 35 |
- 1.11 |
| 36 |
- 1.10 |
| 37 |
* - py3.14 |
| 38 |
- ✓ |
| 39 |
- ✓ |
| 40 |
- ✗ |
| 41 |
- ✗ |
| 42 |
- ✗ |
| 43 |
- ✗ |
| 44 |
- ✗ |
| 45 |
- ✗ |
| 46 |
- ✗ |
| 47 |
* - py3.13 |
| 48 |
- ✓ |
| 49 |
- ✓ |
| 50 |
- ✗ |
| 51 |
- ✗ |
| 52 |
- ✗ |
| 53 |
- ✗ |
| 54 |
- ✗ |
| 55 |
- ✗ |
| 56 |
- ✗ |
| 57 |
* - py3.12 |
| 58 |
- ✓ |
| 59 |
- ✓ |
| 60 |
- ✓ |
| 61 |
- ✗ |
| 62 |
- ✗ |
| 63 |
- ✗ |
| 64 |
- ✗ |
| 65 |
- ✗ |
| 66 |
- ✗ |
| 67 |
* - py3.11 |
| 68 |
- ✓ |
| 69 |
- ✓ |
| 70 |
- ✓ |
| 71 |
- ✓ |
| 72 |
- ✓ |
| 73 |
- ✗ |
| 74 |
- ✗ |
| 75 |
- ✗ |
| 76 |
- ✗ |
| 77 |
* - py3.10 |
| 78 |
- ✓ |
| 79 |
- ✓ |
| 80 |
- ✓ |
| 81 |
- ✓ |
| 82 |
- ✓ |
| 83 |
- ✓ |
| 84 |
- ✓ |
| 85 |
- ✓ |
| 86 |
- ✓ |
| 87 |
* - py3.9 |
| 88 |
- ✓ |
| 89 |
- ✓ |
| 90 |
- ✓ |
| 91 |
- ✓ |
| 92 |
- ✓ |
| 93 |
- ✓ |
| 94 |
- ✓ |
| 95 |
- ✓ |
| 96 |
- ✓ |
| 97 |
* - py3.8 |
| 98 |
- ? |
| 99 |
- ? |
| 100 |
- ? |
| 101 |
- ? |
| 102 |
- ✓ |
| 103 |
- ✓ |
| 104 |
- ✓ |
| 105 |
- ✓ |
| 106 |
- ✓ |
| 107 |
* - py3.7 |
| 108 |
- ? |
| 109 |
- ? |
| 110 |
- ? |
| 111 |
- ? |
| 112 |
- ✓ |
| 113 |
- ✓ |
| 114 |
- ✓ |
| 115 |
- ✓ |
| 116 |
- ✓ |
| 117 |
|
| 118 |
Legend: ✓ = tested and compatible ; ✗ = incompatible, ? = untested but expected to work |
| 119 |
|
| 120 |
|
| 121 |
Development dependencies |
| 122 |
~~~~~~~~~~~~~~~~~~~~~~~~ |
| 123 |
|
| 124 |
These distributions will not be installed automatically. |
| 125 |
You need to install them explicitly with `pip install -e .[dev]`. |
| 126 |
|
| 127 |
* `pytest`_ is a framework which makes it easy to write small tests, |
| 128 |
yet scales to support complex functional testing for applications and libraries… |
| 129 |
* `pytest-cov`_ is a `pytest`_ plugin used to produce coverage reports. |
| 130 |
* `tox`_ aims to automate and standardize testing in Python. |
| 131 |
It is part of a larger vision of easing the packaging, testing and release process of Python software… |
| 132 |
* `bump2version`_ is a small command line tool to simplify releasing software |
| 133 |
by updating all version strings in your source code by the correct increment. |
| 134 |
Also creates commits and tags… |
| 135 |
* `sphinx`_ is a tool that makes it easy to create intelligent and beautiful documentation. |
| 136 |
|
| 137 |
.. _pytest: https://docs.pytest.org/en/latest/ |
| 138 |
.. _pytest-cov: http://pytest-cov.readthedocs.io/en/latest/ |
| 139 |
.. _tox: https://tox.readthedocs.io/en/latest/ |
| 140 |
.. _bump2version: https://github.com/c4urself/bump2version |
| 141 |
.. _sphinx: http://www.sphinx-doc.org/en/stable/index.html |
| 142 |
|
| 143 |
|
| 144 |
Virtual environments |
| 145 |
-------------------- |
| 146 |
|
| 147 |
Use a virtual environment to manage the dependencies for your project, both in |
| 148 |
development and in production. |
| 149 |
|
| 150 |
What problem does a virtual environment solve? The more Python projects you |
| 151 |
have, the more likely it is that you need to work with different versions of |
| 152 |
Python libraries, or even Python itself. Newer versions of libraries for one |
| 153 |
project can break compatibility in another project. |
| 154 |
|
| 155 |
Virtual environments are independent groups of Python libraries, one for each |
| 156 |
project. Packages installed for one project will not affect other projects or |
| 157 |
the operating system's packages. |
| 158 |
|
| 159 |
Python 3 comes bundled with the :mod:`venv` module to create virtual |
| 160 |
environments. If you're using a modern version of Python, you can continue on |
| 161 |
to the next section. |
| 162 |
|
| 163 |
If you're using Python 2, see :ref:`install-install-virtualenv` first. |
| 164 |
|
| 165 |
.. _install-create-env: |
| 166 |
|
| 167 |
Create an environment |
| 168 |
~~~~~~~~~~~~~~~~~~~~~ |
| 169 |
|
| 170 |
Create a project folder and a :file:`venv` folder within: |
| 171 |
|
| 172 |
.. code-block:: sh |
| 173 |
|
| 174 |
mkdir myproject |
| 175 |
cd myproject |
| 176 |
python3 -m venv venv |
| 177 |
|
| 178 |
On Windows: |
| 179 |
|
| 180 |
.. code-block:: bat |
| 181 |
|
| 182 |
py -3 -m venv venv |
| 183 |
|
| 184 |
If you needed to install virtualenv because you are on an older version of |
| 185 |
Python, use the following command instead: |
| 186 |
|
| 187 |
.. code-block:: sh |
| 188 |
|
| 189 |
virtualenv venv |
| 190 |
|
| 191 |
On Windows: |
| 192 |
|
| 193 |
.. code-block:: bat |
| 194 |
|
| 195 |
\Python27\Scripts\virtualenv.exe venv |
| 196 |
|
| 197 |
Activate the environment |
| 198 |
~~~~~~~~~~~~~~~~~~~~~~~~ |
| 199 |
|
| 200 |
Before you work on your project, activate the corresponding environment: |
| 201 |
|
| 202 |
.. code-block:: sh |
| 203 |
|
| 204 |
. venv/bin/activate |
| 205 |
|
| 206 |
On Windows: |
| 207 |
|
| 208 |
.. code-block:: bat |
| 209 |
|
| 210 |
venv\Scripts\activate |
| 211 |
|
| 212 |
Your shell prompt will change to show the name of the activated environment. |
| 213 |
|
| 214 |
Install Deprecated |
| 215 |
------------------------- |
| 216 |
|
| 217 |
Within the activated environment, use the following command to install Deprecated: |
| 218 |
|
| 219 |
.. code-block:: sh |
| 220 |
|
| 221 |
pip install Deprecated |
| 222 |
|
| 223 |
Living on the edge |
| 224 |
~~~~~~~~~~~~~~~~~~ |
| 225 |
|
| 226 |
If you want to work with the latest Deprecated code before it's released, install or |
| 227 |
update the code from the master branch: |
| 228 |
|
| 229 |
.. code-block:: sh |
| 230 |
|
| 231 |
pip install -U https://github.com/laurent-laporte-pro/deprecated/archive/master.tar.gz |
| 232 |
|
| 233 |
.. _install-install-virtualenv: |
| 234 |
|
| 235 |
Install virtualenv |
| 236 |
------------------ |
| 237 |
|
| 238 |
If you are using Python 2, the venv module is not available. Instead, |
| 239 |
install `virtualenv`_. |
| 240 |
|
| 241 |
On Linux, virtualenv is provided by your package manager: |
| 242 |
|
| 243 |
.. code-block:: sh |
| 244 |
|
| 245 |
# Debian, Ubuntu |
| 246 |
sudo apt-get install python-virtualenv |
| 247 |
|
| 248 |
# CentOS, Fedora |
| 249 |
sudo yum install python-virtualenv |
| 250 |
|
| 251 |
# Arch |
| 252 |
sudo pacman -S python-virtualenv |
| 253 |
|
| 254 |
If you are on Mac OS X or Windows, download `get-pip.py`_, then: |
| 255 |
|
| 256 |
.. code-block:: sh |
| 257 |
|
| 258 |
sudo python2 Downloads/get-pip.py |
| 259 |
sudo python2 -m pip install virtualenv |
| 260 |
|
| 261 |
On Windows, as an administrator: |
| 262 |
|
| 263 |
.. code-block:: bat |
| 264 |
|
| 265 |
\Python27\python.exe Downloads\get-pip.py |
| 266 |
\Python27\python.exe -m pip install virtualenv |
| 267 |
|
| 268 |
Now you can continue to :ref:`install-create-env`. |
| 269 |
|
| 270 |
.. _virtualenv: https://virtualenv.pypa.io/ |
| 271 |
.. _get-pip.py: https://bootstrap.pypa.io/get-pip.py |