-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feature/better types #31
Conversation
Adds a simple registry of known schemes and their mappings to BucketClient subclasses. There's a hardcoded list of built-in services, and (in theory) you can register more dynamically. I think I prefer to hardcode and include most of the known services, and lazily import them so you only need their packages when you actually use them. The hope is that this lets the strong typings flow through to the clients (because they can be statically inspected). If we can't get specific types flowing through nicely, maybe it's okay to do more of a dynamic import style registration. BREAKING CHANGE use_fs, get_fs_client, use_fs_cache, get_fs_cache, and clear_fs_cache moved from pathy.api to pathy.clients
- really the title is secondary to the commits in the PR. We'll continue to use the Semantic PR github app as long as it works
BREAKING CHANGE: This renames the internal GCS/File adapter classes by removing the prefix Client. ClientBucketFS -> BucketFS ClientBlobFS -> BlobFS ClientBucketGCS -> BucketGCS ClientBlobGCS -> BlobGCS
- this makes the Pathy type accessible where it otherwise would not be for TypeVars.
- make the assertion prettier 😎
- in some cases the mypy errors are too uptight about subclasses and their types. When that happens we silence the error and provide the expected subclass type.
- we black format last, so the order/indent could be changed.
- since consolidating the Pathy class in the base.py file, there's no need to TypeVars, we can just use a forward ref to Pathy itself 🎉
Codecov Report
@@ Coverage Diff @@
## master #31 +/- ##
==========================================
+ Coverage 78.37% 79.47% +1.10%
==========================================
Files 8 7 -1
Lines 823 872 +49
==========================================
+ Hits 645 693 +48
- Misses 178 179 +1
Continue to review full report at Codecov.
|
🎉 This PR is included in version 0.3.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Refactor the codebase to get better types flowing throughout, and add lint check to the CI for making sure mypy is satisfied.
Changes
sh tools/lint.sh
/sh tools/format.sh
)base.py
removingapi.py
andclient.py
(needed to avoid circular imports)