Giter Club home page Giter Club logo

Comments (8)

yurivict avatar yurivict commented on July 16, 2024

dwavesystems/dwave-preprocessing#45

from dwave-cloud-client.

arcondello avatar arcondello commented on July 16, 2024

Hi @yurivict , dwave-system, dwave-cloud-client, dwave-preprocessing, dwave-drivers, dwave-samplers, etc are all namespace packages. Specifically pkgutil-style.

from dwave-cloud-client.

yurivict avatar yurivict commented on July 16, 2024

But they conflict with each other because they all install the same file.

from dwave-cloud-client.

arcondello avatar arcondello commented on July 16, 2024

This is intentional. It allows all of those individually installed packages to share the same dwave namespace. That's also why the file is identical in all of them. See namespace packages. At some point in the future we may switch to using native namespace packages which do not require an __init__.py, but since we first started using them when we still supported Python 2, we still use the pkgutil-style.

from dwave-cloud-client.

yurivict avatar yurivict commented on July 16, 2024

In such case the correct structure would be to have one base package that installs __init__.py and then have any number of other packages that depend on it which don't install __init__.py.

Package managers reject file conflicts - such packages can't be installed at the same time.

from dwave-cloud-client.

arcondello avatar arcondello commented on July 16, 2024

Our supported package installer, pip, handles the conflict by creating the following structure:

site-packages/
    dwave/
        cloud/
        preprocessing/
        system/
        __init__.py

I believe it keeps the first installed __init__.py from that namespace and ignores subsequent ones, but I would need to go deeper into the docs to confirm which __init__.py is used.

from dwave-cloud-client.

yurivict avatar yurivict commented on July 16, 2024

What would happen if these files would be different? Would one of them be ignored? This would lead to a breakage.

from dwave-cloud-client.

arcondello avatar arcondello commented on July 16, 2024

If they were different then yes, many would be ignored. Which is why we keep them identical, as required by the docs I linked above. Relevant section:

Every distribution that uses the namespace package must include an identical __init__.py. If any distribution does not, it will cause the namespace logic to fail and the other sub-packages will not be importable. Any additional code in __init__.py will be inaccessible.

from dwave-cloud-client.

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.