Debian Codegraph @

doc/internal/virtualenv.rst

raw
1 Development environment
2 =======================
3
4 To develop pyglet, you need an environment with at least the following:
5
6 - |min_python_version_fancy_str|
7 - `pytest <https://pytest.org>`_
8 - Your favorite Python editor or IDE
9
10 All requirements should already be located in ``doc/requirements.txt``
11 and ``tests/requirements.txt``.
12
13 .. code::
14
15 pip install -r doc/requirements.txt
16 pip install -r tests/requirements.txt
17
18 To use and test all pyglet functionality you should also have:
19
20 - `FFmpeg <https://www.ffmpeg.org/download.html>`_
21 - `Pillow <https://pillow.readthedocs.io>`_
22 - `coverage <https://coverage.readthedocs.io>`_
23
24 To build packages for distribution you need to install:
25
26 - `wheel <https://github.com/pypa/wheel/>`_
27
28 It is preferred to create a Python virtual environment to develop in.
29 This allows you to easily test on all Python versions supported by pyglet,
30 not pollute your local system with pyglet development dependencies,
31 and not have your local system interfere with pyglet development.
32 All dependencies you install while inside an activated virtual
33 environment will remain isolated inside that environment.
34 When you're finished, you can simply delete it.
35
36 This section will show you how to set up and use virtual environments.
37 If you're already familiar with this, you can probably skip the rest of
38 this page.
39
40 Linux or Mac OSX
41 ----------------
42
43 Setting up
44 ''''''''''
45
46 Setting up a virtual environment is almost the same for Linux and OS X.
47 First, use your OS's package manager (apt, brew, etc) to install the
48 following dependencies:
49
50 - |min_python_version_fancy_str|
51
52 To create virtual environments, ``venv`` is included in the standard
53 library since Python 3.3.
54
55 Depending on your platform, python may be installed as ``python`` or ``python3``.
56 You may want to check which command runs python 3 on your system::
57
58 python --version
59 python3 --version
60
61 For the rest of the guide, use whichever gives you the correct python version on your system.
62 Some linux distros may install python with version numbers such as
63 |min_python_version_package_name|, so you may need to set up an alias.
64
65 Next, we'll create a virtual environment.
66 Choose the appropriate command for your system to create a virtual environment::
67
68 python -m venv pyglet-venv
69 python3 -m venv pyglet-venv
70
71 Once the virtual environment has been created, the next step is to activate
72 it. You'll then install the dependencies, which will be isolated
73 inside that virtual environment.
74
75 Activate the virtual environment ::
76
77 . pyglet-venv/bin/activate
78
79 You will see the name of the virtual environment at the start of the
80 command prompt.
81
82 [Optional] Make sure pip is the latest version::
83
84 pip install --upgrade pip
85
86 Now install dependencies in ``doc/requirements.txt`` and
87 ``tests/requirements.txt``::
88
89 pip install -r doc/requirements.txt
90 pip install -r tests/requirements.txt
91
92 Finishing
93 '''''''''
94
95 To get out of the virtual environment run::
96
97 deactivate
98
99 Windows
100 -------
101
102 Setting up
103 ''''''''''
104
105 Make sure you download and install:
106
107 - |min_python_version_fancy_str| from the
108 `official Python site <http://www.python.org/downloads/windows/>`_
109
110 Pip should be installed by default with the latest Python installers.
111 Make sure that the boxes for installing PIP and adding python to PATH are checked.
112
113 When finished installing, open a command prompt.
114
115 To create virtual environments, ``venv`` is included in the standard library
116 since Python 3.3.
117
118 Next, we'll create a virtual environment.::
119
120 python -m venv pyglet-venv
121
122 Once the virtual environment has been created, the next step is to activate
123 it. You'll then install the dependencies, which will be isolated
124 inside that virtual environment.
125
126 Activate the virtual environment ::
127
128 . pyglet-venv/bin/activate
129
130 You will see the name of the virtual environment at the start of the
131 command prompt.
132
133 [Optional] Make sure pip is the latest version::
134
135 pip install --upgrade pip
136
137
138 Now install dependencies in ``doc/requirements.txt`` and
139 ``tests/requirements.txt``::
140
141 pip install -r doc/requirements.txt
142 pip install -r tests/requirements.txt
143
144 Finishing
145 '''''''''
146
147 To get out of the virtual environment run::
148
149 deactivate