Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jGaboardi
Copy link
Member

@jGaboardi jGaboardi commented Oct 22, 2023

This PR kicks off #589. Should we do this:

  1. piece-meal one small PR at a time; or
  2. do one PR, but go incrementally with small chunks + reviews

(This process is going to be a slog... between 2k-3k fixes on first inspection)

@jGaboardi jGaboardi requested a review from martinfleis October 22, 2023 23:31
@jGaboardi jGaboardi self-assigned this Oct 22, 2023
@codecov
Copy link

codecov bot commented Oct 22, 2023

Codecov Report

Merging #597 (c5b8b01) into main (9de3108) will decrease coverage by 0.0%.
The diff coverage is 42.9%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #597     +/-   ##
=======================================
- Coverage   84.5%   84.5%   -0.0%     
=======================================
  Files        128     128             
  Lines      15069   15061      -8     
=======================================
- Hits       12734   12726      -8     
  Misses      2335    2335             
Files Coverage Δ
libpysal/common.py 79.5% <42.9%> (-3.1%) ⬇️

@martinfleis
Copy link
Member

I would do one PR that contains only the automatic fixes by ruff but across the whole code base and than a series of smaller PRs with the rest. The former does not need a ton of review and may resolve quite a lot already.

[tool.ruff.per-file-ignores]
"*__init__.py" = [
"F401", # imported but unused
"F403", # star import; unable to detect undefined names
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to eliminate star imports if possible but that can be a follow-up at some point in the future. It just may be worth opening an issue about it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I completely agree about star imports; and making a separate issue.

@martinfleis
Copy link
Member

That said, I am happy to merge this as is.

@jGaboardi
Copy link
Member Author

I would do one PR that contains only the automatic fixes by ruff but across the whole code base and than a series of smaller PRs with the rest. The former does not need a ton of review and may resolve quite a lot already.

The problem with autofixing everything is that is sometimes breaks things. For example, in libpysal/weights/__init__.py the from .weights import * # noqa I001 import location can't change or we see the following:

ImportError while importing test module '/Users/userlibpysal/libpysal/weights/tests/test_weights_IO.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../mambaforge/envs/py311_libpysal/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
libpysal/__init__.py:27: in <module>
    from . import cg, examples, io, weights
libpysal/examples/__init__.py:14: in <module>
    from .base import example_manager
libpysal/examples/base.py:17: in <module>
    from ..io import open as ps_open
libpysal/io/__init__.py:2: in <module>
    from .iohandlers import *
libpysal/io/iohandlers/__init__.py:6: in <module>
    from . import dat
libpysal/io/iohandlers/dat.py:2: in <module>
    from ...weights import W
libpysal/weights/__init__.py:3: in <module>
    from .gabriel import Delaunay, Gabriel, Relative_Neighborhood
libpysal/weights/gabriel.py:3: in <module>
    from libpysal.weights import W, WSP
E   ImportError: cannot import name 'W' from partially initialized module 'libpysal.weights' (most likely due to a circular import) (/Users/user/libpysal/libpysal/weights/__init__.py)

@martinfleis
Copy link
Member

The problem with autofixing everything is that is sometimes breaks things

fun ... okay, let's go piece by piece then

@jGaboardi
Copy link
Member Author

The problem with autofixing everything is that is sometimes breaks things

fun ... okay, let's go piece by piece then

I think it's fun, but I know I'm an outlier in that regard 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants