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

append should ideally return a filepath (or tuple of filepaths) not a bool! #59

Open
bernd-wechner opened this issue Jun 14, 2024 · 0 comments

Comments

@bernd-wechner
Copy link

Just browsing the cod because pipx depends on it and its ensurepath options make unspecified changes to the file system. Drilling down into those, I find it relies blindly on userpath.append() function.

That function returns a boolean for success or failure. IMHO and this is merely my view on the matter of course, it should ideally return either None (for failed) or a string, or a tuple of strings if it succeeded, the string or tuple of stings containing the file paths of all files modified in the process.

This should be backward compatible, evaluating None as False and a string or tuple thereof, as True in any Python boolean context anyhow, breaking only any apps that (strangely) tested explicitly against False or True values.

In any case, IMHO a package like this making changes to the system files should inform upstream of what files were changed for transparency and integrity.

I say a filepath or tuple thereof because if it's just one a string suffices, if you modify all shells for example then a list is needed. For consistency, perhaps always a tuple with 1-tuples returned when only one shell is updated.

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

No branches or pull requests

1 participant