Skip to content
Myr

install.rst

This file

Path

docs/tutorial/install.rst

89 lines · 2.8 KiB

Last changed by

Merge branch '2.3.x'David Lordbefore adoption7d399e8

History of this file

Take it

The walk stopped after 200 commits: lines older than 2f5a2ab point at it.

Merge pull request #4479 from pgjones/env_configDavid Lordbefore adoption2f5a2ab

lines 1–3why, one step back
1Make the Project Installable
2============================3

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

lines 4–7why, one step back
4Making your project installable means that you can build a *wheel* file and install that
5in another environment, just like you installed Flask in your project's environment.6This makes deploying your project the same as installing any other library, so you're7using all the standard Python tools to manage everything.

Merge pull request #4479 from pgjones/env_configDavid Lordbefore adoption2f5a2ab

lines 8–29why, one step back
8
9Installing also comes with other benefits that might not be obvious from10the tutorial or as a new Python user, including:1112* Currently, Python and Flask understand how to use the ``flaskr``13 package only because you're running from your project's directory.14 Installing means you can import it no matter where you run from.1516* You can manage your project's dependencies just like other packages17 do, so ``pip install yourproject.whl`` installs them.1819* Test tools can isolate your test environment from your development20 environment.2122.. note::23 This is being introduced late in the tutorial, but in your future24 projects you should always start with this.252627Describe the Project28--------------------29

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

line 30why, one step back
30The ``pyproject.toml`` file describes your project and how to build it.

Merge pull request #4479 from pgjones/env_configDavid Lordbefore adoption2f5a2ab

line 31why, one step back
31

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

lines 32–33why, one step back
32.. code-block:: toml
33 :caption: ``pyproject.toml``

Merge pull request #4479 from pgjones/env_configDavid Lordbefore adoption2f5a2ab

line 34why, one step back
34

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

lines 35–37why, one step back
35 [project]
36 name = "flaskr"37 version = "1.0.0"

Merge branch '2.3.x'David Lordbefore adoption7d399e8

line 38why, one step back
38 description = "The basic blog app built in the Flask tutorial."

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

lines 39–41why, one step back
39 dependencies = [
40 "flask",41 ]

Merge pull request #4479 from pgjones/env_configDavid Lordbefore adoption2f5a2ab

line 42why, one step back
42

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

line 43why, one step back
43 [build-system]

Merge branch '2.3.x'David Lordbefore adoption15a0d4a

lines 44–45why, one step back
44 requires = ["flit_core<4"]
45 build-backend = "flit_core.buildapi"

Merge pull request #4479 from pgjones/env_configDavid Lordbefore adoption2f5a2ab

line 46why, one step back
46

Merge branch '2.3.x'David Lordbefore adoption15a0d4a

lines 47–48why, one step back
47See the official `Packaging tutorial <packaging tutorial_>`_ for more
48explanation of the files and options used.

Merge pull request #4479 from pgjones/env_configDavid Lordbefore adoption2f5a2ab

line 49why, one step back
49

Merge branch '2.1.x'David Lordbefore adoption9e2e1de

line 50why, one step back
50.. _packaging tutorial: https://packaging.python.org/tutorials/packaging-projects/

Merge pull request #4479 from pgjones/env_configDavid Lordbefore adoption2f5a2ab

lines 51–61why, one step back
51
5253Install the Project54-------------------5556Use ``pip`` to install your project in the virtual environment.5758.. code-block:: none5960 $ pip install -e .61

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

lines 62–65why, one step back
62This tells pip to find ``pyproject.toml`` in the current directory and install the
63project in *editable* or *development* mode. Editable mode means that as you make64changes to your local code, you'll only need to re-install if you change the metadata65about the project, such as its dependencies.

Merge pull request #4479 from pgjones/env_configDavid Lordbefore adoption2f5a2ab

lines 66–84why, one step back
66
67You can observe that the project is now installed with ``pip list``.6869.. code-block:: none7071 $ pip list7273 Package Version Location74 -------------- --------- ----------------------------------75 click 6.776 Flask 1.077 flaskr 1.0.0 /home/user/Projects/flask-tutorial78 itsdangerous 0.2479 Jinja2 2.1080 MarkupSafe 1.081 pip 9.0.382 Werkzeug 0.14.18384Nothing changes from how you've been running your project so far.

Merge pull request #4646 from pallets/cli-app-envDavid Lordbefore adoptionae54727

line 85why, one step back
85``--app`` is still set to ``flaskr`` and ``flask run`` still runs

Merge pull request #4479 from pgjones/env_configDavid Lordbefore adoption2f5a2ab

lines 86–89why, one step back
86the application, but you can call it from anywhere, not just the
87``flask-tutorial`` directory.8889Continue to :doc:`tests`.