Comments (5)
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.
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.
@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.
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.
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)
- verbose output for `poetry poly sync` HOT 3
- Poly check can't understand pillow dependency HOT 8
- Sync should respect --quiet flag HOT 1
- How to handle dependecies? HOT 3
- Poly diff to list changed bases/components for CI testing HOT 2
- poly diff reports changes on non-brick code
- Support for different git tag patterns (stable-*, release-* etc.) HOT 1
- PDM support HOT 1
- In-brick pyproject.toml support HOT 3
- Any example to deploy a project using docker? HOT 1
- Add support for Python 3.12 when analyzing source code (poly libs)
- poly delete HOT 1
- adding a poly deps command
- poetry scripts break when building with --with-top-namespace HOT 8
- poetry poly create base will allow names with dashes HOT 4
- Poly sync not working properly for projects in sub-directories HOT 1
- poly info command does not list components under lower level namespaces HOT 1
- [Feature] Optionally generate `py.typed` stub file, while creating bases & components HOT 9
- Allow using `tests` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-polylith.