Skip to content

Commit

Permalink
Excise mentions of setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bluetech committed Oct 30, 2023
1 parent 8d188d7 commit 93e49a9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ coverage measurements (using pytest-cov plugin) are not reliable.

If you want to measure coverage you'll need to create .pth file as described in
`subprocess section of coverage documentation`_. If you're using
``setup.py develop`` you should uninstall pytest_django (using pip)
editable mode you should uninstall pytest_django (using pip)
for the time of measuring coverage.

You'll also need mysql and postgres databases. There are predefined settings
Expand Down
2 changes: 1 addition & 1 deletion docs/database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ A good way to use ``--reuse-db`` and ``--create-db`` can be:
Using ``--no-migrations`` (alias: ``--nomigrations``) will disable Django migrations and create the database
by inspecting all models. It may be faster when there are several migrations to
run in the database setup. You can use ``--migrations`` to force running
migrations in case ``--no-migrations`` is used, e.g. in ``setup.cfg``.
migrations in case ``--no-migrations`` is used, e.g. in ``pyproject.toml``.

.. _advanced-database-configuration:

Expand Down
27 changes: 14 additions & 13 deletions docs/managing_python_path.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ looking for the project's ``manage.py`` file and adding its directory to the
Python path.

Looking for the ``manage.py`` file uses the same algorithm as pytest uses to
find ``pytest.ini``, ``tox.ini`` and ``setup.cfg``: Each test root directories
parents will be searched for ``manage.py`` files, and it will stop when the
first file is found.
find ``pyproject.toml``, ``pytest.ini``, ``tox.ini`` and ``setup.cfg``: Each
test root directories parents will be searched for ``manage.py`` files, and it
will stop when the first file is found.

If you have a custom project setup, have none or multiple ``manage.py`` files
in your project, the automatic detection may not be correct. See
Expand All @@ -47,16 +47,19 @@ Managing your project with virtualenv, pip and editable mode
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The easiest way to have your code available on the Python path when using
virtualenv and pip is to have a setup.py file and install your project in
editable mode when developing.
virtualenv and pip is to install your project in editable mode when developing.

If you don't already have a setup.py file, creating a setup.py file with this
content will get you started::
If you don't already have a pyproject.toml file, creating a pyproject.toml file
with this content will get you started::

import setuptools
setuptools.setup(name='myproj', version='1.0')
# pyproject.toml
[build-system]
requires = [
"setuptools>=61.0.0",
]
build-backend = "setuptools.build_meta"

This ``setup.py`` file is not sufficient to distribute your package to PyPI or
This ``pyproject.toml`` file is not sufficient to distribute your package to PyPI or
more general packaging, but it should help you get started. Please refer to the
`Python Packaging User Guide
<https://python-packaging-user-guide.readthedocs.io/en/latest/tutorial.html#creating-your-own-project>`_
Expand All @@ -71,7 +74,7 @@ add this directly to your project's requirements.txt file like this::

# requirements.txt
-e .
django>=1.11
django
pytest-django


Expand All @@ -80,8 +83,6 @@ Using pytest's ``pythonpath`` option

You can explicitly add paths to the Python search path using pytest's
:pytest-confval:`pythonpath` option.
This option is available since pytest 7; for older versions you can use the
`pytest-pythonpath <https://pypi.python.org/pypi/pytest-pythonpath>`_ plugin.

Example: project with src layout
````````````````````````````````
Expand Down
2 changes: 1 addition & 1 deletion tests/test_django_settings_module.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests which check the various ways you can set DJANGO_SETTINGS_MODULE
If these tests fail you probably forgot to run "python setup.py develop".
If these tests fail you probably forgot to run "pip install -e .".
"""

import pytest
Expand Down

0 comments on commit 93e49a9

Please sign in to comment.