File: README.rst

package info (click to toggle)
python-pyproject-examples 2023.6.30-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 228 kB
  • sloc: python: 535; makefile: 4
file content (209 lines) | stat: -rw-r--r-- 7,717 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
###################
pyproject-examples
###################

.. start short_desc

**Example pyproject.toml configs for testing.**

.. end short_desc

These are designed to be used in the testsuite for
`pyproject-parser <https://github.com/repo-helper/pyproject-parser>`_
and `whey <https://github.com/repo-helper/whey>`_,
but may be useful for other tools based on those.

.. start shields

.. list-table::
	:stub-columns: 1
	:widths: 10 90

	* - Tests
	  - |actions_linux| |actions_windows| |actions_macos|
	* - PyPI
	  - |pypi-version| |supported-versions| |supported-implementations| |wheel|
	* - Activity
	  - |commits-latest| |commits-since| |maintained| |pypi-downloads|
	* - QA
	  - |codefactor| |actions_flake8| |actions_mypy|
	* - Other
	  - |license| |language| |requires|

.. |actions_linux| image:: https://github.com/repo-helper/pyproject-examples/workflows/Linux/badge.svg
	:target: https://github.com/repo-helper/pyproject-examples/actions?query=workflow%3A%22Linux%22
	:alt: Linux Test Status

.. |actions_windows| image:: https://github.com/repo-helper/pyproject-examples/workflows/Windows/badge.svg
	:target: https://github.com/repo-helper/pyproject-examples/actions?query=workflow%3A%22Windows%22
	:alt: Windows Test Status

.. |actions_macos| image:: https://github.com/repo-helper/pyproject-examples/workflows/macOS/badge.svg
	:target: https://github.com/repo-helper/pyproject-examples/actions?query=workflow%3A%22macOS%22
	:alt: macOS Test Status

.. |actions_flake8| image:: https://github.com/repo-helper/pyproject-examples/workflows/Flake8/badge.svg
	:target: https://github.com/repo-helper/pyproject-examples/actions?query=workflow%3A%22Flake8%22
	:alt: Flake8 Status

.. |actions_mypy| image:: https://github.com/repo-helper/pyproject-examples/workflows/mypy/badge.svg
	:target: https://github.com/repo-helper/pyproject-examples/actions?query=workflow%3A%22mypy%22
	:alt: mypy status

.. |requires| image:: https://dependency-dash.repo-helper.uk/github/repo-helper/pyproject-examples/badge.svg
	:target: https://dependency-dash.repo-helper.uk/github/repo-helper/pyproject-examples/
	:alt: Requirements Status

.. |codefactor| image:: https://img.shields.io/codefactor/grade/github/repo-helper/pyproject-examples?logo=codefactor
	:target: https://www.codefactor.io/repository/github/repo-helper/pyproject-examples
	:alt: CodeFactor Grade

.. |pypi-version| image:: https://img.shields.io/pypi/v/pyproject-examples
	:target: https://pypi.org/project/pyproject-examples/
	:alt: PyPI - Package Version

.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/pyproject-examples?logo=python&logoColor=white
	:target: https://pypi.org/project/pyproject-examples/
	:alt: PyPI - Supported Python Versions

.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/pyproject-examples
	:target: https://pypi.org/project/pyproject-examples/
	:alt: PyPI - Supported Implementations

.. |wheel| image:: https://img.shields.io/pypi/wheel/pyproject-examples
	:target: https://pypi.org/project/pyproject-examples/
	:alt: PyPI - Wheel

.. |license| image:: https://img.shields.io/github/license/repo-helper/pyproject-examples
	:target: https://github.com/repo-helper/pyproject-examples/blob/master/LICENSE
	:alt: License

.. |language| image:: https://img.shields.io/github/languages/top/repo-helper/pyproject-examples
	:alt: GitHub top language

.. |commits-since| image:: https://img.shields.io/github/commits-since/repo-helper/pyproject-examples/v2023.6.30
	:target: https://github.com/repo-helper/pyproject-examples/pulse
	:alt: GitHub commits since tagged version

.. |commits-latest| image:: https://img.shields.io/github/last-commit/repo-helper/pyproject-examples
	:target: https://github.com/repo-helper/pyproject-examples/commit/master
	:alt: GitHub last commit

.. |maintained| image:: https://img.shields.io/maintenance/yes/2023
	:alt: Maintenance

.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/pyproject-examples
	:target: https://pypi.org/project/pyproject-examples/
	:alt: PyPI - Downloads

.. end shields

Installation
--------------

.. start installation

``pyproject-examples`` can be installed from PyPI.

To install with ``pip``:

.. code-block:: bash

	$ python -m pip install pyproject-examples

.. end installation


Usage
--------

``pyproject-examples`` provides the following API:


``pyproject_examples`` module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

``valid_pep621_config``
*************************

A list of `pytest params`_ for valid ``pyproject.toml`` files per `PEP 621`_.
The params contain the ``pyproject.toml`` content as a string.
Each param has its own unique ID, which can be seen in the source
`here <https://github.com/repo-helper/pyproject-examples/blob/master/pyproject_examples/__init__.py#L68>`__.

.. _pytest params: https://docs.pytest.org/en/6.2.x/reference.html#pytest-param:
.. _PEP 621: https://peps.python.org/pep-0621/


``bad_pep621_config``
*************************

A list of `pytest params`_ for invalid ``pyproject.toml`` files per `PEP 621`_.
Each param contains the ``pyproject.toml`` content (as a string),
the expected Python exception (for catching with `pytest.raises`_), and the expected exception text (for passing as the ``match`` argument to ``pytest.raises``.
Each param also has its own unique ID, which can be seen in the source `here <https://github.com/repo-helper/pyproject-examples/blob/master/pyproject_examples/__init__.py#L88>`__.

.. _pytest.raises: https://docs.pytest.org/en/6.2.x/reference.html#pytest.raises


``valid_buildsystem_config``
*******************************

A list of `pytest params`_ for valid ``[build-system]`` tables from ``pyproject.toml`` files per `PEP 517`_ and `PEP 517`_.
The params contain the ``pyproject.toml`` content as a string.
Each param has its own unique ID, which can be seen in the source
`here <https://github.com/repo-helper/pyproject-examples/blob/master/pyproject_examples/__init__.py#L191>`__.

.. _PEP 517: https://peps.python.org/pep-0517/
.. _PEP 518: https://peps.python.org/pep-0518/


``bad_buildsystem_config``
****************************

A list of `pytest params`_ for invalid ``[build-system]`` tables from ``pyproject.toml`` files per `PEP 517`_ and `PEP 517`_.
Each param contains the ``pyproject.toml`` content (as a string),
the expected Python exception (for catching with `pytest.raises`_), and the expected exception text (for passing as the ``match`` argument to ``pytest.raises``.
Each param also has its own unique ID, which can be seen in the source `here <https://github.com/repo-helper/pyproject-examples/blob/master/pyproject_examples/__init__.py#206>`__.


``pyproject_examples.example_configs`` submodule
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This module contains the example configuration files themselves.
Each file is stored as a string.

The configuration files are:

* ``MINIMAL_CONFIG``
* ``KEYWORDS``
* ``AUTHORS``
* ``UNICODE``
* ``MAINTAINERS``
* ``CLASSIFIERS``
* ``DEPENDENCIES``
* ``OPTIONAL_DEPENDENCIES``
* ``OPTIONAL_DEPENDENCIES_EMPTY_GROUP``
* ``URLS``
* ``ENTRY_POINTS``
* ``COMPLETE_PROJECT_A``
* ``COMPLETE_A``
* ``COMPLETE_B``
* ``COMPLETE_A_WITH_FILES``
* ``DYNAMIC_REQUIREMENTS``
* ``LONG_REQUIREMENTS``


``pyproject_examples.utils`` submodule
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This module contains utility functions.

``file_not_found_regex(filename: str) -> str``
************************************************

This function create a regular expression for testing ``FileNotFoundError``\s.

This is useful for testing error messages between Windows and POSIX, as well as between CPython and PyPy.

**filename** The filename which can't be found.