Skip to content

Commit de36584

Browse files
committed
update docs for pinning Python
- clarify that runtime.txt is only for env files that don't support runtime specification - specify default version of Python and when it changed - more links to pinning docs
1 parent 2baf31d commit de36584

File tree

3 files changed

+63
-29
lines changed

3 files changed

+63
-29
lines changed

docs/source/config_files.rst

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ Below is a list of supported configuration files (roughly in the order of build
2323
:local:
2424
:depth: 1
2525

26-
.. _environment-yml:
26+
.. _environment.yml:
2727

2828
``environment.yml`` - Install a Python environment
2929
==================================================
3030

31-
``environment.yml`` is the standard configuration file used by Anaconda, conda,
32-
and miniconda that lets you install packages in the data analytics stack (it
33-
primarily installs Python packages, though can be used to install a range of
34-
non-Python packages as well).
31+
``environment.yml`` is the standard configuration file used by `conda <https://conda.io>`_
32+
that lets you install any kind of package,
33+
including Python, R, and C/C++ packages.
3534

3635
.. note::
3736

@@ -41,16 +40,18 @@ non-Python packages as well).
4140
file.
4241

4342
You can also specify which Python version to install in your built environment
44-
with ``environment.yml``. By default, ``repo2docker`` **installs
45-
Python 3.6** with your ``environment.yml`` unless you include the version of
46-
Python in the file. ``conda`` supports Python versions 3.6, 3.5, 3.4, and 2.7.
47-
``repo2docker`` support is best with Python 3.6, 3.5, and 2.7.
43+
with ``environment.yml``. By default, ``repo2docker`` installs
44+
|default_python| with your ``environment.yml`` unless you include the version of
45+
Python in this file. ``conda`` supports all versions of Python,
46+
though ``repo2docker`` support is best with Python 3.7, 3.6, 3.5 and 2.7.
4847

4948
.. warning::
5049
If you include a Python version in a ``runtime.txt`` file in addition to your
5150
``environment.yml``, your ``runtime.txt`` will be ignored.
5251

5352

53+
.. _requirements.txt:
54+
5455
``requirements.txt`` - Install a Python environment
5556
===================================================
5657

@@ -60,6 +61,8 @@ environment. Our
6061
on GitHub shows a typical requirements file.
6162

6263

64+
.. _setup.py:
65+
6366
``setup.py`` - Install Python packages
6467
======================================
6568

@@ -68,6 +71,8 @@ To install your repository like a Python package, you may include a
6871
``pip install -e .``.
6972

7073

74+
.. _REQUIRE:
75+
7176
``REQUIRE`` - Install a Julia environment
7277
=========================================
7378

@@ -76,6 +81,8 @@ Julia repository with ``REQUIRE`` and ``environment.yml``,
7681
visit `binder-examples/julia-python <https://github.com/binder-examples/julia-python>`_.
7782

7883

84+
.. _install.R:
85+
7986
``install.R`` - Install an R/RStudio environment
8087
================================================
8188

@@ -85,6 +92,8 @@ To set the date of the snapshot add a runtime.txt_.
8592
For an example ``install.R`` file, visit our `example install.R file <https://github.com/binder-examples/r/blob/master/install.R>`_.
8693

8794

95+
.. _apt.txt:
96+
8897
``apt.txt`` - Install packages with apt-get
8998
===========================================
9099

@@ -95,6 +104,8 @@ We use ``apt.txt``, for example, to install LaTeX in our
95104
`example apt.txt for LaTeX <https://github.com/binder-examples/latex/blob/master/apt.txt>`_.
96105

97106

107+
.. _DESCRIPTION:
108+
98109
``DESCRIPTION`` - Install an R package
99110
======================================
100111

@@ -106,6 +117,9 @@ You also need to have a ``runtime.txt`` file that is formatted as
106117
``r-<YYYY>-<MM>-<DD>``, where YYYY-MM-DD is a snapshot of MRAN that will be
107118
used for your R installation.
108119

120+
121+
.. _manifest.xml:
122+
109123
``manifest.xml`` - Install Stencila
110124
===================================
111125

@@ -154,21 +168,29 @@ If you only need to run things once during the build phase use :ref:`postBuild`.
154168

155169

156170
.. TODO: Discuss runtime limits, best practices, etc.
157-
Also, point to an example.
158171
159172
.. _runtime.txt:
160173

161174
``runtime.txt`` - Specifying runtimes
162175
=====================================
163176

164-
This allows you to control the runtime of Python or R.
177+
Sometimes you want to specify the version of the runtime
178+
(e.g. the version of Python or R),
179+
but the environment specification format don't let you specify this information
180+
(e.g. requirements.txt or install.R).
181+
For these cases, we have a special file, ``runtime.txt``.
182+
183+
.. note::
184+
185+
``runtime.txt`` is only supported when used with environment specifications
186+
that do not already support specifying the runtime
187+
(e.g. when using ``environment.yml`` for conda or ``REQUIRE`` for Julia,
188+
``runtime.txt`` will be ignored).
165189

166190
To use python-2.7: add ``python-2.7`` in runtime.txt file.
167-
The repository will run in a virtualenv with
191+
The repository will run in an env with
168192
Python 2 installed. To see a full example repository, visit our
169193
`Python2 example <https://github.com/binder-examples/python2_runtime/blob/master/runtime.txt>`_.
170-
**Python versions in** ``runtime.txt`` **are ignored when** ``environment.yml`` **is
171-
present in the same folder**.
172194

173195
repo2docker uses R libraries pinned to a specific snapshot on
174196
`MRAN <https://mran.microsoft.com/documents/rro/reproducibility>`_.

docs/source/faq.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ and have found an answer, send a PR to add it here!
99
How should I specify another version of Python?
1010
-----------------------------------------------
1111

12-
One can specify a Python version in the ``environment.yml`` file of a repository.
12+
One can specify a Python version in the ``environment.yml`` file of a repository
13+
or ``runtime.txt`` file if using ``requirements.txt`` instead of ``environment.yml``.
1314

1415
What versions of Python (or R or Julia...) are supported?
1516
---------------------------------------------------------
@@ -19,8 +20,8 @@ Python
1920

2021
Repo2docker officially supports the following versions of Python (specified in environment.yml or runtime.txt):
2122

22-
- 3.7 (added in 0.7)
23-
- 3.6 (default)
23+
- 3.7 (added in 0.7, default in 0.8)
24+
- 3.6 (default in 0.7 and earlier)
2425
- 3.5
2526

2627
Additional versions may work, as long as the

docs/source/howto/languages.rst

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,41 @@ you use one of the following configuration files:
1616
* ``requirements.txt``
1717
* ``environment.yml``
1818

19-
Note that by default, the environment will have **Python 3** installed.
19+
.. note::
2020

21-
Specifying a version of Python
22-
------------------------------
21+
By default, the environment will have |default_python|.
2322

24-
To specify a specific version of Python, you have two options:
23+
.. versionchanged:: 0.8
2524

26-
* Use ``runtime.txt``. Include a line that specifies the Python version in
27-
this file. This line takes the following form::
25+
Upgraded default Python from 3.6 to 3.7.
2826

29-
python=X.X
3027

31-
For example,::
28+
Specifying a version of Python
29+
------------------------------
30+
31+
To specify a specific version of Python, you have two options:
3232

33-
python=2.7
34-
* Use ``environment.yml``. The Anaconda distribution also lets you define
35-
the Python environment within ``environment.yml``. To do so, add ``python=X.X``
36-
to your dependencies section, like so::
33+
* Use :ref:`environment.yml <environment.yml>`. Conda environments let you define
34+
the Python version in ``environment.yml``.
35+
To do so, add ``python=X.X`` to your dependencies section, like so::
3736

3837
name: python 2.7
3938
dependencies:
4039
- python=2.7
4140
- numpy
4241

42+
* Use :ref:`runtime.txt <runtime.txt>` with :ref:`requirements.txt <requirements.txt>`.
43+
If you are using ``requirements.txt`` instead of ``environment.yml``,
44+
you can specify the Python runtime version in a separate file called ``runtime.txt``.
45+
This file contains a single line of the following form::
46+
47+
python-X.X
48+
49+
For example::
50+
51+
python-3.6
52+
53+
4354
The R Language
4455
==============
4556

0 commit comments

Comments
 (0)