You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have just moved my noxfile from my project root into my "tests" folder, and so I now call nox providing the full path to the noxfile (--noxfile <path>).
Now, looking at the code some more, this seems like it's just the first error I encounter using my noxfile, I would assume that all of _PoetrySession.poetry is going to be broken since Poetry.config also assumes a correct cwd:
@property
def config(self) -> Config:
"""Return the package configuration."""
if self._config is None:
self._config = Config(Path.cwd())
return self._config
So the best fix would be, I believe, to implement a more solid way for your Poetry class to detect the exact project root. This could then be used in export_requirements (and probably some other places too).
I have some code from an internal tool I made, that seems to work:
path = Path.cwd()
# Find the project root path by locating the pyproject.toml file
root = Path("/")
while not (path / "pyproject.toml").exists():
path = path.parent
if path == root:
raise RuntimeError("This tool only works in a development folder.")
At the end of this, path should be the actual root of the project, where you can find all of poetry's files.
The text was updated successfully, but these errors were encountered:
I have just moved my noxfile from my project root into my "tests" folder, and so I now call nox providing the full path to the noxfile (
--noxfile <path>
).However, as the nox documentation indicates at https://nox.thea.codes/en/stable/config.html#nox.sessions.Session.invoked_from, if the given noxfile is in a different folder, then nox will cwd into that folder. This will then break the relative path used in
_PoetrySession.export_requirements
:Now, looking at the code some more, this seems like it's just the first error I encounter using my noxfile, I would assume that all of
_PoetrySession.poetry
is going to be broken sincePoetry.config
also assumes a correct cwd:So the best fix would be, I believe, to implement a more solid way for your
Poetry
class to detect the exact project root. This could then be used inexport_requirements
(and probably some other places too).I have some code from an internal tool I made, that seems to work:
At the end of this,
path
should be the actual root of the project, where you can find all of poetry's files.The text was updated successfully, but these errors were encountered: