@@ -274,6 +274,12 @@ classifiers
274274Provide a list of classifiers that categorize your project. For a full listing,
275275see https://pypi.python.org/pypi?%3Aaction=list_classifiers.
276276
277+ Although the list of classifiers is often used to declare what Python versions
278+ a project supports, this information is only used for searching & browsing
279+ projects on PyPI, not for installing projects. To actually restrict what
280+ Python versions a project can be installed on, use the :ref: `python_requires `
281+ argument.
282+
277283
278284keywords
279285~~~~~~~~
@@ -314,6 +320,44 @@ specification that is used to install its dependencies.
314320For more on using "install_requires" see :ref: `install_requires vs Requirements files `.
315321
316322
323+ .. _python_requires :
324+
325+ python_requires
326+ ~~~~~~~~~~~~~~~
327+
328+ If your project only runs on certain Python versions, setting the
329+ ``python_requires `` argument to the appropriate :pep: `440 ` version specifier
330+ string will prevent :ref: `pip ` from installing the project on other Python
331+ versions. For example, if your package is for Python 3+ only, write::
332+
333+ python_requires='>=3',
334+
335+ If your package is for Python 3.3 and up but you're not willing to commit to
336+ Python 4 support yet, write::
337+
338+ python_requires='~=3.3',
339+
340+ If your package is for Python 2.6, 2.7, and all versions of Python 3 starting
341+ with 3.3, write::
342+
343+ python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <4',
344+
345+ And so on.
346+
347+ .. note ::
348+
349+ Support for this feature is relatively recent. Your project's source
350+ distributions and wheels (see :ref: `Packaging Your Project `) must be built
351+ using at least version 24.2.0 of :ref: `setuptools ` in order for the
352+ ``python_requires `` argument to be recognized and the appropriate metadata
353+ generated.
354+
355+ In addition, only versions 9.0.0 and higher of :ref: `pip ` recognize the
356+ ``python_requires `` metadata. Users with earlier versions of pip will be
357+ able to download & install projects on any Python version regardless of the
358+ projects' ``python_requires `` values.
359+
360+
317361.. _`Package Data` :
318362
319363package_data
0 commit comments