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

Add env variable to Python builds to force debug builds #876

Merged
merged 4 commits into from
May 17, 2023

Conversation

mtreinish
Copy link
Member

This commit updates the setup.py for the python package to add a new env variable RUST_DEBUG to force the package to be built in debug mode. By default pip install will build the rust code in release mode, which is the sane default you want for publishing or installing a package. But for local development you typically want to build normally in debug mode. This increases the build speed and also adds additional runtime checking to validate the code is fully working. The tradeoff with this though is the runtime is very poor because the compiler doesn't do any optimization.

As part of this commit the tox configuration is updated to default to debug builds. For unit tests the execution time is unchanged, because while it compiles faster that is offset by the slower execution of the tests. However, in general I think it's better to run tests in debug mode by default because it will do runtime validation (e.g. bounds checks overflow detection, etc) which is good to catch in testing.

This commit updates the setup.py for the python package to add a new env
variable `RUST_DEBUG` to force the package to be built in debug mode. By
default pip install will build the rust code in release mode, which is
the sane default you want for publishing or installing a package. But
for local development you typically want to build normally in debug
mode. This increases the build speed and also adds additional runtime
checking to validate the code is fully working. The tradeoff with this
though is the runtime is very poor because the compiler doesn't do any
optimization.

As part of this commit the tox configuration is updated to default to
debug builds. For unit tests the execution time is unchanged, because
while it compiles faster that is offset by the slower execution of the
tests. However, in general I think it's better to run tests in debug
mode by default because it will do runtime validation (e.g. bounds checks
overflow detection, etc) which is good to catch in testing.
@coveralls
Copy link

coveralls commented May 16, 2023

Pull Request Test Coverage Report for Build 5008762644

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.007%) to 96.541%

Files with Coverage Reduction New Missed Lines %
src/shortest_path/all_pairs_bellman_ford.rs 1 98.88%
Totals Coverage Status
Change from base Build 5007935631: -0.007%
Covered Lines: 14570
Relevant Lines: 15092

💛 - Coveralls

Copy link
Collaborator

@IvanIsCoding IvanIsCoding left a comment

Choose a reason for hiding this comment

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

I think this is a good idea, extra checks on tests are welcome and I think they are worth the extra time.

I just made suggestions on the name of the variable, I just felt that RUST_* variables are more reserved to the language than to us

setup.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
@IvanIsCoding IvanIsCoding added the automerge Queue a approved PR for merging label May 17, 2023
@mergify mergify bot merged commit 171aa31 into Qiskit:main May 17, 2023
IvanIsCoding added a commit to IvanIsCoding/rustworkx that referenced this pull request May 26, 2023
* Add env variable to Python builds to force debug builds

This commit updates the setup.py for the python package to add a new env
variable `RUST_DEBUG` to force the package to be built in debug mode. By
default pip install will build the rust code in release mode, which is
the sane default you want for publishing or installing a package. But
for local development you typically want to build normally in debug
mode. This increases the build speed and also adds additional runtime
checking to validate the code is fully working. The tradeoff with this
though is the runtime is very poor because the compiler doesn't do any
optimization.

As part of this commit the tox configuration is updated to default to
debug builds. For unit tests the execution time is unchanged, because
while it compiles faster that is offset by the slower execution of the
tests. However, in general I think it's better to run tests in debug
mode by default because it will do runtime validation (e.g. bounds checks
overflow detection, etc) which is good to catch in testing.

* Apply suggestions from code review

Co-authored-by: Ivan Carvalho <[email protected]>

---------

Co-authored-by: Ivan Carvalho <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Queue a approved PR for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants