Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split the unconditional runtime dependencies into extras #52

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

jessicamack
Copy link
Member

All the runtime dependencies of awx-plugins-core are unconditional now. To take into account being able to depend only on certain plugins, I've split them into optional ones.

This comment was marked as outdated.

@webknjaz
Copy link
Member

@jessicamack to fix the CI, change pyproject.toml to pyproject.toml --all-extras on these lines: https://github.com/ansible/awx-plugins/blob/c7fc0a1/.github/workflows/pip-tools.yml#L102-L128. Also, here https://github.com/ansible/awx-plugins/blob/c7fc0a1/tox.ini#L15, after deps =, add extras = with a column containing all the extras, one per line, use two-space indents.

pyproject.toml Outdated Show resolved Hide resolved
@webknjaz
Copy link
Member

@jessicamack have you seen #52 (comment)?

@webknjaz webknjaz self-assigned this Oct 31, 2024
@webknjaz
Copy link
Member

webknjaz commented Oct 31, 2024

UPD: this is failing because of a bug in tox (tox-dev/tox#3433) which is blocking the PR.

Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

@jessicamack so I learned that PEP 685 will make the format of extras stricter in the internal core packaging metadata version 2.3. The user-facing extra names might still be allowed to be non-normalized. But in general, it's best to just follow that format to avoid confusion. Evidently, some tools are going to get confused and hit corner cases if we don't do this.

Action items:

  • Change extra names in pyproject.toml to have - instead of _
  • Change extra names in tox.ini to have - instead of _

pyproject.toml Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
The extra names in the core packaging metadata are allowed to contain
dashes but not underscores [[1]]. Packaging tooling is supposed to
normalize them if met in the non-metadata configuration but apparently
tox has a bug connected to this, which prevents is from discovering
dependencies provided by extras that contain underscores [[2]].
So as a workaround, this patch uses hyphens in the names of extras,
avoiding any underscores.

Making the direct dependencies optional, means that they are not going
to be picked up by default. To enable pip-tools to include them into
the lock files, this change also updates its configuration file to
instruct it to include dependencies from all the extras present by
always using `--all-extras`. Likewise, to enable tox to install those
dependencies, they are all listed in its configuration file too.

Co-Authored-By: Sviatoslav Sydorenko <[email protected]>

[1]: https://packaging.python.org/en/latest/specifications/core-metadata/#provides-extra-multiple-use
[2]: tox-dev/tox#3433 (comment)
@webknjaz webknjaz changed the title Split the unconditional runtime requirements into extras Split the unconditional runtime dependencies into extras Nov 4, 2024
@webknjaz
Copy link
Member

webknjaz commented Nov 4, 2024

@chrismeyersfsu could you confirm that the extra names look fine? Not that they can't be changed, but it's a chance to update them if there's anything obvious that stands out.

Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

Waiting from Chris' take on the name, and then we can merge.

@chrismeyersfsu
Copy link
Member

chrismeyersfsu commented Nov 6, 2024

So I understand, after this merges, awx will NOT get these extra modules from awx-plugins.interfaces unless awx adds the optional directive I.e. awx-plugins[x,y,z]

@webknjaz
Copy link
Member

webknjaz commented Nov 6, 2024

Yes. Although, it could just start depending on the version you released on Monday until things settle and they those extras that remain post split activities would need to be listed along with the version bump.

@webknjaz webknjaz merged commit 678ea69 into ansible:devel Nov 6, 2024
27 checks passed
@webknjaz
Copy link
Member

webknjaz commented Nov 6, 2024

Now a companion dep update is needed in awx.

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.

4 participants