Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update changelog, minor touchups #469

Merged
merged 4 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
PY_COLORS: 1
TOX_PARALLEL_NO_SPINNER: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.9

Expand All @@ -29,5 +29,5 @@ jobs:
- name: Setup run environment
run: tox -vv --notest -e docs

- name: Run check for type
- name: Run check for docs
run: tox -e docs --skip-pkg-install
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ jobs:
- { py: '3.11-dev', os: windows }

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.py }}

Expand All @@ -74,7 +74,7 @@ jobs:
shell: python

- name: Setup python for tox
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.9

Expand Down Expand Up @@ -116,10 +116,10 @@ jobs:
PY_COLORS: 1
TOX_PARALLEL_NO_SPINNER: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.9

Expand Down
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ repos:
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==22.3.0]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
Expand All @@ -45,3 +50,14 @@ repos:
hooks:
- id: codespell
args: ["-L", "sur"]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.9.0"
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-log-warn
- id: python-no-eval
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
6 changes: 5 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
version: 2

build:
os: ubuntu-20.04
tools:
python: '3.10'

python:
version: 3.8
install:
- method: pip
path: .
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,23 @@ Unreleased
- Add schema validation for ``build-system`` table to check conformity
with PEP 517 and PEP 518 (`PR #365`_, Fixes `#364`_)

- Better support for Python 3.11 (sysconfig schemes `PR #434`_, `PR #463`_, tomllib `PR #443`_, warnings `PR #420`_)

- Improved error printouts (`PR #442`_)

- Avoid importing packaging unless needed (`PR #395`_, Fixes `#393`_)

.. _PR #365: https://github.com/pypa/build/pull/365
.. _PR #392: https://github.com/pypa/build/pull/392
.. _PR #395: https://github.com/pypa/build/pull/395
.. _PR #420: https://github.com/pypa/build/pull/420
.. _PR #434: https://github.com/pypa/build/pull/434
.. _PR #442: https://github.com/pypa/build/pull/442
.. _PR #443: https://github.com/pypa/build/pull/443
.. _PR #463: https://github.com/pypa/build/pull/463
.. _#364: https://github.com/pypa/build/issues/364
.. _#372: https://github.com/pypa/build/issues/372
.. _#393: https://github.com/pypa/build/pull/393


0.7.0 (16-09-2021)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test =
typing =
importlib-metadata>=4.6.4
mypy==0.942
typing-extensions>=3.7.4.3
typing-extensions>=3.7.4.3;python_version < "3.8"
virtualenv =
virtualenv>=20.0.35

Expand Down
29 changes: 18 additions & 11 deletions src/build/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
build - A simple, correct PEP 517 build frontend
"""

__version__ = '0.7.0'

import contextlib
Expand All @@ -24,6 +25,7 @@
Callable,
Dict,
Iterator,
List,
Mapping,
MutableMapping,
Optional,
Expand Down Expand Up @@ -71,18 +73,18 @@
}


_logger = logging.getLogger('build')
_logger = logging.getLogger(__name__)


class BuildException(Exception):
"""
Exception raised by ProjectBuilder
Exception raised by :class:`ProjectBuilder`
"""


class BuildBackendException(Exception):
"""
Exception raised when the backend fails
Exception raised when a backend operation fails
"""

def __init__(
Expand Down Expand Up @@ -131,7 +133,7 @@ def __str__(self) -> str:

class TypoWarning(Warning):
"""
Warning raised when a potential typo is found
Warning raised when a possible typo is found
"""


Expand Down Expand Up @@ -428,12 +430,13 @@ def build(

def metadata_path(self, output_directory: PathType) -> str:
"""
Generates the metadata directory of a distribution and returns its path.
Generate the metadata directory of a distribution and return its path.

If the backend does not support the ``prepare_metadata_for_build_wheel``
hook, a wheel will be built and the metadata extracted.
hook, a wheel will be built and the metadata will be extracted from it.

:param output_directory: Directory to put the metadata distribution in
:returns: The path of the metadata directory
"""
# prepare_metadata hook
metadata = self.prepare('wheel', output_directory)
Expand Down Expand Up @@ -491,20 +494,20 @@ def _handle_backend(self, hook: str) -> Iterator[None]:
@staticmethod
def log(message: str) -> None:
"""
Prints message
Log a message.

The default implementation uses the logging module but this function can be
overwritten by users to have a different implementation.
overridden by users to have a different implementation.

:param msg: Message to output
:param message: Message to output
"""
if sys.version_info >= (3, 8):
_logger.log(logging.INFO, message, stacklevel=2)
else:
_logger.log(logging.INFO, message)


__all__ = (
__all__ = [
'__version__',
'BuildBackendException',
'BuildException',
Expand All @@ -514,4 +517,8 @@ def log(message: str) -> None:
'RunnerType',
'TypoWarning',
'check_dependency',
)
]


def __dir__() -> List[str]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes tab completion prettier on Python 3.7+.

return __all__
2 changes: 1 addition & 1 deletion src/build/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _error(msg: str, code: int = 1) -> NoReturn: # pragma: no cover
:param code: Error code
"""
print('{red}ERROR{reset} {}'.format(msg, **_STYLES))
exit(code)
raise SystemExit(code)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exit() is not part of the language, it's injected by site.py. Better to use sys.exit(), or even better, just raise SystemExit directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is a bug.



class _ProjectBuilder(ProjectBuilder):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_isolated_env_abstract():


def test_isolated_env_has_executable_still_abstract():
class Env(build.env.IsolatedEnv): # noqa
class Env(build.env.IsolatedEnv):
@property
def executable(self):
raise NotImplementedError
Expand All @@ -92,7 +92,7 @@ def executable(self):


def test_isolated_env_has_install_still_abstract():
class Env(build.env.IsolatedEnv): # noqa
class Env(build.env.IsolatedEnv):
def install(self, requirements):
raise NotImplementedError

Expand Down
9 changes: 9 additions & 0 deletions tests/test_module.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# SPDX-License-Identifier: MIT

import sys

import pytest

import build


def test_version():
assert build.__version__


@pytest.mark.skipif(sys.version_info < (3, 7), reason='Python 3.7+ required for dir support')
def test_dir():
assert set(dir(build)) == set(build.__all__)
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,4 @@ depends = {py311, py310, py39, py38, py37, py36, pypy37, pypy38, pypy39}
max-line-length = 127
max-complexity = 10
extend-ignore = E203
extend-select = B9