Skip to content

Commit b6de82d

Browse files
authored
Merge pull request #9158 from readthedocs/pip-tools-docs
Add docs showing pip-tools usage on dependencies
2 parents ff811ec + bb8d8f0 commit b6de82d

File tree

1 file changed

+94
-17
lines changed

1 file changed

+94
-17
lines changed

docs/user/guides/reproducible-builds.rst

+94-17
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ and **those settings live in your repository**.
4242
A configuration file with explicit dependencies looks like this:
4343

4444
.. code-block:: yaml
45-
46-
# File: .readthedocs.yaml
45+
:caption: .readthedocs.yaml
4746
4847
version: 2
4948
@@ -62,8 +61,7 @@ A configuration file with explicit dependencies looks like this:
6261
- requirements: docs/requirements.txt
6362
6463
.. code-block::
65-
66-
# File: docs/requirements.txt
64+
:caption: docs/requirements.txt
6765
6866
# Defining the exact version will make sure things don't break
6967
sphinx==4.2.0
@@ -85,8 +83,7 @@ for example:
8583
and its dependencies using a requirements file.
8684

8785
.. code-block:: yaml
88-
89-
# File: .readthedocs.yaml
86+
:caption: .readthedocs.yaml
9087
9188
version: 2
9289
@@ -106,8 +103,7 @@ for example:
106103
Your project is relying on the default Python version and default installed dependencies.
107104

108105
.. code-block:: yaml
109-
110-
# File: .readthedocs.yaml
106+
:caption: .readthedocs.yaml
111107
112108
version: 2
113109
@@ -126,24 +122,22 @@ Some examples:
126122
in all platforms, and won't be updated unexpectedly.
127123

128124
.. code-block::
129-
130-
# File: docs/requirements.txt
125+
:caption: docs/requirements.txt
131126
132127
sphinx==4.2.0
133128
sphinx_rtd_theme==1.0.0
134129
readthedocs-sphinx-search==0.1.1
135130
136131
.. code-block:: yaml
137-
138-
# File: docs/environment.yaml
132+
:caption: docs/environment.yaml
139133
140134
name: docs
141135
channels:
142136
- conda-forge
143137
- defaults
144138
dependencies:
145139
- sphinx==4.2.0
146-
- nbsphinx==0.8.1
140+
- nbsphinx==0.8.1
147141
- pip:
148142
- sphinx_rtd_theme==1.0.0
149143
@@ -152,16 +146,14 @@ Some examples:
152146
and your builds can fail or change unexpectedly any time.
153147

154148
.. code-block::
155-
156-
# File: docs/requirements.txt
149+
:caption: docs/requirements.txt
157150
158151
sphinx
159152
sphinx_rtd_theme
160153
readthedocs-sphinx-search
161154
162155
.. code-block:: yaml
163-
164-
# File: docs/environment.yaml
156+
:caption: docs/environment.yaml
165157
166158
name: docs
167159
channels:
@@ -182,3 +174,88 @@ or our Conda docs about :ref:`environment files <guides/conda:creating the \`\`e
182174

183175
Remember to update your docs' dependencies from time to time to get new improvements and fixes.
184176
It also makes it easy to manage in case a version reaches its end of support date.
177+
178+
179+
Pinning transitive dependencies
180+
-------------------------------
181+
182+
Once you have pinned your own dependencies,
183+
the next things to worry about are the dependencies of your dependencies.
184+
These are called *transitive dependencies*,
185+
and they can upgrade without warning if you do not pin these packages as well.
186+
187+
We recommend `pip-tools`_ to help address this problem.
188+
It allows you to specify a ``requirements.in`` file with your first-level dependencies,
189+
and it generates a ``requirements.txt`` file with the full set of transitive dependencies.
190+
191+
.. _pip-tools: https://pip-tools.readthedocs.io/en/latest/
192+
193+
✅ Good:
194+
All your transitive dependencies will stay defined,
195+
which ensures new package releases will not break your docs.
196+
197+
.. code-block::
198+
:caption: docs/requirements.in
199+
200+
sphinx==4.2.0
201+
202+
.. code-block:: yaml
203+
:caption: docs/requirements.txt
204+
205+
# This file is autogenerated by pip-compile with python 3.7
206+
# To update, run:
207+
#
208+
# pip-compile docs.in
209+
#
210+
alabaster==0.7.12
211+
# via sphinx
212+
babel==2.10.1
213+
# via sphinx
214+
certifi==2021.10.8
215+
# via requests
216+
charset-normalizer==2.0.12
217+
# via requests
218+
docutils==0.17.1
219+
# via sphinx
220+
idna==3.3
221+
# via requests
222+
imagesize==1.3.0
223+
# via sphinx
224+
importlib-metadata==4.11.3
225+
# via sphinx
226+
jinja2==3.1.2
227+
# via sphinx
228+
markupsafe==2.1.1
229+
# via jinja2
230+
packaging==21.3
231+
# via sphinx
232+
pygments==2.11.2
233+
# via sphinx
234+
pyparsing==3.0.8
235+
# via packaging
236+
pytz==2022.1
237+
# via babel
238+
requests==2.27.1
239+
# via sphinx
240+
snowballstemmer==2.2.0
241+
# via sphinx
242+
sphinx==4.4.0
243+
# via -r docs.in
244+
sphinxcontrib-applehelp==1.0.2
245+
# via sphinx
246+
sphinxcontrib-devhelp==1.0.2
247+
# via sphinx
248+
sphinxcontrib-htmlhelp==2.0.0
249+
# via sphinx
250+
sphinxcontrib-jsmath==1.0.1
251+
# via sphinx
252+
sphinxcontrib-qthelp==1.0.3
253+
# via sphinx
254+
sphinxcontrib-serializinghtml==1.1.5
255+
# via sphinx
256+
typing-extensions==4.2.0
257+
# via importlib-metadata
258+
urllib3==1.26.9
259+
# via requests
260+
zipp==3.8.0
261+
# via importlib-metadata

0 commit comments

Comments
 (0)