Skip to content

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

@bernd-wechner

Description

@bernd-wechner

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions