DavidVujic / poetry-multiproject-plugin

A Poetry plugin that makes it simple to share code between projects in monorepos.
https://davidvujic.github.io/python-polylith-docs/installation/
MIT License
190 stars 7 forks source link

Allow paths for top namespace #34

Closed ryaminal closed 1 year ago

ryaminal commented 1 year ago

Description

Adding the forward slash / to the filter for top-namespace when normalizing

Motivation and Context

We would like to create a top level with something like foo/bar so that the module can be imported as import foo.bar.stuff.

How Has This Been Tested?

Tested this locally on my mac. Should work on most *nix systems, but I'm not certain how it will impact Windows. Made sure to have files that actually import with the top-namespace.

Types of changes

Checklist:

ryaminal commented 1 year ago

I was really struggling to figure out how to better test this so mistakes like I made in #32 don't happen again. A simple unit test isn't sufficient, it seems. I wonder how the Poetry project and other Poetry plugins do unit/integration tests? We could do essentially automate what I started to do to test:

  1. create poetry project
  2. create a few files
  3. create another project that will consume project 1
  4. build project 1
  5. install project 1 in to project 2
  6. run a pytest in there

    That is so very cumbersome to setup, but not the end of the world. Curious if there is a better way for another PR.

DavidVujic commented 1 year ago

Thank you @ryaminal, I'll have a look!

ryaminal commented 1 year ago

We started using a project published with these changes and it appears to be working. Apologies again for the wasted time with my mistakes.

DavidVujic commented 1 year ago

Great, thank you @ryaminal! ⭐ I will have a look this weekend.

DavidVujic commented 1 year ago

v1.30 is out! Thank you for contributing to this project!