Skip to content

Use regex for dependency version specifier parsing - #82

Merged
Johan Broberg (pontemonti) merged 2 commits into
users/johanb/Dependenciesfrom
copilot/sub-pr-80
Dec 3, 2025
Merged

Use regex for dependency version specifier parsing#82
Johan Broberg (pontemonti) merged 2 commits into
users/johanb/Dependenciesfrom
copilot/sub-pr-80

Conversation

Copilot AI commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

The dependency parsing logic in generate_dependency_diagram.py used chained split() calls that failed for dependencies with multiple version specifiers (e.g., package>=1.0,<2.0).

Changes

  • Replace chained split('>=')[0].split('==')[0].split('<')[0] with regex-based parsing
  • Use re.split(r'[><=!~]', dep)[0].strip() to correctly extract package names regardless of version specifier complexity
# Before
dep_name = dep.split('>=')[0].split('==')[0].split('<')[0].strip()

# After
dep_name = re.split(r'[><=!~]', dep)[0].strip()

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

Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback on dependency diagram and script changes Use regex for dependency version specifier parsing Dec 3, 2025
@pontemonti
Johan Broberg (pontemonti) marked this pull request as ready for review December 3, 2025 17:28
@pontemonti
Johan Broberg (pontemonti) requested a review from a team as a code owner December 3, 2025 17:28
@pontemonti
Johan Broberg (pontemonti) merged commit 356697e into users/johanb/Dependencies Dec 3, 2025
1 check passed
@pontemonti
Johan Broberg (pontemonti) deleted the copilot/sub-pr-80 branch December 3, 2025 17:28
Johan Broberg (pontemonti) added a commit that referenced this pull request Dec 4, 2025
* Add dependency diagram and script to generate dependency diagram.

* Change layout of diagram to make it easier to read

* Update generate_dependency_diagram.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Optimize file I/O by caching pyproject data during first pass (#81)

* Initial plan

* Optimize file I/O by caching pyproject data during first pass

Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>

* Use regex for dependency version specifier parsing (#82)

* Initial plan

* Use regex for parsing dependency version specifiers

Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>

* Formatting fixes

---------

Co-authored-by: Johan Broberg <johanb@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
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.

2 participants