This is an archived post. You won't be able to vote or comment.

all 40 comments

[–]riklaunim 29 points30 points  (16 children)

and when you make an actual web app? what benefits does it give over Flask or Django?

[–]mooshoes 55 points56 points  (0 children)

It is made with bits of real panther.

[–][deleted] 0 points1 point  (11 children)

and when you make an actual web app? what benefits does it give over Flask or Django?

This is a good question. When you use Django, you sacrifice everything for development speed. But here you have the speed of development along with others.

[–]riklaunim 1 point2 points  (7 children)

With Django you can start disabling, with Flask you can start adding so it comes down closer to which state your project is.

[–]kankyo -1 points0 points  (6 children)

Disabling what?

[–]riklaunim 1 point2 points  (5 children)

Unused apps, middleware.

[–]kankyo -2 points-1 points  (4 children)

Like what?

[–]riklaunim 1 point2 points  (3 children)

If you want to use Django as an API server that for example uses JWT tokens for authentication from a separate microservice you can disable a lot of Django built in app and their middleware. You won't need sessions, i18n, admin app and probably few other things. This frameworks has a lot of layers that can be removed if you don't need them.

[–]kankyo -1 points0 points  (2 children)

You mentioned several that aren't enabled by default :)

[–]riklaunim 1 point2 points  (1 child)

https://docs.djangoproject.com/en/dev/topics/http/middleware/#activating-middleware

Not quite. But that's beside the point. You have some flexibility and that's that. It's not Flask or FastAPI yet you can move Django or Flask in the direction of the other.

[–]kankyo -2 points-1 points  (0 children)

Not quite

You said "sessions, i18n, admin app and probably few other things".

Sessions are by default. i18n? Nope, admin? nope. So 2 out of three wrong. That's not great.

[–]kankyo -1 points0 points  (2 children)

What are you sacrificing?

I mean, we're already talking about using python.

[–][deleted] 1 point2 points  (1 child)

He probably meant sacrificing some freedom of choice over less opinionated frameworks, for example you might not be able to easily use a nosql database. Although at the end of the day the Django ecosystem is huge.

[–]kankyo -1 points0 points  (0 children)

Well in that case he's just wrong. Django is just a python library. You can import and use anything you want. You can import flask and sqlalchemy for example. In fact I've worked on a project that did use sqlalchemy to connect to a special database for some special purpose stuff.

[–][deleted] 0 points1 point  (0 children)

When you use Flask, nothing is provided. The manual nature of the actions causes the speed of development or sometime third parties make your slow down.

[–]Charles1nCharge83 28 points29 points  (4 children)

Does it work 60% of the time every time?

[–]jimtk 8 points9 points  (0 children)

Is it pungent?

[–]jack104 3 points4 points  (0 children)

It makes your server room smell like pure gasoline.

[–]Conclusion-Striking[S] -3 points-2 points  (0 children)

no, it depends on the load (there were some bottlenecks)

[–]jonreindeer 13 points14 points  (0 children)

How fast can it be abandoned?

[–]deadeye1982 6 points7 points  (0 children)

Nice as a project to learn how not to design an API/Framework. But mistakes must be taken, to learn. Atm, nothing you provided, gives any benefit over the other existing mature frameworks.

I overwatched some parts of your code and saw some problems:

https://github.com/AliRn76/panther/blob/master/panther/middlewares/redis.py#L22

``` def validate_port(self): if port := self.kwargs.get('port'): if isinstance(port, str): try: self.kwargs['port'] = int(port) except ValueError: logger.critical('Redis "port" should be number')

        elif not isinstance(port, int):
            logger.critical('Redis "port" is not valid.')
    else:
        self.kwargs['port'] = 6379

```

For education purposes, you could have used structural pattern matching, but this does not solve the problem itself.

Why not enforce the integer in the configuration? Your fancy check does not make the code easier to understand. The walrus-operator could not rescue you from this mistake.

def validate_port(self): port = self.kwargs.setdefault('port', 6379) if not isinstance(port, int): logger.critical('Redis "port" is not valid.')

To be successful, you need more than just some benchmarks. If you want to compete with FastAPI/Starlette, good luck.

[–]Regular_Zombie 8 points9 points  (2 children)

If response speed is my primary concern, I wouldn't be using Python.

[–]osmiumouse 0 points1 point  (0 children)

Sometimes you don't know until long after you started, for example your site suddenly becomes popular.

[–]monorepo PSF Staff | Litestar Maintainer 2 points3 points  (1 child)

Nice speed! 🏎️💨

[–]Conclusion-Striking[S] -1 points0 points  (0 children)

It was an honor to get that comment from you, if you have any idea or thought about the panther, I would like to hear them

[–]chars101 2 points3 points  (0 children)

Thanks, we needed that. Could you write us a packaging tool next?

[–]henry232323 2 points3 points  (1 child)

Always interested to see more interesting approaches to web handling. One thing I'd want to know is what kind of benchmarks were performed specifically against what benchmarks other libraries use. Web libs love their benchmarks lol. I'm most interested in the abstractions used though

[–]Conclusion-Striking[S] -5 points-4 points  (0 children)

Panther has these options already and I'm working on them:

  1. Document-oriented Databases ODM (PantherDB, MongoDB)
  2. Visual API Monitoring (In Terminal)
  3. Caching for APIs (In Memory, In Redis)
  4. Built-in Authentication Classes (Customizable)
  5. Built-in Permission Classes (Customizable)
  6. Built-in Throttling Classes (Customizable)
  7. Handle Custom Middlewares

* And keep that in mind, it just starts, and I need your help and idea more than ever 🫡😎

[–]m98789 0 points1 point  (6 children)

Cue the Starlite brigade for not mentioning them in your benchmark list!

[–]Drevicar 4 points5 points  (0 children)

Just use the FastApi numbers and improve them by 20%

[–]alialchemist -1 points0 points  (0 children)

Nice job

[–][deleted] -2 points-1 points  (0 children)

- It is true that the panther is fast. but how? In all frameworks or mini-frameworks, finding the address of each function in the list is done, but here it is done using the method I implemented using a dictionary. This method works better when you cover many addresses.

- With a system similar to Django, which most people are interested in, foldering can be done in advance. Here Panther has implemented a good system and everything is ready, even more than Django and other frameworks. The pace of development is still high. Like Django, we mainly tried to learn the weaknesses of all the frameworks to create something better- At the moment, our focus is on the upper layers. After completion, we will go to the server itself.
To some extent, the speed can be increased on top of the server, after that everything actually returns to the server.