You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In general, the system version of Python should not be touched. E.g., avoid installing packages with `sudo pip`.
209
210
210
-
##### Python 2
211
+
pyenv provides a handy way to download and build local versions of Python mostly without sudo and without modifying the system Python environment. The Python environments created and managed by pyenv are stored under `~/.pyenv` by default. pyenv automatically switches between Python environments based on the current directory.
* Follow the instructions on how to activate pyenv automatically.
218
+
* Open a new shell.
215
219
216
-
$ . ./venv/bin/activate
220
+
#### Set up a virtual environment for d1_python
217
221
218
-
Download the source from GitHub:
222
+
This is the environment all of d1_python's packaged Python dependencies will be installed to. It provides the runtime environment for d1_python tests and utilities.
The setup above is sufficient for testing against GMN using HTTP and the Django test client, which is normally all that is required. However, if testing over HTTPS or in an environment that is closer to production is required, Apache can be set up to host GMN directly from its location in d1_python, using the d1_python virtual environment.
250
+
251
+
In such a setup, the GMN source can be open in an IDE and changes made active with an `service apache2 reload`.
252
+
253
+
Note that `mod_wsgi` can only run from a Python environment compiled with `--enable-shared`, as done in the venv setup above.
254
+
255
+
The APT package version of `mod_wsgi` has been compiled to work with the APT package version of Python. The two must be compatible at the ABI level, and Apache can only load a single instance of `mod_wsgi`. So this uninstalls any installed `mod_wsgi` APT package before compiling a new version against the Python environment in which it will be used.
PyCharm (and other IntelliJ based platforms), are not able to connect to database with local (UNIX) sockets. Postgres' convenient "peer" authentication type only works over local sockets. A convenient workaround for this is to set Postgres up to trust local connections made over TCP/IP.
246
292
247
-
:
248
-
249
293
$ sudo editor /etc/postgresql/10/main/pg_hba.conf
250
294
251
295
Add line:
252
296
253
-
:
254
-
255
297
host all all 127.0.0.1/32 trust
256
298
257
299
A similar line for MD5 may already be present and, if so, must be commented out.
@@ -318,14 +360,20 @@ After successful build, clone a fresh copy, which will be used for building the
318
360
319
361
Building the release packages from a fresh clone is a simple way of ensuring that only tracked files are released. It is a workaround for the way setuptools works, which is basically that it vacuums up everything that looks like a Python script in anything that looks like a package, which makes it easy to publish local files by accident.
320
362
321
-
Create a Python venv to use for build and deploy
363
+
Create a Python venv to use for build and deploy:
322
364
365
+
* The package `setup.py` scripts will run in this venv.
366
+
* The venv can be reused indefinitly.
367
+
323
368
$ pyenv virtualenv "x.y.z" venv_build
324
369
325
-
* Where "x.y.z" is one of the versions listed in `pyenv versions`.
326
-
* Pick a version that is close or the same as the version of Python used for testing on Travis
370
+
* Where "x.y.z" is one of the versions listed in `pyenv versions`.
371
+
* Pick a version that is close or the same as the version of Python used for testing on Travis.
372
+
327
373
328
374
Build and publish the packages:
375
+
376
+
* Download current master from GitHub, create binary wheel packages and push the packages to PyPI.
0 commit comments