Giter VIP home page Giter VIP logo

Comments (4)

ap-- avatar ap-- commented on August 16, 2024 1

Edit: I would be happy and try to contribute a basic SMB implementation, is there any guide or example I can follow?

Sorry, just saw your comment. Thank you for offering to contribute! You would have to create tests in upath/tests/implementations/test_smb.py which requires you to write a fixture that sets up the smb filesystem via a docker container. There is code in the fsspec/filesystem_spec repository that does this. You would then put your minimal implementation in upath/implementations/smb.py and add an entry pointing at your new class into upath/registry.py

This should allow you to run the test suite against your class and make adjustments for various edge cases.

Cheers,
Andreas 😊

from universal_pathlib.

tharwan avatar tharwan commented on August 16, 2024

I appear I can fix this behaviour by implementing a very simple subclass that returns an absolute path:

class SMBPath(UPath):

    @property
    def path(self):
        return "/" + super().path

The docs from ffspec mention that:

Note: if using this with the open or open_files, with full URLs, there is no way to tell if a path is relative, so all paths are assumed to be absolute.

Which sounds like interpreting every path as absolute should be the default behaviour. Should I maybe file a bug with fsspec instead?

from universal_pathlib.

ap-- avatar ap-- commented on August 16, 2024

The fact that it worked with a previous version of UPath suggests that it's a UPath bug which got introduced during the refactor. Ideally we would add a SMBPath implementation to UPath to be able to give more guarantees for all the path methods.

I'm on holiday until the end of May and will then try to find some time to work on setting this up. We would need to implement an SMBPath subclass and the test fixtures to run the base test suite against it.

from universal_pathlib.

mraspaud avatar mraspaud commented on August 16, 2024

Hi, we have the same problem with an sftp-based filesystem:

path = UPath("ssh://myserver.mydomain.com/home/user1/Documents/hello.txt")
print(path.path)

'home/user1/Documents/hello.txt'

ie the first / is missing.

from universal_pathlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.