Open dual-wield-ray opened 1 year ago
Hi! Sorry for the late reply, I've missed the notification.
Yes, I indeed removed the logic. There was some reasoning behind the decision.
Relying on .git while developing feels "zero cost" (no need to create .project-root), but it's dangerous in a sense. I remember me trying to use from_root
in drafts which were never meant to get under version control, so no git init
whatsoever. And, surely, "Anchor's not found" immediately after running the script. But it's not a big deal, some may say.
There is a bigger one. Once I thought "What if my user install the library somewhere other than into site-packages?.." The package will break again. Not a usual case, but still.
The only robust way, like 100% bulletproof, is to add .project-root anchor. If you've created the file, there is no way anything will ever break. So I would want from-root
users to follow this practice to guarantee everything is fine no matter what.
Not zero cost anymore, but still very simple. But at the same time, presence of the file may annoy some people
On the other hand, if we have support for ".git" and "site-packages", ~99% of users will be happy: no need for .project-root at all, so from-root
will feel like magic most of the time.
I'm open for discussions on that :)
It just dawned on me that from-root
may look for requirements.txt
, pyproject.toml
etc. I will reconsider the whole thing in the nearest future and make a new release :) Got some new ideas. Thanks for making me rethink it all
Hey! Yeah I think we're on the same page. :) That was my initial reasoning: I was part of the 99% of the users for whom the library worked like magic, so I was initially confused.
If you are working locally only (no .git, no site-packages) then having an error pop up is still a problem worth addressing: no reason why you would need source control for fetching a folder locally. So that in itself could warrant the .project-root you implemented (unless we come up with other ideas for a smart guessing algorithm).
There's also an issue that people don't always use pip
! Apparently (thank you ChatGPT) Conda installs the packages in a folder called pkgs
:). That said there aren't a million systems in existence so just adding that case could cover the overwhelming majority of users.
All in all, maybe instead of forcing a file creation, it could be treated as an override? If all else fails, prompt the user to create the .project-root. That way you will only need to redirect to the documentation the 1% of users for whom the magic solutions don't work. What do you think? :)
Hello! Thank you for creating this package, it’s been very useful and saved me time on my current project. I’m not sure if this really warrants an "issue" as it's more of a question, but I did not see a tab for creating discussions on the repo so feel free to close this.
I was wondering: my project made use of the logic for finding the root in a “site-packages” folder. This way the root would be found even if a user pip-installed it. It looks like this logic was removed in the last few days. What is the new preferred method of setup when a .git folder is not present? I see there is an option for a "project-root", should I be creating an empty file with this name at the top level?
Thank you and have a nice day :)