@@ -219,24 +219,34 @@ ensuring that you use the same Python that you use to run your Jupyter Notebook:
219
219
#### Python Version
220
220
221
221
When deploying Python content to Posit Connect,
222
- the server will require matching ` <MAJOR.MINOR> ` versions of Python. For example,
223
- a server with only Python 3.9 installed will fail to match content deployed with
224
- Python 3.8. Your administrator may also enable exact Python version matching which
225
- will be stricter and require matching major, minor, and patch versions. For more
226
- information see the [ Posit Connect Admin Guide chapter titled Python Version
222
+ the server will require a version of Python that matches the content
223
+ requirements.
224
+
225
+ For example, a server with only Python 3.9 installed will fail to match content
226
+ that requires Python 3.8.
227
+
228
+ ` rsconnect ` supports detecting Python version requirements in several ways:
229
+ 1. A ` .python-version ` file exists. In such case
230
+ ` rsconnect ` will use its content to determine the python version requirement.
231
+ 2. A ` pyproject.toml ` with a ` project.requires-python ` field exists.
232
+ In such case the requirement specified in the field will be used
233
+ if no ` .python-version ` file exists.
234
+ 3. A ` setup.cfg ` with an ` options.python_requires ` field exists.
235
+ In such case the requirement specified in the field will be used
236
+ if ** 1** or ** 2** were not already satisfied.
237
+ 4. If no other source of version requirement was found, then
238
+ the interpreter in use is considered the one required to run the content.
239
+
240
+ On Posit Connect ` >=2025.03.0 ` the requirement detected by ` rsconnect ` is
241
+ always respected. Older Connect versions will instead rely only on the
242
+ python version used to deploy the content to determine the requirement.
243
+
244
+ For more information see the [ Posit Connect Admin Guide chapter titled Python Version
227
245
Matching] ( https://docs.posit.co/connect/admin/python/#python-version-matching ) .
228
246
229
- We recommend installing a version of Python on your client that is also available
230
- in your Connect installation. If that's not possible, you can override
231
- rsconnect-python's detected Python version and request a version of Python
232
- that is installed in Connect, For example, this command:
233
-
234
- ``` bash
235
- rsconnect deploy api --override-python-version 3.11.5 my-api/
236
- ```
237
-
238
- will deploy the content in ` my-api ` while requesting that Connect
239
- use Python version 3.11.5.
247
+ We recommend providing a ` pyproject.toml ` with a ` project.requires-python ` field
248
+ if the deployed content is an installable package and a ` .python-version ` file
249
+ for plain directories.
240
250
241
251
> ** Note**
242
252
> The packages and package versions listed in ` requirements.txt ` must be
0 commit comments