Skip to content

Commit

Permalink
python/layout: Re-order modules section
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Nov 23, 2023
1 parent c941f34 commit b19ac40
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions docs/python/layout.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,8 @@ Packages

We don't use the `src/ layout <https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure>`__. Although a `single blog post <https://blog.ionelmc.ro/2015/02/24/the-problem-with-packaging-in-python/>`__ and a few passionate developers have popularized the idea, in practice, we rarely encounter the problems it solves, and our use of :ref:`check-manifest<python-package-release-process>` and `test_requirements.py <https://github.com/open-contracting/standard-maintenance-scripts/blob/main/tests/test_requirements.py>`__ guard against those problems.

.. _layout-tests:

Test files
----------

- Put `tests outside application code <https://docs.pytest.org/en/latest/explanation/goodpractices.html#choosing-a-test-layout-import-rules>`__. Do not add ``tests`` directories inside application code.
- Prefix filenames with ``test_``. Do not suffix basenames with ``_test``.

Static files
------------

- Don't mix static files with Python files in the same directory.

Module files
------------
Modules
-------

- Use a single module for all models.
- If a module defines names that are imported by only one other module, merge the modules unless:
Expand All @@ -94,6 +81,19 @@ Module files
- :ref:`fat-models`
- `FastAPI documentation <https://sqlmodel.tiangolo.com/tutorial/code-structure/#single-module-for-models>`__

.. _layout-tests:

Test files
----------

- Put `tests outside application code <https://docs.pytest.org/en/latest/explanation/goodpractices.html#choosing-a-test-layout-import-rules>`__. Do not add ``tests`` directories inside application code.
- Prefix filenames with ``test_``. Do not suffix basenames with ``_test``.

Static files
------------

- Don't mix static files with Python files in the same directory.

Filename conventions
--------------------

Expand Down

0 comments on commit b19ac40

Please sign in to comment.