From 3284ea088bbdc3b914dc2be98d150a31e04322dc Mon Sep 17 00:00:00 2001 From: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com> Date: Thu, 9 Mar 2023 17:56:54 -0600 Subject: [PATCH] Fix `tox -e docs` for macOS (#9765) * Fix `tox -e docs` for macOS Co-authored-by: Jake Lishman * Fix two issues. Duh, thanks Jake * Update Azure job to set RUST_DEBUG Not strictly necessary since Tox already sets it. But makes things consistent and avoids accidentally removing this in the future --------- Co-authored-by: Jake Lishman --- .azure/docs-linux.yml | 3 +-- setup.py | 12 +++++++++--- tox.ini | 14 +++----------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.azure/docs-linux.yml b/.azure/docs-linux.yml index 99baf23607..8c44558ffa 100644 --- a/.azure/docs-linux.yml +++ b/.azure/docs-linux.yml @@ -9,6 +9,7 @@ jobs: variables: PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip + RUST_DEBUG: 1 steps: - checkout: self @@ -29,8 +30,6 @@ jobs: - bash: | tox -edocs displayName: 'Run Docs build' - env: - SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" - task: ArchiveFiles@2 inputs: diff --git a/setup.py b/setup.py index 7f6f2cb5b9..5adeeb9fa2 100755 --- a/setup.py +++ b/setup.py @@ -14,8 +14,7 @@ import os import re -import sys -from setuptools import setup, find_packages, Extension +from setuptools import setup, find_packages from setuptools_rust import Binding, RustExtension @@ -100,7 +99,14 @@ setup( "Source Code": "https://github.com/Qiskit/qiskit-terra", }, rust_extensions=[ - RustExtension("qiskit._accelerate", "crates/accelerate/Cargo.toml", binding=Binding.PyO3) + RustExtension( + "qiskit._accelerate", + "crates/accelerate/Cargo.toml", + binding=Binding.PyO3, + # If RUST_DEBUG is set, force compiling in debug mode. Else, use the default behavior + # of whether it's an editable installation. + debug=True if os.getenv("RUST_DEBUG") == "1" else None, + ) ], zip_safe=False, entry_points={ diff --git a/tox.ini b/tox.ini index 289e712568..1ed8d1e69b 100644 --- a/tox.ini +++ b/tox.ini @@ -67,24 +67,16 @@ commands = coverage3 report [testenv:docs] +# Editable mode breaks macOS: https://github.com/sphinx-doc/sphinx/issues/10943 +usedevelop = False basepython = python3 setenv = {[testenv]setenv} QISKIT_SUPPRESS_PACKAGING_WARNINGS=Y + RUST_DEBUG=1 # Faster to compile. deps = setuptools_rust # This is work around for the bug of tox 3 (see #8606 for more details.) -r{toxinidir}/requirements-dev.txt qiskit-aer commands = sphinx-build -W -j auto -T --keep-going -b html docs/ docs/_build/html {posargs} - -[pycodestyle] -max-line-length = 105 -# default ignores + E741 because of opflow global variable I -# + E203 because of a difference of opinion with black -# codebase does currently comply with: E133, E242, E704, W505 -ignore = E121, E123, E126, E133, E226, E241, E242, E704, W503, W504, W505, E741, E203 - -[flake8] -max-line-length = 105 -extend-ignore = E203, E741