Conf42 Python 2021 - Online

Shopyo: Your Mega Flask Machine

Video size:


Django and Flask regularly come out as the most preferred tools of Python developers. Django is the heavy tool while Flask is the flexible, tedious solution if not careful. This talk unveils Shopyo which leverages Flask loaded with Django advantages. Presenting a monster of a new kind.

This talk presents Shopyo. A framework to help Flask users get started quickly with a great architecture and features never seen before in the Flask world. It allows Flask people to have Django powers, and beyond. It allows the use of apps/modules with the addition of a concept called box. It also supports some Django commands like collectstatic. It comes with tests and docs ready to go. We also included a few touches of Masonite. It’s much, much more than a Flask boilerplate project. In line with the Flask spirit it leaves much control of the wizardry in your hands, you the user.

The framework was designed to spin big, flexible and organised projects. The talk presents the features of the project as well as setting up a demo project. This talk is an advanced one. It requires the user to have knowledge of common packages like flask_login, sqlalchemy, alembic & flask_migrate, flask_wtf, sqlalchemy_wtf, of concepts like multi-profile configs and the app factory pattern etc. To be a well grounded Flask dev if you like. Just go over them if you are reading these lines as the talk needs at least a conceptual knowledge of those.

Why should you waste your time attending this presentation?

I decided to present the conclusion of years and years of Flask development as a framework which allows you to stand on the shoulders of giants from day one.


  • Conf 42 Python is a yearly event which hosts some nice talk. This talk is about version three nine four of Shopyo. Shopyo is a web framework for Flask. We just moved from a personal repo to an organization repo.
  • Flask and Django unsurprisingly come up as the top most popular web frameworks. Why do people use Django? What factors do they consider before using Django? It's also because of the wide range of apps available.
  • Shopyo allows you to combine the power of flask with the flexibility of Django. A Shopyo app is an app which has different modules. You can share modules between projects. There are also docs, hands tests included.
  • Shopping also comes with a theming system. It has module related utilities, migration, set management. Why use Shopview? Like why a new framework that is built on top of flask?


This transcript was autogenerated. To make changes, submit a PR.
Welcome everybody to the mega Flask machine. Welcome to Conf 42 Python site. I come from the Python user group of Mauritius. Mauritius which is a small island in the Indian Ocean. About me I'm a Python developer for my own account and also a flask on organised member and a flask community work group member. Flask one is a yearly event which hosts some nice talk. We've had a first edition last year and we hope to have another edition this year. Hands I'm also a shopyo maintainer. Shopyo which is a web framework. It's actually a mega machine for Flask. You can see we just moved from a personal repo to an organization repo. Along with the documentations. We now host it on reader docs. And this talk is about version three nine four. The story begins with web frameworks. Currently, if you analyze the stack overflow survey, if you just see the stats for the most popular web frameworks in the world, and among them Python ones, you will see that Flask and Django unsurprisingly come up was the top most popular web frameworks. And we might analyze like a bit what drives people to choose web frameworks. For example, we have Django. So why do people use Django? What factors do they consider before using Django? The first one is the ability to get started quick. It was developed to be used under pressure and people find it really awesome, really useful to just get started with Django. You spin websites really fast and also in the people take into account a frameworks. The time development has been going on, active development, I mean people have been presenting, there have been releases hands, all these strengthened project people look at these version number certainly like some people take it as a hint, but also whether the package has been adopted by the community, by companies, whether or not the app is being used in production. And in that sense we can say that Django is a pretty much solid choice. It's pretty old also, and also about the Django ecosystem, which is strong, you want to build a feature, you know that there must be a package which already implemented the feature. You just go and grab the package and use it in your own project and you're good to go. That's why people choose Django, because you can customize your projects, sometimes many times easily. And also it's scalable. That is you have your app here, you want to make complex app, you want to make a big app, you just continue developing. You don't have to find a better architecture, not in terms of infrastructure, but in terms of code organization. So you just focus on developing. And also, since Django is a widely used package, it's powering many websites. So obviously it integrated common security fixers, common security flaws, it addressed those flaws. And maybe if you were to start off on your own, you would have you yourself to address those issues, to provide the lines to those common issues. Because these are common issues, they're bound to be recurring or it's within reach of people to breach. So Django got you covered up. It's also because of the wide range of apps available. Like you have e commerce, you have pretty much everything you have for manipulating jurispatial data. You have quality packages. Sometimes among all Python frameworks, you can find packages for certain fields only in Django, geospatial, for example. So we can say that we have a wide range of app for Django. Now comes to the question, why flask like? You have Django here? Why do people still go for flask? Like, is Django not the answer to no? Obviously people choose flask for a reason. The first is that it's very easy to pick up flask, ten lines. You get your flask app running these yourself, right? And it's awesome. It's amazing. You want an endpoint to return some text or something like that, something simple, something basic. Flask is really easy to pick up, and floss gets out of your way. You want to program, you want to do something. So floss is not here to actually prevent you from doing the way you want to do. Important for people who have grown big enough so that the Framework doesn't get you see, that was is better. So with Flask to do that, you can actually roll out your style. It's about doing it and also enjoying your development time. The flask kind of let you enjoy the way you want, and also about customization, much like Django. But Flask also has, since Flask is a very simple, a very bare bones framework, you have to customize it. And for that purpose, you have an awesome collection of plugins. You have an awesome range of plugins available for you to customize. These really make. It's like cooking. You have to find the right ingredients, in what quantity, in what proportion. You want this in your app, you want that in your app, you have to decide on the ingredients of your app. You can have the perfect meal. In other words, then let's say that we have flask, we have Django. But what if we could have both? What if we could have the power of Django? The incredible development speed of Django, the head started of Django with the flexibility, the customizability of flask. Like what if you could have both? That's precisely what Shopyo is. It allows you to have the organization, the cross sharing of modules of Django, features found in Django, like main entry points, commands used by Django, pretty much everything which characterizes Django and Django apps. Well, those and these, you still retain flask. You retain the flexibility of flask, you retain the customizing power. If we can put it like that of flask, what if you could just merge both? That's what Shopyo is. And conceptually speaking, what is a Shopyo app? Well, you can think of a shop you app as an app which has different modules. That's how you picture a shop you app in your mind. And when we say like, why Shopyo? We were saying we have flask, we have Django. But from the perspective of a flask developer, why would you want to use Shopyo? It's because Shopyo has modules. And who says modules? You can share it between projects. You have superpowers found in Django. You have the organization of very, very organized code base. We even have a concept called boxes which allows you to organize your apps up to a higher level so you have a great level of organization. It's feature packed. Like if you were to add all the features that Shopview provides you, it would have taken you a lot of time, lots of trial and errors, and each time redoing it, it becomes boring. For example, you have migration. Shopyo provides you with migration, with the migration mechanism, with assets management, with modules. And you also have docs, hands tests included. What I mean by docs and tests, I don't mean the Django documentation, the shopping documentation or flux documentation I'm talking about for your project. I'm not talking about framework documentation, I'm talking documentation for your project. Like you have a project which does something and you want to set up some instructions about a specific part to how to connect to a specific API, how to do this and that. So you have to write some documentation. And another great place besides the readme is a proper doc system. So for example, you have Sphinx. Shopyo comes with Sphinx loaded by default, and also tests, tests and test fixtures, things you need to get started to writing tests. Everything is set up for you to continue on expanding and so that you don't forget those two important aspects of a project. So documentation and tests are included. The basics of it are included so that you can continue development. And also Shopyo, though it provides you with awesome powers. Shopyo is transparent. It leaves much power of usage in your hands, rather than in our hands, in Shopu's hands. And also whatever is going on is clear. You can see in the app py how Shopyo accomplishes this, how it accomplishes that, and you are free to change it if ever you want. But the idea is to have something that people can relate to. Let's say that yes, it gives you all those powers, but you have to learn, you have to do something here and there, so it's not kind of worth it. But Shopview preserves the simplicity of if you were going bare bones floss. So what does a shop you project looks like? As you can see, this is how you conceptual Shopview app in its full picture. You have modules, you have boxes. Boxes is a way to organize modules. You can share modules among projects, among Shopyo, your projects, or you can share boxes among Shopview projects. They will work. And then you have fixtures, some common fixtures for login, logout, et cetera, admin user, et cetera. It's already included, you can use it. You cannot use it if you want, it's up to you. But they are included if you want to go. The Django was, they are included. You also have the basics of documentations already available. Shopping also comes with a theming system. Let's say you have a site, you want to change themes. It was a way to customize everything with a we can say whatever and however you want it. You just need to sit down and take the time to really write your theme and then you can use it. And it even has an admin panel whereby you can change the themes. It has module related utilities, migration, set management. So these are some utilities present. You have utilities sections, tests and docs and tests. You have themes, you have mail that yes, it comes integrated with mail. You have secrets management, you have config profiles, you have of course the application factory. I mean a shop. Your project is an advanced flosk app from the beginning. You want to have a super advanced Flask app. So feel free to use Shopyo. You get it for free from day one. And if you don't like some pictorial representation of what a project looks like, you certainly have this representation here which you can pose, you can see, you can go more into depth to see exactly what these shop you app looks like. Lines, that's vanilla, that's without anything. You just have those. And then as to a module focusing on a module, well, a module actually makes up of different parts. And unsurprisingly like Django, you can relate. If you've used Django, you have a static folder, your templates folder, your tests folder that's included by default by Shopyo. When you create a new module, then view models, forms upload upload is for dbcding and info. JSON is about more information, gives more information on the module. As you can see you can get pretty much organised codes hands among that. Your static folder is optional, even the view file is optional. You can have an endpoint or you can use a package solely for the purpose of organization. You don't need to have an endpoint associated. And then as for the commands you have run debug, you have run server. Much like there is a subtle difference, but you get it, you won't even know whether it was Shopyo or not. And then you have basically collect static just like Django. Those are some commands supported by Shopyo. But most importantly here you can see how you start Shopyo, your new for example blog. Then you see the inside two directories to finally arrive at your focus starting point I can say of the app. So try it, drop your project name. So that's it. Those are some commands that we support. Initialize basically instantiates the DB and collect static, collects your assets and then in your code you can use get asset so that your code remains the same for development and production. You also have migrate commands which you can use. And then one question which always nearly comes out when I do presentations of Shopyo is why not use Django? You have all the mechanisms of Django, you have everything here. Why use Shopview? Like why a new framework that is built on top of flask? Well dancer is because flask because of the spirit of flosk, because of the floss ecosystem, because of for example sqlalchemy. That's why you would want to stick with flask. But at the same time as a flask user, you want to get more powers. That's where Shopview comes in. The other questions that people ask silently inside them themselves, whether or not the packages is reliable, we are happy to say that we don't maintain middlewares, we use flask login for login we use Flask admin, migrate, WTF, WTF, Sqlalchemy, emailman. These are popular, reliable, solid packages which have been going strong for years. Since we don't maintain our middle west, there are less chance of doing something really damaging to a project. But at least our tech stack is quite interesting, stable and we've reached the end of the slides, hands the end of the presentation. And I can say that maybe one point which I did not touch, it's about what's the big deal about going flask bare boots. This project looks intimidating to get started with. It's like you have all these files just to get started with. Well, to tackle this one first, we'll say that shopyo these is not for every project. You need to know when it will benefit you, when it will be great, when it makes sense to use it. If you want something maybe very simple, maybe this is not the project. But even if someone wants to use it in every case, so he can. But you really need to know when to use it, whether it will benefit me. What are the advantages? You can compare it to Django to get an idea. I think we can finish.

Abdur-Rahmaan Janhangeer

Founder @ Compiler Alchemy

Abdur-Rahmaan Janhangeer's LinkedIn account Abdur-Rahmaan Janhangeer's twitter account

Awesome tech events for

Priority access to all content

Video hallway track

Community chat

Exclusive promotions and giveaways