Skip to content

Commit 12bb4a2

Browse files
authored
Merge branch 'main' into added_obsolete
2 parents c97e572 + 7c22708 commit 12bb4a2

File tree

11 files changed

+112
-29
lines changed

11 files changed

+112
-29
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,14 @@ jobs:
1717
- linkcheck
1818

1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121

2222
- name: Set up Python
23-
uses: actions/setup-python@v2
23+
uses: actions/setup-python@v4
2424
with:
2525
python-version: 3.9
26-
27-
- name: pip cache
28-
uses: actions/cache@v2
29-
with:
30-
path: ~/.cache/pip
31-
key:
32-
${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('noxfile.py') }}
33-
restore-keys: |
34-
${{ matrix.os }}-${{ matrix.python-version }}-
26+
cache: 'pip'
27+
cache-dependency-path: 'requirements.txt'
3528

3629
- name: Install dependencies
3730
run: |

.github/workflows/translation.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ jobs:
1818

1919
steps:
2020
- name: Grab the repo src
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
2222
with:
2323
fetch-depth: 0 # To reach the common commit
2424
- name: Set up git user as [bot]
2525
# Refs:
2626
# * https://github.community/t/github-actions-bot-email-address/17204/6
2727
# * https://github.com/actions/checkout/issues/13#issuecomment-724415212
28-
uses: fregante/setup-git-user@v1.0.1
28+
uses: fregante/setup-git-user@v1.1.0
2929

3030
- name: Switch to the translation source branch
3131
run: |
@@ -50,7 +50,7 @@ jobs:
5050
git merge '${{ github.event.repository.default_branch }}'
5151
5252
- name: Set up Python
53-
uses: actions/setup-python@v2
53+
uses: actions/setup-python@v4
5454
with:
5555
python-version: >-
5656
3.10

source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@
416416
'pypa': ('https://www.pypa.io/en/latest/', None),
417417
'python': ('https://docs.python.org/3', None),
418418
'python-guide': ('https://docs.python-guide.org', None),
419-
'python2': ('https://docs.python.org/2', None),
420419
'setuptools': ('https://setuptools.readthedocs.io/en/latest/', None),
421420
'spack': ('https://spack.readthedocs.io/en/latest/', None),
422421
'sphinx': ('https://www.sphinx-doc.org/en/master', None),

source/contribute.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ need:
135135
See the :doc:`Hitchhiker's Guide to Python installation instructions <python-guide:starting/installation>`
136136
to install Python 3.8 on your operating system.
137137

138-
To build the guide, run the following bash command in the source folder:
138+
To build the guide, run the following shell command in the project's root folder:
139139

140140
.. code-block:: bash
141141

source/discussions/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ specific topic. If you're just trying to get stuff done, see
1212
pip-vs-easy-install
1313
install-requires-vs-requirements
1414
wheel-vs-egg
15+
src-layout-vs-flat-layout
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
=========================
2+
src layout vs flat layout
3+
=========================
4+
5+
The "flat layout" refers to organising a project's files in a folder or
6+
repository, such that the various configuration files and
7+
:term:`import packages <Import Package>` are all in the top-level directory.
8+
9+
::
10+
11+
.
12+
├── README.md
13+
├── noxfile.py
14+
├── pyproject.toml
15+
├── setup.py
16+
├── awesome_package/
17+
│ ├── __init__.py
18+
│ └── module.py
19+
└── tools/
20+
├── generate_awesomeness.py
21+
└── decrease_world_suck.py
22+
23+
The "src layout" deviates from the flat layout by moving the code that is
24+
intended to be importable (i.e. ``import awesome_package``, also known as
25+
:term:`import packages <Import Package>`) into a subdirectory. This
26+
subdirectory is typically named ``src/``, hence "src layout".
27+
28+
::
29+
30+
.
31+
├── README.md
32+
├── noxfile.py
33+
├── pyproject.toml
34+
├── setup.py
35+
├── src/
36+
│ └── awesome_package/
37+
│ ├── __init__.py
38+
│ └── module.py
39+
└── tools/
40+
├── generate_awesomeness.py
41+
└── decrease_world_suck.py
42+
43+
Here's a breakdown of the important behaviour differences between the src
44+
layout and the flat layout:
45+
46+
* The src layout requires installation of the project to be able to run its
47+
code, and the flat layout does not.
48+
49+
This means that the src layout involves an additional step in the
50+
development workflow of a project (typically, an
51+
:doc:`editable installation <setuptools:userguide/development_mode>`
52+
is used for development and a regular installation is used for testing).
53+
54+
* The src layout helps prevent accidental usage of the in-development copy of
55+
the code.
56+
57+
This is relevant since the Python interpreter includes the current working
58+
directory as the first item on the import path. This means that if an import
59+
package exists in the current working directory with the same name as an
60+
installed import package, the variant from the current working directory will
61+
be used. This can lead to subtle misconfiguration of the project's packaging
62+
tooling, which could result in files not being included in a distribution.
63+
64+
The src layout helps avoid this by keeping import packages in a directory
65+
separate from the root directory of the project, ensuring that the installed
66+
copy is used.
67+
68+
* The src layout helps enforce that an
69+
:doc:`editable installation <setuptools:userguide/development_mode>` is only
70+
able to import files that were meant to be importable.
71+
72+
This is especially relevant when the editable installation is implemented
73+
using a `path configuration file <https://docs.python.org/3/library/site.html#index-2>`_
74+
that adds the directory to the import path.
75+
76+
The flat layout would add the other project files (eg: ``README.md``,
77+
``tox.ini``) and packaging/tooling configuration files (eg: ``setup.py``,
78+
``noxfile.py``) on the import path. This would make certain imports work
79+
in editable installations but not regular installations.

source/guides/analyzing-pypi-package-downloads.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Getting set up
5151

5252
In order to use `Google BigQuery`_ to query the `public PyPI download
5353
statistics dataset`_, you'll need a Google account and to enable the BigQuery
54-
API on a Google Cloud Platform project. You can run the up to 1TB of queries
54+
API on a Google Cloud Platform project. You can run up to 1TB of queries
5555
per month `using the BigQuery free tier without a credit card
5656
<https://cloud.google.com/blog/products/data-analytics/query-without-a-credit-card-introducing-bigquery-sandbox>`__
5757

source/key_projects.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ distlib
6464
=======
6565

6666
:doc:`Docs <distlib:index>` |
67-
`Issues <https://bitbucket.org/pypa/distlib/issues?status=new&status=open>`__ |
68-
`Bitbucket <https://bitbucket.org/pypa/distlib>`__ |
67+
`Issues <https://github.com/pypa/distlib/issues>`__ |
68+
`GitHub <https://github.com/pypa/distlib>`__ |
6969
`PyPI <https://pypi.org/project/distlib>`__
7070

7171
``distlib`` is a library which implements low-level functions that
@@ -496,7 +496,8 @@ make deployment of Python applications as simple as ``cp``.
496496
pip-tools
497497
=========
498498

499-
`GitHub and Docs <https://github.com/jazzband/pip-tools/>`__ |
499+
`Docs <https://pip-tools.readthedocs.io/en/latest/>`__ |
500+
`GitHub <https://github.com/jazzband/pip-tools/>`__ |
500501
`PyPI <https://pypi.org/project/pip-tools/>`__
501502

502503
pip-tools is a suite of tools meant for Python system administrators

source/specifications/declaring-project-metadata.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ or listed as dynamic are:
3333

3434
- ``version``
3535

36-
All other fields are considered optional and my be specified
36+
All other fields are considered optional and may be specified
3737
statically, listed as dynamic, or left unspecified.
3838

3939

source/specifications/source-distribution-format.rst

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,23 @@ deemed a source tree.
3333
Source distribution file name
3434
=============================
3535

36-
The file name of a sdist is not currently standardised, although the *de facto*
37-
form is ``{name}-{version}.tar.gz``, where ``{name}`` is the canonicalized form
38-
of the project name (see :pep:`503` for the canonicalization rules) with ``-``
39-
characters replaced with ``_``, and ``{version}`` is the canonicalized form of
40-
the project version (see :ref:`version-specifiers`).
36+
The file name of a sdist was standardised in :pep:`625`. The file name must be in
37+
the form ``{name}-{version}.tar.gz``, where ``{name}`` is normalised according to
38+
the same rules as for binary distributions (see :ref:`binary-distribution-format`),
39+
and ``{version}`` is the canonicalized form of the project version (see
40+
:ref:`version-specifiers`).
4141

4242
The name and version components of the filename MUST match the values stored
4343
in the metadata contained in the file.
4444

45+
Code that produces a source distribution file MUST give the file a name that matches
46+
this specification. This includes the ``build_sdist`` hook of a build backend.
47+
48+
Code that processes source distribution files MAY recognise source distribution files
49+
by the ``.tar.gz`` suffix and the presence of precisely *one* hyphen in the filename.
50+
Code that does this may then use the distribution name and version from the filename
51+
without further verification.
52+
4553
Source distribution file format
4654
===============================
4755

@@ -57,4 +65,5 @@ No other content of a sdist is required or defined. Build systems can store
5765
whatever information they need in the sdist to build the project.
5866

5967
The tarball should use the modern POSIX.1-2001 pax tar format, which specifies
60-
UTF-8 based file names.
68+
UTF-8 based file names. In particular, source distribution files must be readable
69+
using the standard library tarfile module with the open flag 'r:gz'.

0 commit comments

Comments
 (0)