-
-
Notifications
You must be signed in to change notification settings - Fork 29
feat: Support custom package root #226
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
base: main
Are you sure you want to change the base?
Conversation
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
for more information, see https://pre-commit.ci
src/tox_uv/_run_lock.py
Outdated
|
||
show = self.options.verbosity > 2 # noqa: PLR2004 | ||
outcome = self.execute(cmd, stdin=StdinSource.OFF, run_id="uv-sync", show=show) | ||
cwd = self.package_root() |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
@chiora93 do you plan to pick this up or should we close it? |
Yes, I'll work on PR comments soon |
Rename variable for consistency
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