Skip to content

Remove 'src' prefix from imports - standardize package structure#17

Merged
Pablo1990 merged 7 commits intomainfrom
copilot/fix-import-project-src
Feb 4, 2026
Merged

Remove 'src' prefix from imports - standardize package structure#17
Pablo1990 merged 7 commits intomainfrom
copilot/fix-import-project-src

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

Project imports used non-standard from src.pyVertexModel pattern. Updated to standard from pyVertexModel convention.

Changes

Package configuration:

  • setup.py: Added package_dir={'': 'src'} with find_packages(where='src')
  • Cython extension path: src.pyVertexModel.Kg.kg_functionspyVertexModel.Kg.kg_functions

Import updates (54 files):

  • from src.pyVertexModel.*from pyVertexModel.*
  • from src import PROJECT_DIRECTORY, loggerfrom pyVertexModel import PROJECT_DIRECTORY, logger

Cleanup:

  • Moved PROJECT_DIRECTORY and logger from src/__init__.py to src/pyVertexModel/__init__.py
  • Removed obsolete src/__init__.py and redundant pyVertexModel/ root directory
  • Replaced nested os.path.dirname() with Path(__file__).parent.parent.parent for clarity

Usage

# Before
from src.pyVertexModel.geometry.cell import Cell
from src.pyVertexModel.algorithm.vertexModel import VertexModel
from src import PROJECT_DIRECTORY

# After
from pyVertexModel.geometry.cell import Cell
from pyVertexModel.algorithm.vertexModel import VertexModel
from pyVertexModel import PROJECT_DIRECTORY
Original prompt

This section details on the original issue you should resolve

<issue_title>Import project without 'src'</issue_title>
<issue_description>The project is currently being importer using 'src'. It should not happen.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 3, 2026 16:13
…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>
Copilot AI changed the title [WIP] Fix project import process to exclude 'src' directory Remove 'src' prefix from imports - standardize package structure Feb 3, 2026
Copilot AI requested a review from Pablo1990 February 3, 2026 16:19
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Comment @coderabbitai help to get the list of available commands and usage tips.

@Pablo1990 Pablo1990 marked this pull request as ready for review February 4, 2026 10:02
Copilot AI review requested due to automatic review settings February 4, 2026 10:02
@Pablo1990 Pablo1990 merged commit 44a7ed3 into main Feb 4, 2026
4 checks passed
@Pablo1990 Pablo1990 deleted the copilot/fix-import-project-src branch February 4, 2026 10:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.* to from pyVertexModel.* across 54 files
  • Configured setup.py to use src-layout with package_dir={'': 'src'} and find_packages(where='src')
  • Moved PROJECT_DIRECTORY and logger initialization from src/__init__.py to src/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

        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

        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

        _, _, geo_test, _, _, _ = post_flip(Tnew, Ynew, oldTets, geo_test, geo_n, geo_0, Dofs, newYgIds, set_test,
                                            '-', segmentToChange)

Tests/test_flip.py:144

        _, _, geo_test, _, _, _ = post_flip(Tnew, Ynew, oldTets, geo_test, geo_n, geo_0, Dofs, newYgIds, set_test,
                                            '-', segmentToChange)

Tests/test_geo.py:202

        geo_test.check_ys_and_faces_have_not_changed(new_tets_test, old_geo_test)

Tests/test_geo.py:233

        geo_test.check_ys_and_faces_have_not_changed(new_tets_test, old_geo_test)

Tests/test_remodelling.py:33

         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)

Comment on lines +13 to +14
__all__ = ["PROJECT_DIRECTORY"]

Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
__all__ = ["PROJECT_DIRECTORY"]

Copilot uses AI. Check for mistakes.
logger = logging.getLogger("pyVertexModel")


PROJECT_DIRECTORY = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.


logger = logging.getLogger("pyVertexModel")
PROJECT_DIRECTORY = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@@ -8,8 +8,8 @@
import seaborn as sns
from scipy.optimize import curve_fit
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Import of 'curve_fit' is not used.

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Import of 'screenshot' is not used.

Copilot uses AI. Check for mistakes.

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
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Import of 'create_video' is not used.

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Import of 'screenshot' is not used.

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Import of 'analyse_simulation' is not used.

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Import of 'load_simulations' is not used.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import project without 'src'

2 participants