Remove 'src' prefix from imports - standardize package structure#17
Remove 'src' prefix from imports - standardize package structure#17
Conversation
…ucture Co-authored-by: Pablo1990 <1974224+Pablo1990@users.noreply.github.com>
Co-authored-by: Pablo1990 <1974224+Pablo1990@users.noreply.github.com>
Co-authored-by: Pablo1990 <1974224+Pablo1990@users.noreply.github.com>
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the
Comment |
There was a problem hiding this comment.
Pull request overview
This pull request standardizes the package structure by removing the non-standard 'src' prefix from imports and adopting the standard src-layout pattern. The changes affect 54 files across the codebase.
Changes:
- Updated all imports from
from src.pyVertexModel.*tofrom pyVertexModel.*across 54 files - Configured
setup.pyto use src-layout withpackage_dir={'': 'src'}andfind_packages(where='src') - Moved
PROJECT_DIRECTORYandloggerinitialization fromsrc/__init__.pytosrc/pyVertexModel/__init__.py
Reviewed changes
Copilot reviewed 59 out of 62 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Updated to use find_packages with src directory, changed Cython extension name |
| src/pyVertexModel/init.py | Added PROJECT_DIRECTORY and logger setup (moved from src/init.py) |
| src/init.py | Removed (functionality moved to pyVertexModel/init.py) |
| pyVertexModel/init.py | Removed redundant root-level package init |
| src/pyVertexModel/gui/qt_gui.py | Entire file deleted (174 lines) |
| src/pyVertexModel/algorithm/vertexModel.py | Updated imports, added local PROJECT_DIRECTORY redefinition |
| src/pyVertexModel/algorithm/vertexModelVoronoiFromTimeImage.py | Updated imports, added local PROJECT_DIRECTORY redefinition |
| src/pyVertexModel/algorithm/vertexModelBubbles.py | Updated imports from src.pyVertexModel to pyVertexModel |
| src/pyVertexModel/algorithm/VertexModelVoronoi3D.py | Updated imports from src.pyVertexModel to pyVertexModel |
| src/pyVertexModel/algorithm/newtonRaphson.py | Updated imports from src.pyVertexModel to pyVertexModel |
| src/pyVertexModel/Kg/*.py (8 files) | Updated imports from src.pyVertexModel to pyVertexModel |
| src/pyVertexModel/geometry/*.py (5 files) | Updated imports from src.pyVertexModel to pyVertexModel |
| src/pyVertexModel/mesh_remodelling/*.py (2 files) | Updated imports from src.pyVertexModel to pyVertexModel |
| src/pyVertexModel/parameters/set.py | Updated imports from src.pyVertexModel to pyVertexModel |
| src/pyVertexModel/util/space_exploration.py | Updated imports from src.pyVertexModel to pyVertexModel |
| src/pyVertexModel/analysis/*.py (11 files) | Updated imports from src.pyVertexModel to pyVertexModel |
| src/pyVertexModel/main*.py (4 files) | Updated imports from src.pyVertexModel to pyVertexModel |
| Tests/*.py (11 files) | Updated imports from src.pyVertexModel to pyVertexModel |
| .idea/pyVertexModel.iml | Added src as source folder, updated Python SDK reference |
| .github/workflows/tests.yaml | Removed 'megha' branch and pull_request trigger |
Files not reviewed (1)
- .idea/pyVertexModel.iml: Language not supported
Comments suppressed due to low confidence (63)
Tests/tests.py:49
- assertTrue(a in b) cannot provide an informative message. Using assertIn(a, b) instead will give more informative messages.
self.assertTrue('Geo' in mat_info)
Tests/tests.py:54
- assertTrue(a in b) cannot provide an informative message. Using assertIn(a, b) instead will give more informative messages.
self.assertTrue('Set' in mat_info)
src/pyVertexModel/analysis/analyse_pre_ablation_state.py:60
- This comment appears to contain commented-out code.
src/pyVertexModel/analysis/analyse_simulation.py:405 - This comment appears to contain commented-out code.
src/pyVertexModel/analysis/analyse_simulation.py:436 - This comment appears to contain commented-out code.
src/pyVertexModel/analysis/analysis_megha.py:450 - This comment appears to contain commented-out code.
src/pyVertexModel/geometry/cell.py:467 - This comment appears to contain commented-out code.
src/pyVertexModel/analysis/find_required_purse_string.py:40 - This comment appears to contain commented-out code.
src/pyVertexModel/geometry/geo.py:764 - This comment appears to contain commented-out code.
src/pyVertexModel/geometry/geo.py:1026 - This comment appears to contain commented-out code.
src/pyVertexModel/geometry/geo.py:1263 - This comment appears to contain commented-out code.
src/pyVertexModel/geometry/geo.py:1517 - This comment appears to contain commented-out code.
src/pyVertexModel/geometry/geo.py:2204 - This comment appears to contain commented-out code.
src/pyVertexModel/Kg/kgContractility_external.py:37 - This comment appears to contain commented-out code.
# if currentFace.InterfaceType == 1 or currentFace.InterfaceType == 'Lateral':
# continue
src/pyVertexModel/main_paper_simulations.py:138
- This comment appears to contain commented-out code.
src/pyVertexModel/main_paper_simulations.py:164 - This comment appears to contain commented-out code.
src/pyVertexModel/algorithm/newtonRaphson.py:419 - This comment appears to contain commented-out code.
# if Set.InPlaneElasticity:
# gt, Kt, EBulk = KgBulk(geo_0, Geo, Set)
# K += Kt
# g += gt
# E += EBulk
# Energies["Bulk"] = EBulk
src/pyVertexModel/algorithm/newtonRaphson.py:526
- This comment appears to contain commented-out code.
# if Set.InPlaneElasticity:
# gt, Kt, EBulk = KgBulk(geo_0, Geo, Set)
# K += Kt
# g += gt
# E += EBulk
# Energies["Bulk"] = EBulk
src/pyVertexModel/mesh_remodelling/remodelling.py:395
- This comment appears to contain commented-out code.
src/pyVertexModel/mesh_remodelling/remodelling.py:559 - This comment appears to contain commented-out code.
src/pyVertexModel/algorithm/vertexModel.py:290 - This comment appears to contain commented-out code.
# if os.path.getmtime(output_filename) < (time.time() - 24 * 60 * 60):
# logger.info(f'Redoing the file {output_filename} as it is older than 1 day')
# else:
src/pyVertexModel/algorithm/vertexModel.py:781
- This comment appears to contain commented-out code.
# except Exception as e:
# logger.error(f"Error while computing wound features: {e}")
src/pyVertexModel/algorithm/vertexModel.py:1160
- This comment appears to contain commented-out code.
#except Exception as e:
# logger.error(f'Error while running the iteration for purse string strength: {e}')
# return np.inf, np.inf, np.inf, np.inf
src/pyVertexModel/algorithm/vertexModelVoronoiFromTimeImage.py:365
- This comment appears to contain commented-out code.
src/pyVertexModel/algorithm/vertexModelVoronoiFromTimeImage.py:423 - This comment appears to contain commented-out code.
Tests/test_degreesOfFreedom.py:33 - Call to method DegreesOfFreedom.get_remodel_dofs with too few arguments; should be no fewer than 3.
dof_test.get_remodel_dofs(t_new_test, geo_test)
Tests/test_flip.py:29
- Call to function y_flip_nm with too few arguments; should be no fewer than 7.
tnew_test, _ = y_flip_nm(old_tets, cell_to_intercalate_with, old_ys, xs_to_disconnect, geo_test, set_test)
Tests/test_flip.py:50
- Call to function y_flip_nm with too few arguments; should be no fewer than 7.
tnew_test, _ = y_flip_nm(old_tets, cell_to_intercalate_with, old_ys, xs_to_disconnect, geo_test, set_test)
Tests/test_flip.py:120
- Call to function post_flip with too many arguments; should be no more than 9.
_, _, geo_test, _, _, _ = post_flip(Tnew, Ynew, oldTets, geo_test, geo_n, geo_0, Dofs, newYgIds, set_test,
'-', segmentToChange)
Tests/test_flip.py:144
- Call to function post_flip with too many arguments; should be no more than 9.
_, _, geo_test, _, _, _ = post_flip(Tnew, Ynew, oldTets, geo_test, geo_n, geo_0, Dofs, newYgIds, set_test,
'-', segmentToChange)
Tests/test_geo.py:202
- Call to method Geo.check_ys_and_faces_have_not_changed with too few arguments; should be no fewer than 3.
geo_test.check_ys_and_faces_have_not_changed(new_tets_test, old_geo_test)
Tests/test_geo.py:233
- Call to method Geo.check_ys_and_faces_have_not_changed with too few arguments; should be no fewer than 3.
geo_test.check_ys_and_faces_have_not_changed(new_tets_test, old_geo_test)
Tests/test_remodelling.py:33
- Call to method Remodelling.intercalate_cells with too many arguments; should be no more than 1.
ghost_nodes_tried, hasConverged, newYgIds) = remodelling_test.intercalate_cells(newYgIds, segmentFeatures)
src/pyVertexModel/algorithm/VertexModelVoronoi3D.py:116
- Variable Twg_numPlane is not used.
Twg_numPlane = create_tetrahedra(triangles_connectivity, neighbours_network, cell_edges,
src/pyVertexModel/mesh_remodelling/flip.py:273
- Variable ys_4_cells is not used.
src/pyVertexModel/geometry/geo.py:549 - Variable avg_faces is not used.
src/pyVertexModel/geometry/geo.py:2006 - Variable original_tets is not used.
src/pyVertexModel/Kg/kgVolume.py:19 - Variable dim is not used.
dim = 3
src/pyVertexModel/util/space_exploration.py:114
- Variable in_vivo_values_height is not used.
src/pyVertexModel/util/space_exploration.py:141 - Variable all_files_features is not used.
Tests/test_vertexModel.py:294 - Variable x is not used.
x = mat_info['X']
src/pyVertexModel/algorithm/vertexModelBubbles.py:433
- Variable X_IDs is not used.
src/pyVertexModel/analysis/analyse_pre_ablation_state.py:19 - This assignment to 'file_name' is unnecessary as it is redefined before this value is used.
src/pyVertexModel/analysis/analyse_simulation.py:79 - This assignment to 'important_features' is unnecessary as it is redefined before this value is used.
This assignment to 'important_features' is unnecessary as it is redefined before this value is used.
src/pyVertexModel/analysis/analyse_simulation.py:80 - This assignment to 'post_wound_features' is unnecessary as it is redefined before this value is used.
src/pyVertexModel/main.py:35 - This assignment to 'name_last_pkl_file' is unnecessary as it is redefined before this value is used.
src/pyVertexModel/analysis/obtain_vtks_from_file.py:73 - This assignment to 'specific_files' is unnecessary as it is redefined before this value is used.
src/pyVertexModel/mesh_remodelling/remodelling.py:338 - This assignment to 'num_step' is unnecessary as it is redefined before this value is used.
src/pyVertexModel/mesh_remodelling/remodelling.py:347 - This assignment to 'num_step' is unnecessary as it is redefined before this value is used.
Tests/test_vertexModel.py:516 - Keyword argument 'set_option' is not a supported parameter name of Set.init.
set_test = Set(set_option='voronoi_from_image')
Tests/test_vertexModel.py:566
- Keyword argument 'set_option' is not a supported parameter name of Set.init.
set_test = Set(set_option='voronoi_from_image')
src/pyVertexModel/geometry/geo.py:1363
- Except block directly handles BaseException.
src/pyVertexModel/analysis/analyse_simulation.py:182 - 'except' clause does nothing but pass and there is no explanatory comment.
src/pyVertexModel/analysis/obtain_best_parameters.py:29 - 'except' clause does nothing but pass and there is no explanatory comment.
src/pyVertexModel/analysis/obtain_best_parameters.py:34 - 'except' clause does nothing but pass and there is no explanatory comment.
src/pyVertexModel/Kg/kgContractility.py:222 - Unnecessary 'pass' statement.
pass
src/pyVertexModel/main.py:55
- This statement is unreachable.
src/pyVertexModel/analysis/obtain_vtks_from_file.py:20 - This statement is unreachable.
src/pyVertexModel/algorithm/vertexModel.py:94 - This statement is unreachable.
z_coordinate = [cell_height, -cell_height]
Tests/test_flip.py:29
- Left hand side of assignment contains 2 variables, but right hand side is a tuple of length 3.
tnew_test, _ = y_flip_nm(old_tets, cell_to_intercalate_with, old_ys, xs_to_disconnect, geo_test, set_test)
Tests/test_flip.py:50
- Left hand side of assignment contains 2 variables, but right hand side is a tuple of length 3.
tnew_test, _ = y_flip_nm(old_tets, cell_to_intercalate_with, old_ys, xs_to_disconnect, geo_test, set_test)
Tests/test_flip.py:120
- Left hand side of assignment contains 6 variables, but right hand side is a tuple of length 5.
_, _, geo_test, _, _, _ = post_flip(Tnew, Ynew, oldTets, geo_test, geo_n, geo_0, Dofs, newYgIds, set_test,
'-', segmentToChange)
Tests/test_flip.py:144
- Left hand side of assignment contains 6 variables, but right hand side is a tuple of length 5.
_, _, geo_test, _, _, _ = post_flip(Tnew, Ynew, oldTets, geo_test, geo_n, geo_0, Dofs, newYgIds, set_test,
'-', segmentToChange)
| __all__ = ["PROJECT_DIRECTORY"] | ||
|
|
There was a problem hiding this comment.
The all variable is defined twice (lines 13 and 38). The first definition only includes "PROJECT_DIRECTORY" while the second includes 'version', 'PROJECT_DIRECTORY', and 'logger'. Remove the first definition on line 13 as it is incomplete and will be overwritten by line 38.
| __all__ = ["PROJECT_DIRECTORY"] |
| logger = logging.getLogger("pyVertexModel") | ||
|
|
||
|
|
||
| PROJECT_DIRECTORY = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
There was a problem hiding this comment.
PROJECT_DIRECTORY is being redefined locally and will point to the wrong directory. This definition creates a path pointing to 'src/pyVertexModel/' instead of the project root. Since PROJECT_DIRECTORY is now properly exported from 'pyVertexModel.init', this local redefinition should be removed. The code on line 274 (os.path.join(PROJECT_DIRECTORY, self.set.initial_filename_state)) expects PROJECT_DIRECTORY to be the project root, not the pyVertexModel subdirectory.
|
|
||
|
|
||
| logger = logging.getLogger("pyVertexModel") | ||
| PROJECT_DIRECTORY = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
There was a problem hiding this comment.
PROJECT_DIRECTORY is being redefined locally and will point to the wrong directory. This definition creates a path pointing to 'src/pyVertexModel/' instead of the project root. Since PROJECT_DIRECTORY is now properly exported from 'pyVertexModel.init', this local redefinition should be removed. The code on line 581 (PROJECT_DIRECTORY + '/' + self.set.initial_filename_state) expects PROJECT_DIRECTORY to be the project root, not the pyVertexModel subdirectory.
| @@ -8,8 +8,8 @@ | |||
| import seaborn as sns | |||
| from scipy.optimize import curve_fit | |||
There was a problem hiding this comment.
Import of 'curve_fit' is not used.
| from src.pyVertexModel.algorithm.vertexModel import VertexModel, logger | ||
| from src.pyVertexModel.util.utils import load_state, load_variables, save_variables, screenshot | ||
| from pyVertexModel.algorithm.vertexModel import VertexModel, logger | ||
| from pyVertexModel.util.utils import load_state, load_variables, save_variables, screenshot |
There was a problem hiding this comment.
Import of 'screenshot' is not used.
|
|
||
| from src.pyVertexModel.analysis.analyse_simulation import analyse_simulation, create_video | ||
| from src.pyVertexModel.util.utils import plot_figure_with_line | ||
| from pyVertexModel.analysis.analyse_simulation import analyse_simulation, create_video |
There was a problem hiding this comment.
Import of 'create_video' is not used.
| from pyVertexModel.Kg.kgVolume import KgVolume | ||
| from pyVertexModel.algorithm.vertexModelVoronoiFromTimeImage import VertexModelVoronoiFromTimeImage | ||
| from pyVertexModel.geometry.cell import compute_2d_circularity | ||
| from pyVertexModel.util.utils import load_state, save_variables, load_variables, screenshot |
There was a problem hiding this comment.
Import of 'screenshot' is not used.
| from src.pyVertexModel.util.utils import load_state | ||
| from pyVertexModel import PROJECT_DIRECTORY | ||
| from pyVertexModel.algorithm.vertexModelVoronoiFromTimeImage import VertexModelVoronoiFromTimeImage | ||
| from pyVertexModel.analysis.analyse_simulation import analyse_simulation |
There was a problem hiding this comment.
Import of 'analyse_simulation' is not used.
| from src import PROJECT_DIRECTORY | ||
| from src.pyVertexModel.util.space_exploration import objective, plot_optuna_all, load_simulations, create_study_name | ||
| from pyVertexModel import PROJECT_DIRECTORY | ||
| from pyVertexModel.util.space_exploration import objective, plot_optuna_all, load_simulations, create_study_name |
There was a problem hiding this comment.
Import of 'load_simulations' is not used.
Project imports used non-standard
from src.pyVertexModelpattern. Updated to standardfrom pyVertexModelconvention.Changes
Package configuration:
setup.py: Addedpackage_dir={'': 'src'}withfind_packages(where='src')src.pyVertexModel.Kg.kg_functions→pyVertexModel.Kg.kg_functionsImport updates (54 files):
from src.pyVertexModel.*→from pyVertexModel.*from src import PROJECT_DIRECTORY, logger→from pyVertexModel import PROJECT_DIRECTORY, loggerCleanup:
PROJECT_DIRECTORYandloggerfromsrc/__init__.pytosrc/pyVertexModel/__init__.pysrc/__init__.pyand redundantpyVertexModel/root directoryos.path.dirname()withPath(__file__).parent.parent.parentfor clarityUsage
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.