Skip to content

refactor!: remove packageurl-python dependency#939

Open
saquibsaifee wants to merge 1 commit intoCycloneDX:mainfrom
saquibsaifee:refactor/remove-package-url
Open

refactor!: remove packageurl-python dependency#939
saquibsaifee wants to merge 1 commit intoCycloneDX:mainfrom
saquibsaifee:refactor/remove-package-url

Conversation

@saquibsaifee
Copy link
Copy Markdown
Contributor

@saquibsaifee saquibsaifee commented Feb 28, 2026

Description

Removes packageurl-python as a dependency (both runtime and dev). The library now treats PURL as an opaque string per the CycloneDX specification — PURL is a string field in the schema, not a structured object.

  • Component.purl now stores and returns Optional[str]
  • Bom.get_component_by_purl() accepts Optional[str]
  • Removed unused helpers: PackageUrl serialization helper, ComparablePackageURL
  • Updated test fixtures and regenerated snapshots

Breaking Changes

  • Component.purl type changed from Optional[PackageURL] to Optional[str]

Resolves or fixes issue: #919

AI Tool Disclosure

  • My contribution does not include any AI-generated content
  • My contribution includes AI-generated content, as disclosed below:
    • AI Tools: CLAUDE
    • LLMs and versions: 4.5
    • Prompts: ``

Affirmation

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Feb 28, 2026

@saquibsaifee saquibsaifee changed the title refactor: remove the package-url dependency refactor: remove the packageurl-python dependency Feb 28, 2026
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 22, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics -4 complexity · 1 duplication

Metric Results
Complexity -4
Duplication 1

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes. Give us feedback

@saquibsaifee saquibsaifee changed the title refactor: remove the packageurl-python dependency refactor!: remove packageurl-python dependency Apr 22, 2026
@saquibsaifee saquibsaifee marked this pull request as ready for review April 22, 2026 04:47
@saquibsaifee saquibsaifee requested a review from a team as a code owner April 22, 2026 04:47
Removes packageurl-python entirely — no runtime dependency, no dev dependency.
The library now treats PURL as an opaque string, which matches the CycloneDX
specification (PURL is a plain string field in the schema).

Changes:
- Component.purl accepts and returns Optional[str] only
- Bom.get_component_by_purl() now takes Optional[str]
- Removed PackageUrl serialization helper and ComparablePackageURL utility
- Removed all packageurl imports from source and test files
- Updated test fixtures to use PURL string format directly
- Regenerated snapshots with updated PURL string representation

BREAKING CHANGE: Component.purl type changed from Optional[PackageURL] to Optional[str].
Users who need structured PURL access should parse the string themselves using
the packageurl-python library directly.

Signed-off-by: Saquib Saifee <saquibsaifee2@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@saquibsaifee saquibsaifee force-pushed the refactor/remove-package-url branch from 60e4665 to 31fccbf Compare April 22, 2026 04:52
@saquibsaifee
Copy link
Copy Markdown
Contributor Author

@jkowalleck, what do you think?

Copy link
Copy Markdown
Member

@jkowalleck jkowalleck left a comment

Choose a reason for hiding this comment

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

Thank you so much for championing the topic.
there are some minor remarks

<name>dummy</name>
<version>2.3.5</version>
<purl>pkg:pypi/pathlib2@2.3.5?vcs_url=git%2Bhttps://github.com/jazzband/pathlib2.git%405a6a88db3cc1d08dbc86fbe15edfb69fb5f5a3d6</purl>
<purl>pkg:pypi/pathlib2@2.3.5?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2Fjazzband%2Fpathlib2.git%405a6a88db3cc1d08dbc86fbe15edfb69fb5f5a3d6</purl>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<purl>pkg:pypi/pathlib2@2.3.5?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2Fjazzband%2Fpathlib2.git%405a6a88db3cc1d08dbc86fbe15edfb69fb5f5a3d6</purl>
<purl>pkg:pypi/pathlib2@2.3.5?vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Fjazzband%2Fpathlib2.git%405a6a88db3cc1d08dbc86fbe15edfb69fb5f5a3d6</purl>

<name>dummy</name>
<version>2.3.5</version>
<purl>pkg:pypi/pathlib2@2.3.5?vcs_url=git%2Bhttps://github.com/jazzband/pathlib2.git%405a6a88db3cc1d08dbc86fbe15edfb69fb5f5a3d6</purl>
<purl>pkg:pypi/pathlib2@2.3.5?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2Fjazzband%2Fpathlib2.git%405a6a88db3cc1d08dbc86fbe15edfb69fb5f5a3d6</purl>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<purl>pkg:pypi/pathlib2@2.3.5?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2Fjazzband%2Fpathlib2.git%405a6a88db3cc1d08dbc86fbe15edfb69fb5f5a3d6</purl>
<purl>pkg:pypi/pathlib2@2.3.5?vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Fjazzband%2Fpathlib2.git%405a6a88db3cc1d08dbc86fbe15edfb69fb5f5a3d6</purl>

Comment thread tests/_data/models.py
affects=[
BomTarget(
ref=component.purl.to_string(),
ref=str(component.purl),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no need to cast to a string - is is expected to be a string already, right?

Comment thread tests/_data/models.py
}
)
purl='pkg:pypi/pathlib2@2.3.5'
'?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2Fjazzband%2Fpathlib2.git'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
'?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2Fjazzband%2Fpathlib2.git'
'?vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Fjazzband%2Fpathlib2.git'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants