Skip to content

Conversation

chiora93
Copy link

@chiora93 chiora93 commented Aug 4, 2025

Allow tov-uv to recognize properly a custom package root if any, without enforcing to have pyproject.toml in the same directory of tox.ini

Address issue #220

Allow tov-uv to recognize properly a custom package root if any, without enforcing to have pyproject.toml in the same directory of tox.ini

Address issue tox-dev#220
@chiora93 chiora93 requested a review from gaborbernat as a code owner August 4, 2025 13:10

show = self.options.verbosity > 2 # noqa: PLR2004
outcome = self.execute(cmd, stdin=StdinSource.OFF, run_id="uv-sync", show=show)
cwd = self.package_root()
Copy link
Member

Choose a reason for hiding this comment

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

Should be root instead of cwd.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

extra={},
)

def package_root(self) -> Path:
Copy link
Member

Choose a reason for hiding this comment

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

This should be a cached property.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

try:
return self.core["package_root"]
except KeyError:
config = self.core["tox_root"] / "tox.ini"
Copy link
Member

Choose a reason for hiding this comment

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

This can be a lot more, than just ini, like toml and various other file sources we support.

Copy link
Author

Choose a reason for hiding this comment

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

Good point. How do you suggest to handle this? Is there an utility or example in the project?

Copy link
Member

Choose a reason for hiding this comment

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

Why are we doing this entire dance? Why not just use self["package_root"] here?

We use `uv pip` to install packages into the virtual environment. The behavior of this can be configured via the
following options:

tox-uv resolves your project location based on the `package_root` setting. If that option is not defined, it will fall
Copy link
Member

Choose a reason for hiding this comment

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

We don't really want to publicize setupdir, rather package_root is what we should only advertise.

Copy link
Author

Choose a reason for hiding this comment

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

Agree, good point. Maybe at this point is too much to indicate this on README.md considering that people would expect consistency on package_root usage?

@gaborbernat
Copy link
Member

@chiora93 do you plan to pick this up or should we close it?

@chiora93
Copy link
Author

chiora93 commented Sep 12, 2025

@chiora93 do you plan to pick this up or should we close it?

Yes, I'll work on PR comments soon

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