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

BUG,MAINT: Depend on build #1387

Merged
merged 7 commits into from
Feb 21, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
os: ["ubuntu-latest"]
python-version: ["3.7", "3.12", "pypy-3.8", "pypy-3.9"]
r-version: ['release']
timeout-minutes: 30
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
os: ["windows-latest"]
python-version: ["3.7"]
timeout-minutes: 30
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
Expand Down
21 changes: 6 additions & 15 deletions asv/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,8 @@ def __init__(self, conf, python, requirements, tagged_env_vars):
# These are needed for asv to build and run the project, not part of
# benchmark name mangling
self._base_requirements = {}
# gh-1385
self._base_requirements["pip+build"] = ""
# gh-1314
asv_runner_path = os.getenv("ASV_RUNNER_PATH", "")
module_path = Path(asv_runner_path) / "asv_runner"
Expand Down Expand Up @@ -542,7 +544,6 @@ def __init__(self, conf, python, requirements, tagged_env_vars):

pyproject_path = Path.cwd() / "pyproject.toml"
if pyproject_path.exists():
self._base_requirements["build"] = ""
with open(pyproject_path, "rb") as pyproject_file:
pyproject_data = tomli.load(pyproject_file)
requires = pyproject_data.get("build-system", {}).get("requires", [])
Expand Down Expand Up @@ -916,24 +917,14 @@ def _build_project(self, repo, commit_hash, build_dir):
"""
Run build commands
"""
build_dir_path = Path(build_dir)

def has_file(file_name):
return (build_dir_path / file_name).exists()

cmd = self._build_command

if cmd is None:
if has_file('pyproject.toml'):
cmd = [
"python -m build",
"python -mpip wheel -w {build_cache_dir} {build_dir}"
]
else:
cmd = [
"python setup.py build",
"python -mpip wheel -w {build_cache_dir} {build_dir}"
]
cmd = [
"PIP_NO_BUILD_ISOLATION=0 python -m build",
"python -mpip wheel -w {build_cache_dir} {build_dir}"
]
Comment on lines +924 to +927
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this run wheel after running build, which would have already built a wheel?

Also, the call to build should probably pass --wheel, because I don't think the sdist is used for anything.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I just remembered that pip wheel downloads wheels for dependencies as well, so I guess that's why it's used?

The problem seems to be that it says it's building the wheel again, which seems redundant (though it's not verbose, so I can't tell if it's just saying that or is really doing a whole build again.)


if cmd:
commit_name = repo.get_decorated_hash(commit_hash, 8)
Expand Down
1 change: 1 addition & 0 deletions changelog.d/+1387.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``build`` is now the default backend for ``asv`` to install projects.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dynamic = [
dependencies = [
"asv-runner>=v0.2.1",
"json5",
"build",
"tabulate",
"virtualenv",
"tomli",
Expand Down
3 changes: 3 additions & 0 deletions test/test_find.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
WIN = (os.name == 'nt')


@pytest.mark.skipif(tools.HAS_PYPY, reason="Times out randomly on pypy")
def test_find(capfd, tmpdir):
values = [
(None, None),
Expand Down Expand Up @@ -67,6 +68,7 @@ def get_result_files():
assert get_result_files() == prev_result_files


@pytest.mark.skipif(tools.HAS_PYPY, reason="Times out randomly on pypy")
@pytest.mark.flaky(reruns=1, reruns_delay=5) # depends on a timeout
def test_find_timeout(capfd, tmpdir):
values = [
Expand Down Expand Up @@ -95,6 +97,7 @@ def test_find_timeout(capfd, tmpdir):
assert "asv: benchmark timed out (timeout 1.0s)" in output


@pytest.mark.skipif(tools.HAS_PYPY, reason="Times out randomly on pypy")
def test_find_inverted(capfd, tmpdir):
values = [
(5, 6),
Expand Down
Loading