DavidVujic / python-polylith-example

Example Polylith setup for Python
MIT License
51 stars 8 forks source link

A microservices example of python-polylith #2

Closed ttamg closed 1 year ago

ttamg commented 1 year ago

@DavidVujic

I think the Polylith framework is particularly interesting for micro services in a monorepo. So before I build anything on it I wanted to see how well it would work on a simplified microservices architecture. I have spent a few hours on building this example repo https://github.com/ttamg/python-polylith-microservices-example.

This example is a bit more involved than your example in this repo as there are a few more components and I also wanted to see how the orchestration across docker-compose work work. So far so good.

I have not worked on testing though yet - that's always a challenge in micro services to do integration tests or end-to-end tests. It's been a huge time sink for me in the past so I want to see how this would work in this framework. That's something for me to do next.

I've also put notes down tutorial style as I find that useful for my future self or someone else. Also we are a bit short of documentation so far on your tools and framework so feel free to take anything you find helpful from it.

DavidVujic commented 1 year ago

⭐ This is awesome! ⭐ Many thanks for this ❤️

I think a guide like this is very valuable for those new to Polylith in general, and how to use it in Python.

DavidVujic commented 1 year ago

I also like your way of using Jypyter notebooks for the development, I have not used notebooks (yet) but it looks very nice.

ttamg commented 1 year ago

@DavidVujic what are your plans for taking forward this tooling and topic? I think this framework and the tooling has legs and can be useful in Python. But it will need more docs, tutorials, examples and resources to help people get started on it. So far I could find the following resources:

Are there other useful resources I have missed, or do you have plans for them? Or are you looking for help with them?

DavidVujic commented 1 year ago

My current plans for the next week or so is to add a new command that I think will help out with keeping track on third-party dependencies. It's somewhere between the Clojure "poly deps" and "poly libs" commands, and I will probably add it in a newpoetry poly libs command. I also plan to add generated READMEs according to your suggestions within a day or two.

When those are published, I will record a short video and write a blog post about it too.

Next up I had an idea of a "migrate to Polylith" guide, and initially had an idea of migrating an existing Python RealWorld app to Polylith - something similar to what Furkan Bayaktar has done in Clojure.

I want to test out if my assumptions about migrating Python code are correct:

There's docs and info spread out in blog posts, repos and videos, and long term I would like to have something similar to the official Polylith gitbook (not necessarily that technology, could be something else).

Here's some posts that I have written and that probably could be used in a "book" about Python Polylith: About organizing code into smaller parts, aka components: https://davidvujic.blogspot.com/2022/08/a-simple-scalable-python-project.html

Overview and introduction about Polylith for Python: https://davidvujic.blogspot.com/2022/11/the-last-python-architecture-you-will-ever-need.html https://davidvujic.blogspot.com/2022/02/a-fresh-take-on-monorepos-in-python.html

If I may, I would very much like to share and spread your tutorial! And I would very much appreciate ideas and feedback as you already do about real-world usage of Polylith. I have experience in a long-term project for Clojure, and also a single-project built up with components in Python. But not really an all-in Polylith Python repo with many projects.

ttamg commented 1 year ago

Thanks. I have had a read. Looks good.

I'm very happy if you want to use that tutorial. Please go ahead.

I'm also happy to get involved in writing up how some of it works if that's useful. I'm a decent writer and I have a few thoughts and questions already that I've noted as I go along.

Perhaps we should move discussion off to another more freeform channel though than Github issues? Discord? Slack?

DavidVujic commented 1 year ago

Good idea! How about the pythondev slack? I've 👋 and mentioned Polylith in the architecture channel there. Did the same on the python discord in the "software design" channel.

https://www.python.org/community/

ybenitezf commented 1 year ago

h! @DavidVujic i'm working on migrating a private repository containing several aws cdk applications using the python-polylith approach. I'll not make promises but when i have some time will be writing some post and a sample repository.

So far so good !!! this is a nice approach !!!

DavidVujic commented 1 year ago

I'm happy to hear that @ybenitezf!

Let me know if you run into any issues or have feedback. I also hang out in Pyslackers (architecture and help channels), if you want to chat: https://www.python.org/community/

ybenitezf commented 1 year ago

Hello @DavidVujic i am back: this is my demo/article https://dev.to/ybenitezf/aws-cdk-app-with-polylith-code-architecture-30e3

DavidVujic commented 1 year ago

This is great @ybenitezf, great work! 🎉 👏 ⭐

Would it be okay if I add links to your article and repo in the "examples" and "tutorials" section of the docs? https://davidvujic.github.io/python-polylith-docs/

ybenitezf commented 1 year ago

This is great @ybenitezf, great work! 🎉 👏 ⭐

Would it be okay if I add links to your article and repo in the "examples" and "tutorials" section of the docs? https://davidvujic.github.io/python-polylith-docs/

You can add the link...I forgot to add a link to the example repository to the body of the article 🤦

DavidVujic commented 1 year ago

Great! It is now added: https://davidvujic.github.io/python-polylith-docs/examples/ and https://davidvujic.github.io/python-polylith-docs/videos/

Thank you again for creating the demo and article, much appreciated!

DavidVujic commented 1 year ago

Closing this one, the issue was created before the documentation was released and it has also been updated with links to the example repos and blog posts posted here in this issue.

⭐ Thank you again for contributing to the Python tools for the Polylith architecture! ⭐

Docs: https://davidvujic.github.io/python-polylith-docs/