GithubHelp home page GithubHelp logo

Comments (5)

DavidVujic avatar DavidVujic commented on July 17, 2024

Thank you for reporting @ljnsn!

I have probably missed out on setting the paths correctly in the generated pth file for the tdd theme. I'll have a look!

from python-polylith.

DavidVujic avatar DavidVujic commented on July 17, 2024

I think this issue is solved now @ljnsn and I have released new versions of the PDM hooks, and also the CLI.

The tdd theme needs a sync and pdm install when a new brick has been added. This is the case for Poetry too.

The reason is because of the dynamic type of paths that is created with the tdd theme. This is related to why I came up with the - for Python - recommended loose theme, when learning that I had to add each unique path to my mypy configuration with the structure according to how it's done in Clojure.

The hook it is making PDM aware of where the bricks are found. What happens behind the scenes is that the Hook will add a pth file to the current virtual environment.

I haven't found a way to set wildcards to paths, and don't think that is possible.

Other than that, the tdd theme should work fine! 😄

from python-polylith.

ljnsn avatar ljnsn commented on July 17, 2024

@DavidVujic I can confirm it works now, thanks for the fix! 🙂

when learning that I had to add each unique path to my mypy configuration

What paths did you add? I usually run mypy with -p <namespace.package> in monorepos, but it still makes it necessary to list all the different packages, which is definitely not ideal.. I prefer the tests to live in the bricks' directories though, next to the source code, so for now I think there's no way around it.

from python-polylith.

DavidVujic avatar DavidVujic commented on July 17, 2024

On each PDM build command, there is a polylith_workspace.pth file created and handed over to the PDM build process. The paths added are the paths to the bases and components that are defined in the pyproject.toml file.

For the loose theme, the paths added are simply "/bases" and "/components". This is because the top namespace is directly below that path. And the top namespace is the same for all.

For the tdd theme, the paths to the top namespace are added such as /components/my_component_name/src. The pth file is updated each time with the new paths that have been added. I think the same goes for the MyPy config, it needs to know the path - the base/component name is dynamic with the tdd theme, so that's why it need to be updated.

Glad to hear that it works! 🎉

from python-polylith.

DavidVujic avatar DavidVujic commented on July 17, 2024

I have written a little bit about MyPy in the example repo: https://github.com/DavidVujic/python-polylith-example?tab=readme-ov-file#the-loose-theme

from python-polylith.

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.