Skip to content

Resolves #33 — Refactors the monolithic networkdiagram.py into a structured, modular Python package architecture in preparation for the v1.0.0 PyPI release. - #36

Open
Shiva210Jyoti wants to merge 3 commits into
kathan-majithia:mainfrom
Shiva210Jyoti:main
Open

Resolves #33 — Refactors the monolithic networkdiagram.py into a structured, modular Python package architecture in preparation for the v1.0.0 PyPI release.#36
Shiva210Jyoti wants to merge 3 commits into
kathan-majithia:mainfrom
Shiva210Jyoti:main

Conversation

@Shiva210Jyoti

Copy link
Copy Markdown

**```
Resolves #33

Summary

Refactors the monolithic networkdiagram.py into a professional, modular Python package architecture ahead of the v1.0.0 PyPI release. This is a pure structural refactor — no logic, math, or Matplotlib parameters were touched.

Package Structure

networkdiagram/
├── __init__.py                          # Re-exports all public classes
├── core/
│   ├── node.py                          # Node class
│   ├── cpm.py                           # CriticalPathMethod class
│   └── pert.py                          # Stub for future PERTMethod
├── visualization/
│   ├── network_plot.py                  # display_network() + get_hierarchical_layout()
│   └── gantt_chart.py                   # Stub for future Gantt chart
└── utils/
    └── validators.py                    # Stub for future validators

Backward Compatibility

from networkdiagram import CriticalPathMethod works identically — zero breaking changes.

Testing

pytest tests/ — 1 passed, 0 failures after full refactor.

Notes

Stub modules are intentional placeholders for PERTMethod, generate_gantt_chart(), and validators — the original monolithic file had none of these implemented.

…ecture

- Extract Node class into core/node.py
- Extract CriticalPathMethod into core/cpm.py
- Extract display_network() and get_hierarchical_layout() into visualization/network_plot.py
- Add stub modules for pert.py, gantt_chart.py, validators.py (ready for future issues)
- Configure __init__.py to maintain 100% backward compatible public API
- Add conftest.py to fix test path resolution
- Delete monolithic networkdiagram.py
- All existing pytest tests pass
@Shiva210Jyoti

Copy link
Copy Markdown
Author

Hey @kathan-majithia, the PR is ready for your review! All existing tests pass. Please let me know if any changes are needed.

- Merge upstream's CPM validation, cycle detection, and Gantt chart feature
- Preserve modular package structure from refactor
- Move Node validation into core/node.py
- All 6 tests passing
@Shiva210Jyoti

Copy link
Copy Markdown
Author

@kathan-majithia Merge conflicts resolved — integrated your latest validation, cycle detection, and Gantt chart additions into the new modular structure. All 6 tests passing. Ready for review.

@kathan-majithia

Copy link
Copy Markdown
Owner

Hi @Shiva210Jyoti , amazing work tackling this massive refactor!

As expected with a major structural update, we hit a merge conflict.

To get this ready for merging, you will need to sync your branch with main and resolve the conflicts locally.

…ucture

- Merge PR kathan-majithia#18 (Time-Cost Trade-off / Crashing) from upstream
- Add crash_duration, normal_cost, crash_cost to Node in core/node.py
- Add cost_slope(), can_be_crashed() methods to Node
- Add crash_project(), display_crash_schedule(), get_critical_path_activities() to CriticalPathMethod
- Preserve modular import structure throughout
- All 6 tests passing
@Shiva210Jyoti

Copy link
Copy Markdown
Author

@kathan-majithia Synced with latest upstream main — integrated the Time-Cost Trade-off (Crashing) feature into the modular structure. All 6 tests passing. Ready for review.

@Shiva210Jyoti

Copy link
Copy Markdown
Author

Hi @kathan-majithia ,Kindly review the PR when u get time. Thank you.

@kathan-majithia

Copy link
Copy Markdown
Owner

Hi @Shiva210Jyoti , sorry to keep you waiting. That was because there were ongoing PR's to be merged beforecoming to your PR. Now that I have merged major PR's and not planning to merge anything new, you are requested to check for any other latest change in the project and let me review the final version.

Thank you!

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.

Refactor: Modularize networkdiagram.py into a structured package architecture

2 participants