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

Enhancement - Pathlib Support for Tools #4

Open
pcjcarmon opened this issue Feb 26, 2025 · 4 comments
Open

Enhancement - Pathlib Support for Tools #4

pcjcarmon opened this issue Feb 26, 2025 · 4 comments

Comments

@pcjcarmon
Copy link

Pathlib is a modern Python library for handling filepath/pathing and has been part of the standard Python library since approximately 2014 (Python 3.4). More than a decade later, my hope is that ArcPy be enhanced to accept Paths as inputs.

Currently, as of ArcGIS Pro 3.4, the utilization of Paths creates a runtime error which could be difficult for new ArcPy users to decipher; the workaround is to wrap all paths in a str() function. This is doable but clutters up development. The alternative is to do things the old-fashioned way with strings only which is a bummer.

This enhancement request is to provide the necessary functionality for file inputs as pathlib.Path type.

c. 2020 Add support for pathlib.Path objects to arcpy
c. 2021 Using pathlib with SearchCursor

@jblair-LCOG
Copy link

Interestingly enough, a few ArcPy objects do support pathlib paths (or probably more accurately pathlike objects. I know that arcpy.Exists and arcpy.da.Walk do. So whatever enables those to accept pathlikes should probably be extended to the rest of the functions or methods that allow pathlike parameters.

@ghisprince
Copy link
Collaborator

hi @pcjcarmon @jblair-LCOG , thanks for the post, we've been tracking that idea, this post is another data point helping us prioritize it.

If you haven't done so already pls give kudos to ESRI community: Add support for pathlib.Path objects to arcpy

thanks

@pcjcarmon
Copy link
Author

I appreciate having the community ideas help prioritize the work; however, I'm not sure that relying on the casual ArcPy user to upvote addressing technical debt is the most expedient route for implementing this kind of modernization.

@scw
Copy link
Collaborator

scw commented Mar 18, 2025

I appreciate having the community ideas help prioritize the work; however, I'm not sure that relying on the casual ArcPy user to upvote addressing technical debt is the most expedient route for implementing this kind of modernization.

Logging issues and upvoting ideas of course won't do the work, but it does help us in identifying areas that are particularly valuable to the community, to help us evaluate those, and finally provide a simple mechanism to acknowledge that we're going to work onto the issue. It also provides a simple mechanism for being notified when the issue is addressed, though arguably this repo will be a better place over time. Of course, a large system like ArcPy with some legacy patterns is annoying to bump into when you just want to solve your problems, the challenge being that there are many such areas across the system that matter to different groups.

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

4 participants