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

Ensure pure-Python implementations **do not** invoke code from the binary extension. #160

Merged
merged 39 commits into from
Jan 6, 2020

Commits on Jan 5, 2020

  1. Renaming files that have binary extension speedups.

    The goal is to replace the original names with a wrapper that
    **only** exports the parts needed elsewhere and put the pure Python
    implementations by themselves.
    
    Done via:
    
    ```
    git mv _curve_helpers.py _py_curve_helpers.py
    git mv _geometric_intersection.py _py_geometric_intersection.py
    git mv _helpers.py _py_helpers.py
    git mv _intersection_helpers.py _py_intersection_helpers.py
    git mv _surface_helpers.py _py_surface_helpers.py
    git mv _surface_intersection.py _py_surface_intersection.py
    ```
    
    Found these modules via:
    
    ```
    git grep -l 'if _speedup is None'
    ```
    dhermes committed Jan 5, 2020
    Configuration menu
    Copy the full SHA
    a321767 View commit details
    Browse the repository at this point in the history
  2. Adding _wrap* modules.

    These are intended to stand in for the previous modules, and the rename
    is intentional (and temporary) to suss out places where the imports
    are relying on pure Python parts vs. parts that could either by
    Python or speedup.
    dhermes committed Jan 5, 2020
    Configuration menu
    Copy the full SHA
    e4fb7be View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    850e93d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    cff9a2b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e83300a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c4c1561 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7e03452 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    9554d99 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    5ee32df View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    a4ba4d7 View commit details
    Browse the repository at this point in the history
  11. Fixing remaining naming issues in src/.

    Found via `nox -s lint`.
    dhermes committed Jan 5, 2020
    Configuration menu
    Copy the full SHA
    abbfa6d View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    da47de7 View commit details
    Browse the repository at this point in the history
  13. Renaming test files impacted by rename.

    Done via:
    
    ```
    git mv test__curve_helpers.py test_py_curve_helpers.py
    git mv test__geometric_intersection.py test_py_geometric_intersection.py
    git mv test__helpers.py test_py_helpers.py
    git mv test__intersection_helpers.py test_py_intersection_helpers.py
    git mv test__surface_helpers.py test_py_surface_helpers.py
    git mv test__surface_intersection.py test_py_surface_intersection.py
    ```
    
    No code edits were made in this commit, but some will need to be
    done to fix imports and split out the "wrap" portions.
    dhermes committed Jan 5, 2020
    Configuration menu
    Copy the full SHA
    6b01ee7 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    15076fd View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    4b8908b View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    ed0b554 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    cbafd53 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    682bad7 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    30dc547 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    193640d View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    7b050cc View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    8dd88fb View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    fb1d9a1 View commit details
    Browse the repository at this point in the history
  24. Renaming all test_py* to test__py* to match convention.

    Done via:
    
    ```
    cd test/unit/
    git mv test_py_curve_helpers.py test__py_curve_helpers.py
    git mv test_py_geometric_intersection.py test__py_geometric_intersection.py
    git mv test_py_helpers.py test__py_helpers.py
    git mv test_py_intersection_helpers.py test__py_intersection_helpers.py
    git mv test_py_surface_helpers.py test__py_surface_helpers.py
    git mv test_py_surface_intersection.py test__py_surface_intersection.py
    ```
    dhermes committed Jan 5, 2020
    Configuration menu
    Copy the full SHA
    7cc3748 View commit details
    Browse the repository at this point in the history

Commits on Jan 6, 2020

  1. Fixing broken unit tests.

    In the process had to fix a runtime import of a Python
    module within `_speedup.pyx`.
    dhermes committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    07a2650 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    979d287 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    21e4b2e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e6de54d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    518b1c7 View commit details
    Browse the repository at this point in the history
  6. Renaming Test__{name} to Test_{name}.

    This was for functions that also occurred as `_speedup.{name}` that
    have now been renamed (from `_{name}`) to `{name}`.
    
    Also cleaned up the `_{name}` references in documentation wherever
    I could find references.
    dhermes committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    8fa1eb1 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    074bd1b View commit details
    Browse the repository at this point in the history
  8. Removing _wrap* prefixes in files.

    This was only temporary to ensure all the old names had been properly
    moved.
    
    Done via:
    
    ```
    git mv src/python/bezier/_wrap_curve_helpers.py src/python/bezier/_curve_helpers.py
    git mv src/python/bezier/_wrap_geometric_intersection.py src/python/bezier/_geometric_intersection.py
    git mv src/python/bezier/_wrap_helpers.py src/python/bezier/_helpers.py
    git mv src/python/bezier/_wrap_intersection_helpers.py src/python/bezier/_intersection_helpers.py
    git mv src/python/bezier/_wrap_surface_helpers.py src/python/bezier/_surface_helpers.py
    git mv src/python/bezier/_wrap_surface_intersection.py src/python/bezier/_surface_intersection.py
    git mv tests/unit/test__wrap_curve_helpers.py tests/unit/test__curve_helpers.py
    git mv tests/unit/test__wrap_geometric_intersection.py tests/unit/test__geometric_intersection.py
    git mv tests/unit/test__wrap_helpers.py tests/unit/test__helpers.py
    git mv tests/unit/test__wrap_intersection_helpers.py tests/unit/test__intersection_helpers.py
    git mv tests/unit/test__wrap_surface_helpers.py tests/unit/test__surface_helpers.py
    git mv tests/unit/test__wrap_surface_intersection.py tests/unit/test__surface_intersection.py
    ```
    
    A subsequent commit will update the **references** to these files.
    dhermes committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    ccd8d30 View commit details
    Browse the repository at this point in the history
  9. Updating (most) references to _wrap* prefixed modules.

    Done via:
    
    ```
    git grep -l _wrap -- ':(exclude)*.c' | xargs sed -i s/_wrap/''/g
    ```
    
    Still need to follow-up to:
    
    - Resolve lint errors due to alphabetical ordering of imports
    - Re-generate `*.c` files with Cython
    dhermes committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    6983002 View commit details
    Browse the repository at this point in the history
  10. Re-generated Cython files.

    dhermes committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    7750410 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    937de5d View commit details
    Browse the repository at this point in the history
  12. Style nits.

    Slipped in some changes where `black` does not have an "opinion".
    In particular, tried to make sure there is an empty line after the
    LICENSE header and make sure there are 2 empty lines between imports
    and constants.
    dhermes committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    da346df View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    4f49f9d View commit details
    Browse the repository at this point in the history
  14. Modifying **when** the slow pytest marker gets applied.

    - Removing the `HAS_SPEEDUP` check since the tests for the pure Python
      implementations now eschew usage of speedups (even if present)
    - Explicitly re-defining the marked methods in the subclass to
      avoid marking them as slow
    dhermes committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    e55f549 View commit details
    Browse the repository at this point in the history
  15. Resolving pylint issue with no-op method re-definitions.

    Pylint (correctly) flagged them as `useless-super-delegation`
    and so I disabled the rule for the few methods where I re-defined
    methods to drop the `slow` mark in pytest.
    dhermes committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    d7421e2 View commit details
    Browse the repository at this point in the history