Skip to content

feat: support parsing multiple files#326

Merged
sdn4z merged 1 commit into
elementsinteractive:mainfrom
sdn4z:multiple-lock-files
Sep 16, 2025
Merged

feat: support parsing multiple files#326
sdn4z merged 1 commit into
elementsinteractive:mainfrom
sdn4z:multiple-lock-files

Conversation

@sdn4z

@sdn4z sdn4z commented Sep 12, 2025

Copy link
Copy Markdown
Collaborator

Introduces the behaviour for supporting multiple lock files at once, as well as autodetecting them.

It does not yet support introducing multiple dependency files through the CLI.

It changes the json format output to https://github.com/elementsinteractive/twyn/pull/326/files#diff-ae0b15b531bda07c4292b5e4d8acb8b370f8a2e8c511a85ba548ad7d4491cc22R262

closes #325

BREAKING CHANGE

@sdn4z sdn4z added the v5.0.0 v5.0.0 release label Sep 12, 2025
@sdn4z sdn4z force-pushed the multiple-lock-files branch from 8dd969f to d7774d7 Compare September 12, 2025 14:42
@github-actions github-actions Bot added feature and removed feature labels Sep 12, 2025
@sdn4z sdn4z force-pushed the multiple-lock-files branch from d7774d7 to 5ea410b Compare September 12, 2025 14:43
@github-actions github-actions Bot added feature and removed feature labels Sep 12, 2025
@sdn4z sdn4z force-pushed the multiple-lock-files branch from 5ea410b to 7ae6302 Compare September 12, 2025 14:43
@github-actions github-actions Bot added feature and removed feature labels Sep 12, 2025
@sdn4z sdn4z force-pushed the multiple-lock-files branch from 7ae6302 to f34ee63 Compare September 12, 2025 14:46
@github-actions github-actions Bot added feature and removed feature labels Sep 12, 2025
@sdn4z sdn4z force-pushed the multiple-lock-files branch from f34ee63 to 10d59b0 Compare September 15, 2025 10:13
@github-actions github-actions Bot added feature and removed feature labels Sep 15, 2025
@sdn4z sdn4z force-pushed the multiple-lock-files branch from 10d59b0 to 3b14409 Compare September 15, 2025 12:33
@github-actions github-actions Bot added feature and removed feature labels Sep 15, 2025
def auto_detect_dependency_file_parser(self) -> list[AbstractParser]:
parsers: list[AbstractParser] = []
for dependency_parser in DEPENDENCY_FILE_MAPPING.values():
if dependency_parser().file_exists():

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It only auto detects files in the root directory for now. We'll update this behaviour in upcoming PRs.

@sdn4z sdn4z force-pushed the multiple-lock-files branch from 3b14409 to 5d6386a Compare September 15, 2025 12:54
@github-actions github-actions Bot added feature and removed feature labels Sep 15, 2025
@sdn4z sdn4z marked this pull request as ready for review September 15, 2025 12:55
@sdn4z sdn4z requested a review from scastlara as a code owner September 15, 2025 12:55
Comment thread README.md
@scastlara

Copy link
Copy Markdown
Collaborator

We are doing like 1 breaking change per week!

@scastlara

Copy link
Copy Markdown
Collaborator

I need a bit of convincing. Why do we want this?

@sdn4z

sdn4z commented Sep 15, 2025

Copy link
Copy Markdown
Collaborator Author

I need a bit of convincing. Why do we want this?

I'm trying to mimic the behaviour of other tools (i.e. osv-scanner) where you can feed it multiple files, and where you have the option of recursively find all your lock files within a directory. The best use case I can think of for this is a monorepo.

For now it does not recursively look for files, it only find them in the CWD. This is something to implement later if this PR gets merged and we like the idea.

@sdn4z

sdn4z commented Sep 15, 2025

Copy link
Copy Markdown
Collaborator Author

We are doing like 1 breaking change per week!

Sky is the limit!

Yes that's unfortunate, but I'm not planning any other major update anytime soon once we release 5.0.0.

@scastlara

Copy link
Copy Markdown
Collaborator

/lgtm review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🦉 lgtm Review

Score: Nitpicks 🤓

🔍 Summary

This PR introduces significant new functionality for handling multiple dependency files and improves the overall code structure. The refactoring in src/twyn/main.py and the introduction of a dedicated models.py are excellent changes that improve code clarity and separation of concerns. The changes are well-tested and the breaking change to the JSON output is correctly noted.

I found a couple of minor issues: an incorrect type hint and a small opportunity for code cleanup. After addressing these, the PR will be in great shape. Overall, great work!

More information
  • Id: cfb08c36675c4bb88d4808162af2beaa
  • Model: gemini-2.5-pro
  • Created at: 2025-09-15T14:10:06.449091+00:00
Usage summary
  • Request count: 2
  • Request tokens: 109,721
  • Response tokens: 8,873
  • Total tokens: 118,594

See the 📚 lgtm-ai repository for more information about lgtm.

Comment thread src/twyn/main.py Outdated
Comment thread src/twyn/dependency_parser/dependency_selector.py Outdated
@sdn4z sdn4z force-pushed the multiple-lock-files branch from 5d6386a to f86e3b0 Compare September 16, 2025 07:20
@github-actions github-actions Bot added feature and removed feature labels Sep 16, 2025
@sdn4z sdn4z force-pushed the multiple-lock-files branch from f86e3b0 to 9efcfcd Compare September 16, 2025 08:49
@github-actions github-actions Bot added feature and removed feature labels Sep 16, 2025
@sdn4z sdn4z merged commit 2a4f84d into elementsinteractive:main Sep 16, 2025
12 checks passed
@sdn4z sdn4z deleted the multiple-lock-files branch September 16, 2025 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature v5.0.0 v5.0.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support analyzing multiple lock files

2 participants