Skip to content

Commit

Permalink
fix and update packaging
Browse files Browse the repository at this point in the history
* drop empty setup.py which "breaks" on incomplete build envs
* use the build package to build the dist
* update the gh workflow to use it

fixup noise from pre-commit
  • Loading branch information
RonnyPfannschmidt committed Oct 25, 2022
1 parent 31e80c8 commit 0c981d3
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ jobs:
- name: Install wheel
run: |
python -m pip install --upgrade pip
pip install wheel
pip install build
- name: Build package
run: |
python setup.py sdist bdist_wheel
python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_token }}
1 change: 0 additions & 1 deletion changelog/812.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ the fixture, the fixture was created only once.
So restore the old behavior for typical cases where the number of tests is
much greater than the number of workers (or, strictly speaking, when there
are at least 2 tests for every node).

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[build-system]
requires = [
# sync with setup.py until we discard non-pep-517/518
"setuptools>=45.0",
"setuptools-scm[toml]>=6.2.3",
"wheel",

This comment has been minimized.

Copy link
@webknjaz

webknjaz Nov 4, 2022

Member

@RonnyPfannschmidt FYI wheel is unnecessary here too, it's already auto-added by setuptools.

This comment has been minimized.

Copy link
@graingert

This comment has been minimized.

This comment has been minimized.

Copy link
@webknjaz

webknjaz Nov 5, 2022

Member

@graingert setuptools' PEP 517 back-end emits it dynamically through the hook for extra wheel building dependencies. It's been like that since it was first implemented. But because of some historical confusion the docs had the suggestion to add wheel via pyproject.toml meaning that it'd get pulled in during the sdist builds too which is absolutely unnecessary. I removed it from the setuptools docs a while ago.

Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ python_requires = >=3.6
install_requires =
execnet>=1.1
pytest>=6.2.0
setup_requires = # left empty, enforce using isolated build system

[options.packages.find]
where = src
Expand Down
4 changes: 0 additions & 4 deletions setup.py

This file was deleted.

4 changes: 3 additions & 1 deletion src/xdist/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ def pytest_xdist_auto_num_workers(config):
try:
return int(env_var)
except ValueError:
warnings.warn("PYTEST_XDIST_AUTO_NUM_WORKERS is not a number: {env_var!r}. Ignoring it.")
warnings.warn(
"PYTEST_XDIST_AUTO_NUM_WORKERS is not a number: {env_var!r}. Ignoring it."
)

try:
import psutil
Expand Down
4 changes: 2 additions & 2 deletions src/xdist/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class Producer:
"""
Simplified implementation of the same interface as py.log, for backward compatibility
since we dropped the dependency on pylib.
Note: this is defined here because this module can't depend on xdist, so we need
to have the other way around.
Note: this is defined here because this module can't depend on xdist, so we need
to have the other way around.
"""

def __init__(self, name: str, *, enabled: bool = True):
Expand Down
3 changes: 2 additions & 1 deletion testing/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
@pytest.fixture
def monkeypatch_3_cpus(monkeypatch: pytest.MonkeyPatch):
"""Make pytest-xdist believe the system has 3 CPUs"""
monkeypatch.setitem(sys.modules, "psutil", None) # block import
# block import
monkeypatch.setitem(sys.modules, "psutil", None) # type: ignore
monkeypatch.delattr(os, "sched_getaffinity", raising=False)
monkeypatch.setattr(os, "cpu_count", lambda: 3)

Expand Down

0 comments on commit 0c981d3

Please sign in to comment.