Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Firecrest class is good, but it lacks a simple, programmatic, way to interact with the file system, consistent with how you would interact with a local file system.
This PR adds the
FcPath
class, which directly mimics the https://docs.python.org/3/library/pathlib.html interface, to provide such an interface. For example:In order to limit calls to the REST API, I have also added the concept of caching.
For example, when using
list_files
, the generated paths have the mode cached:You have to specifically enable use of the cache, then methods like
is_file
,is_dir
will use this cached value.For example, this requires only a single API call:
I have also created https://pypi.org/project/virtual_glob/ which can work with this implementation to provide recursive globbing:
I haven't added any pytest tests in the PR yet, but will do if you agree that this should go in to this package
Note, one pain point at the moment is eth-cscs/firecrest#171, which means you can't currently get the file mode from the
/utilities/stat
API, and have to use/utilities/ls
to workaround it.Hopefully this will be fixed soon 🤞