liormizr / s3path

s3path is a pathlib extension for AWS S3 Service
Apache License 2.0
206 stars 39 forks source link

s3path as uri-pathlib-factory uri backend plugin #111

Closed petrus-v closed 8 months ago

petrus-v commented 1 year ago

This proposal to replace #106

As agree on #106 I've developed https://github.com/petrus-v/uri-pathlib-factory which allow to mock pathlib and instantiate any pathlib uri backend implementation.

This PR is about to make s3path a plugin of uri-pathlib-factory.

Dependency is optional if developer wants to keep using s3path without factory.

@liormizr I'll be happy to get your feedback and some reviews from you on uri-pathlib-factory package !

liormizr commented 1 year ago

Hi @petrus-v

Looks like a great start But we have here a design that I don't fully understand if we created a separated URI library S3Path (and all the rest future "child" libraries) need to be his dependency Not the other way around.

In s3path I don't expect to see any code that relates to uri-pathlib-factory mention in the doc's could be nice but thats all. In uri-pathlib-factory you need to install s3path and use it there in my opinion

What do you think?

petrus-v commented 1 year ago

Hi @petrus-v

Looks like a great start But we have here a design that I don't fully understand if we created a separated URI library S3Path (and all the rest future "child" libraries) need to be his dependency Not the other way around.

In s3path I don't expect to see any code that relates to uri-pathlib-factory mention in the doc's could be nice but thats all. In uri-pathlib-factory you need to install s3path and use it there in my opinion

What do you think?

At the moment I've developed uri-pathlib-factory as a pluggable mechanism so from my point of view each backend (S3Path, FTPPath, ...) can decided to be a plugin of uri-pathlib-factory.

From now uri-pathlib-factory is only a factory, each "backend" as S3path can register itself as pluging (like the purpose of this PR) and decided by itself according provided constructor parameters if it's a s3 path/uri or not, so you are right at the moment uri-pathlib-factory is not aware about its plugings.

This allows, as a developer to choose different ways to work

In this way, you can easly turn existing python project using pathlib interface with s3 support by installing S3Path[factory] and loading the monkey patch.

I've to think a bit more to find proper solution to solve case such as my_ftp_path.rename(my_s3_path) as exposed by #107 but that will probably another library to do the glue between different backbends and probably some abstractions or tooling provided by uri-pathlib-factory.

I expect to generate and improve the documentation regarding uri-pathlib-factory, hope that clarify my vision I'll come back once I'll be happy with a rename case solution and will consider to move dependencies in the other way !