From 06199825b0ee41e139a4e28500747d3cec5cc261 Mon Sep 17 00:00:00 2001 From: seljaks <33955366+seljaks@users.noreply.github.com> Date: Mon, 3 Oct 2022 16:06:22 +0200 Subject: [PATCH 1/6] DOC: add section on bisect GH35685 --- doc/source/development/maintaining.rst | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/doc/source/development/maintaining.rst b/doc/source/development/maintaining.rst index 1bff2eccd3d27..438b5f0c0ac1b 100644 --- a/doc/source/development/maintaining.rst +++ b/doc/source/development/maintaining.rst @@ -121,6 +121,46 @@ Here's a typical workflow for triaging a newly opened issue. unless it's know that this issue should be addressed in a specific release (say because it's a large regression). +.. _maintaining.regressions: + +Investigating regressions +------------------------- + +Regressions are bugs that unintentionally break previously working pandas code. +The common way to investigate regressions is by using `git bisect `_, +which finds the first commit after the bug appears. + +For example: a user reports that ``pd.Series([1, 1]).sum()`` returns ``3`` +in pandas version ``1.5.0`` while in version ``1.4.0`` it returned ``2``. To begin, +create a file ``t.py`` in your pandas directory, which contains + +.. code-block:: python + + import pandas as pd + assert pd.Series([1, 1]).sum() == 2 + +and then run:: + + git bisect start + git bisect good v1.4.0 + git bisect bad v1.5.0 + git bisect run bash -c "python setup.py build_ext -j 4; python t.py" + +This finds the first commit that changed the behavior. To finish, exit bisect and +rebuilt the latest C extensions with:: + + git bisect reset + python setup.py build_ext -j 4 + +Lastly, report your findings under the corresponding issue and ping the commit author to +get their input. + +.. note:: + The ``run`` command above will treat commits where ``t.py`` exits with ``0`` as good and other + exits as bad. When raising an error is the desired behavior, wrap the code in an appropriate + ``try/except`` statement. See `GH35650 `_ for + more examples. + .. _maintaining.closing: Closing issues From 046badbd2c9eb76abd07b2db0fcc33be705c6dbf Mon Sep 17 00:00:00 2001 From: seljaks <33955366+seljaks@users.noreply.github.com> Date: Mon, 3 Oct 2022 20:18:53 +0200 Subject: [PATCH 2/6] DOC: added whatsnew entry GH35685 --- doc/source/whatsnew/v1.6.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/source/whatsnew/v1.6.0.rst b/doc/source/whatsnew/v1.6.0.rst index 098750aa3a2b2..062aaf407a4d8 100644 --- a/doc/source/whatsnew/v1.6.0.rst +++ b/doc/source/whatsnew/v1.6.0.rst @@ -35,6 +35,7 @@ Other enhancements - Added ``index`` parameter to :meth:`DataFrame.to_dict` (:issue:`46398`) - Added metadata propagation for binary operators on :class:`DataFrame` (:issue:`28283`) - :class:`.CategoricalConversionWarning`, :class:`.InvalidComparison`, :class:`.InvalidVersion`, :class:`.LossySetitemError`, and :class:`.NoBufferPresent` are now exposed in ``pandas.errors`` (:issue:`27656`) +- Added section on :ref:`investigating regressions ` using ``git bisect`` to contributing guide (:issue:`35685`) - .. --------------------------------------------------------------------------- From f181914f99afda10a372af16be0c1788564a1b04 Mon Sep 17 00:00:00 2001 From: seljaks <33955366+seljaks@users.noreply.github.com> Date: Thu, 6 Oct 2022 10:38:47 +0200 Subject: [PATCH 3/6] DOC: modified bisect section GH35685 --- doc/source/development/maintaining.rst | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/doc/source/development/maintaining.rst b/doc/source/development/maintaining.rst index 438b5f0c0ac1b..e12f4abda385c 100644 --- a/doc/source/development/maintaining.rst +++ b/doc/source/development/maintaining.rst @@ -126,9 +126,10 @@ Here's a typical workflow for triaging a newly opened issue. Investigating regressions ------------------------- -Regressions are bugs that unintentionally break previously working pandas code. -The common way to investigate regressions is by using `git bisect `_, -which finds the first commit after the bug appears. +Regressions are bugs that unintentionally break previously working code. The common way +to investigate regressions is by using +`git bisect `_, +which finds the first commit that introduced the bug. For example: a user reports that ``pd.Series([1, 1]).sum()`` returns ``3`` in pandas version ``1.5.0`` while in version ``1.4.0`` it returned ``2``. To begin, @@ -146,19 +147,21 @@ and then run:: git bisect bad v1.5.0 git bisect run bash -c "python setup.py build_ext -j 4; python t.py" -This finds the first commit that changed the behavior. To finish, exit bisect and -rebuilt the latest C extensions with:: +This finds the first commit that changed the behavior. The C extensions have to be +rebuilt at every step, so the search can take a while. + +Exit bisect and rebuild the current version:: git bisect reset python setup.py build_ext -j 4 -Lastly, report your findings under the corresponding issue and ping the commit author to -get their input. +Report your findings under the corresponding issue and ping the commit author to get +their input. .. note:: - The ``run`` command above will treat commits where ``t.py`` exits with ``0`` as good and other - exits as bad. When raising an error is the desired behavior, wrap the code in an appropriate - ``try/except`` statement. See `GH35650 `_ for + In the ``bisect run`` command above, commits are considered good if ``t.py`` exits + with ``0`` and bad otherwise. When raising an exception is the desired behavior, + wrap the code in an appropriate ``try/except`` statement. See :issue:`35685` for more examples. .. _maintaining.closing: From 6364688c95aab39118895a40bde81e80f8a1ecc1 Mon Sep 17 00:00:00 2001 From: seljaks <33955366+seljaks@users.noreply.github.com> Date: Thu, 6 Oct 2022 10:39:11 +0200 Subject: [PATCH 4/6] DOC: modified whatsnew entry on bisect --- doc/source/whatsnew/v1.6.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.6.0.rst b/doc/source/whatsnew/v1.6.0.rst index 062aaf407a4d8..1404b96529643 100644 --- a/doc/source/whatsnew/v1.6.0.rst +++ b/doc/source/whatsnew/v1.6.0.rst @@ -35,7 +35,7 @@ Other enhancements - Added ``index`` parameter to :meth:`DataFrame.to_dict` (:issue:`46398`) - Added metadata propagation for binary operators on :class:`DataFrame` (:issue:`28283`) - :class:`.CategoricalConversionWarning`, :class:`.InvalidComparison`, :class:`.InvalidVersion`, :class:`.LossySetitemError`, and :class:`.NoBufferPresent` are now exposed in ``pandas.errors`` (:issue:`27656`) -- Added section on :ref:`investigating regressions ` using ``git bisect`` to contributing guide (:issue:`35685`) +- Added section on :ref:`investigating regressions ` using ``git bisect`` to development guide (:issue:`35685`) - .. --------------------------------------------------------------------------- From dd8485f247ff443d6179e5d15102f53cb9bcaddd Mon Sep 17 00:00:00 2001 From: seljaks <33955366+seljaks@users.noreply.github.com> Date: Thu, 6 Oct 2022 14:03:28 +0200 Subject: [PATCH 5/6] Revert "DOC: modified whatsnew entry on bisect" This reverts commit 6364688c95aab39118895a40bde81e80f8a1ecc1. --- doc/source/whatsnew/v1.6.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.6.0.rst b/doc/source/whatsnew/v1.6.0.rst index 9eb41ee54c55a..7b7fe8b7cd036 100644 --- a/doc/source/whatsnew/v1.6.0.rst +++ b/doc/source/whatsnew/v1.6.0.rst @@ -35,7 +35,7 @@ Other enhancements - Added ``index`` parameter to :meth:`DataFrame.to_dict` (:issue:`46398`) - Added metadata propagation for binary operators on :class:`DataFrame` (:issue:`28283`) - :class:`.CategoricalConversionWarning`, :class:`.InvalidComparison`, :class:`.InvalidVersion`, :class:`.LossySetitemError`, and :class:`.NoBufferPresent` are now exposed in ``pandas.errors`` (:issue:`27656`) -- Added section on :ref:`investigating regressions ` using ``git bisect`` to development guide (:issue:`35685`) +- Added section on :ref:`investigating regressions ` using ``git bisect`` to contributing guide (:issue:`35685`) - .. --------------------------------------------------------------------------- From bd94782495bad0b81c20ec76cb3d6bb92e0e98ec Mon Sep 17 00:00:00 2001 From: seljaks <33955366+seljaks@users.noreply.github.com> Date: Thu, 6 Oct 2022 14:03:51 +0200 Subject: [PATCH 6/6] Revert "DOC: added whatsnew entry GH35685" This reverts commit 046badbd2c9eb76abd07b2db0fcc33be705c6dbf. --- doc/source/whatsnew/v1.6.0.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/source/whatsnew/v1.6.0.rst b/doc/source/whatsnew/v1.6.0.rst index 7b7fe8b7cd036..0bc91d3cd9637 100644 --- a/doc/source/whatsnew/v1.6.0.rst +++ b/doc/source/whatsnew/v1.6.0.rst @@ -35,7 +35,6 @@ Other enhancements - Added ``index`` parameter to :meth:`DataFrame.to_dict` (:issue:`46398`) - Added metadata propagation for binary operators on :class:`DataFrame` (:issue:`28283`) - :class:`.CategoricalConversionWarning`, :class:`.InvalidComparison`, :class:`.InvalidVersion`, :class:`.LossySetitemError`, and :class:`.NoBufferPresent` are now exposed in ``pandas.errors`` (:issue:`27656`) -- Added section on :ref:`investigating regressions ` using ``git bisect`` to contributing guide (:issue:`35685`) - .. ---------------------------------------------------------------------------