Skip to content

Refactor the ArtifactInfo class#4526

Open
AthreyVinay wants to merge 10 commits intomainfrom
avinay-refactor-nvr-abstraction
Open

Refactor the ArtifactInfo class#4526
AthreyVinay wants to merge 10 commits intomainfrom
avinay-refactor-nvr-abstraction

Conversation

@AthreyVinay
Copy link
Contributor

@AthreyVinay AthreyVinay commented Jan 27, 2026

An effort towards resolving: #4055 (part-1)

following changes made:

  1. All subclasses of ArtifactInfo now removed
  2. Updated attributs of ArtifactInfo to what was discussed during the artifact plugin design sync (id, version, name, location, provider). The __str__ of this container represents: <provider-id>-<nvra>
  3. Introduced Version object and its subclass (RpmVersion with its factory methods) to represent nvra & nevra construction
  4. Refactored all classes (src and tests) where the above was referenced
  5. Refactored artifacts propeorty to get_installable_artifacts method. Reason being only persist information about artifacts that would be downloaded i.e. list from providers that "download" and not "enable".
  6. Removed ArtifactInfoT generic since see point 1.

couple more to finish before moving to review:
1. move ArtifactInfo to someplace else visible to package_managers too. The providers shall be responsible to create ArtifactInfo objects.

@github-project-automation github-project-automation bot moved this to backlog in planning Jan 28, 2026
@therazix therazix moved this from backlog to implement in planning Jan 28, 2026
@AthreyVinay AthreyVinay force-pushed the avinay-refactor-nvr-abstraction branch from e578fef to 326614a Compare January 29, 2026 09:50
@psss psss added step | prepare Stuff related to the prepare step plugin | artifact Related to the `prepare/artifact` plugin. labels Jan 29, 2026
@psss psss added this to the 1.67 milestone Jan 29, 2026
@AthreyVinay AthreyVinay force-pushed the avinay-refactor-nvr-abstraction branch from 974629e to a3577ca Compare February 4, 2026 16:31
@AthreyVinay AthreyVinay changed the title Refactor RPM artifacts to use an NVR value object Refactor ArtifactInfo Feb 4, 2026
@AthreyVinay AthreyVinay marked this pull request as ready for review February 4, 2026 16:50
@AthreyVinay AthreyVinay added the ci | full test Pull request is ready for the full test execution label Feb 4, 2026
@AthreyVinay AthreyVinay moved this from implement to review in planning Feb 6, 2026
@psss psss self-assigned this Feb 10, 2026
@AthreyVinay AthreyVinay force-pushed the avinay-refactor-nvr-abstraction branch from 652fa41 to 2eee10e Compare February 10, 2026 11:12
@AthreyVinay AthreyVinay linked an issue Feb 10, 2026 that may be closed by this pull request
import pytest

from tmt.steps.prepare.artifact.providers.copr_repository import CoprRepositoryProvider

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems that the class is not used. Interesting that it was not caught by ruff. Ah, we have it disabled:

Copy link
Contributor Author

@AthreyVinay AthreyVinay Feb 11, 2026

Choose a reason for hiding this comment

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

Shall I wait for it to be fixed in the above pr?

This import is needed to register the provider in the plugin registry. Just realised after trying to remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

That is quite funky. There is a load plugin method, but I did not look into how that works. Do you have the bandwitdh to check it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe to unblock this - we can look at adding this to the housekeeping sprint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok... so did a bit of digging.
there's a _explore_packages() hidden in explore() that loads plugins on start... however this does not get called automagically for unit tests, we need to explicitly call it to load the providers. Added a fixture for this. See: 0119fe4
Maybe we could try lazy-loading in the plugin registry (so it auto-discovers on first access)? Obviously as a separate change though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fine for now, there are some pytest constructs that can avoid adding it manually to each test (define a fixture to be used under a conftest scope), but we can get to that later.

Copy link
Contributor Author

@AthreyVinay AthreyVinay Feb 13, 2026

Choose a reason for hiding this comment

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

'm a bit confused now - isnt that what I have pushed? a fixture _load_plugins() and making artifact_provider() depend on it. Am i missing something?

@psss psss requested review from LecrisUT and happz February 10, 2026 21:51
@psss psss requested review from psss and vaibhavdaren February 11, 2026 12:10
@AthreyVinay AthreyVinay force-pushed the avinay-refactor-nvr-abstraction branch from f3734d2 to a5b4976 Compare February 11, 2026 14:01
@AthreyVinay
Copy link
Contributor Author

/packit build

@AthreyVinay AthreyVinay force-pushed the avinay-refactor-nvr-abstraction branch from a5b4976 to 8b98406 Compare February 12, 2026 09:22
Copy link
Contributor

@LecrisUT LecrisUT left a comment

Choose a reason for hiding this comment

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

Just a few other minor comments, otherwise it's fine from my side. Could reorganize where the class definitions are, but I will leave it to you to decide when to do so.

@AthreyVinay AthreyVinay force-pushed the avinay-refactor-nvr-abstraction branch from cb25be9 to 9024859 Compare February 12, 2026 12:06
Copy link
Contributor

@vaibhavdaren vaibhavdaren left a comment

Choose a reason for hiding this comment

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

LGTM

@psss
Copy link
Contributor

psss commented Feb 12, 2026

It's a bit late for the release and this change does not directly affect users.
Let's not block on it and merge as one of the first things in the next sprint.

@AthreyVinay AthreyVinay force-pushed the avinay-refactor-nvr-abstraction branch from 0119fe4 to 646c154 Compare February 12, 2026 21:51
@AthreyVinay AthreyVinay force-pushed the avinay-refactor-nvr-abstraction branch from 646c154 to 4a9f51a Compare February 13, 2026 10:03
@psss psss modified the milestones: 1.67, 1.68 Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci | full test Pull request is ready for the full test execution plugin | artifact Related to the `prepare/artifact` plugin. step | prepare Stuff related to the prepare step

Projects

Status: review

Development

Successfully merging this pull request may close these issues.

Prepare artifacts list with version details

5 participants