Skip to main content

EchoNext is a lightweight, fast and scalable web framework for Python

Project description

🌟 EchoNext: The Future of Web 🚀

EchoNext is a lightweight, fast and scalable web framework for Python
Explore the docs »

Comparison with Alternatives . Why Choose pyEchoNext · Key Features · Getting Started · Basic Usage · Specification · Documentation · License


EchoNext is a lightweight, fast and scalable web framework for Python

Welcome to EchoNext, where innovation meets simplicity! Are you tired of the sluggishness of traditional web frameworks? Want a solution that keeps pace with your ambitious apps? Look no further. EchoNext is your agile companion in the world of web development!

Imagine a lightweight framework that empowers you to create modern web applications with lightning speed and flexibility. With EchoNext, you're not just coding; you're building a masterpiece!

Last stable version: 0.5.7 alpha

Check Other My Projects

  • SQLSymphony - simple and fast ORM in sqlite (and you can add other DBMS)
  • Burn-Build - simple and fast build system written in python for C/C++ and other projects. With multiprocessing, project creation and caches!
  • OptiArch - shell script for fast optimization of Arch Linux
  • libnumerixpp - a Powerful C++ Library for High-Performance Numerical Computing
  • pycolor-palette - display beautiful log messages, logging, debugging.
  • shegang - powerful command interpreter (shell) for linux written in C

🤔 Why Choose SqlSymphony?

  • 🔥 Featherweight Performance: No bloat, just speed! Our framework is designed to optimize performance, making it a breeze to create and scale your applications without the overhead.

  • 💼 Unmatched Scalability: Handle thousands of connections effortlessly! Echonext is built for performance in high-demand environments, making it the perfect choice for startups or enterprise applications.

  • 🔧 Customizable Architecture: Tailor your framework to suit your unique needs. Whether it’s middleware, routing, or authentication, make it yours with minimal effort!

  • 🌍 Cross-Platform Compatibility: Echonext works beautifully on any OS. Whether you’re developing on Windows, macOS, or Linux, you’re covered!

  • 💡 User-Friendly Design: Our intuitive API and comprehensive documentation make it easy for beginners and pros alike. Dive in and start coding right away!

  • 📦 Plug-and-Play Components: Easily integrate with third-party libraries to enhance your application. Don’t reinvent the wheel—leverage existing solutions!

  • 🔒 Built-in Authentication: Simplify your user authentication process with our built-in, easy-to-implement features.

  • 📊 Automatic API Documentation: Create RESTful endpoints that are not just powerful but also well-documented, saving you time and effort.

(back to top)

🌟 Comparison with Alternatives

Feature pyEchoNext Flask FastAPI Django Starlette
Asynchronous Capabilities COMING SOON ✔️ ✔️
Performance 🔥 High 🐢 Moderate 🚀 Very High 🐢 Moderate 🚀 Very High
Framework Weight ✔️ ✔️ ✔️ ❌ Heavy ✔️
Ecosystem 🛠️ Modular 🎨 Flexible 🎨 Modular ⚙️ Monolithic ⚙️ Modular
Ease of Use ✔️ ✔️ ✔️ ✔️
Configurability ✔️ ✔️ ✔️ ✔️ ✔️
Documentation Quality 📚 Excellent 📚 Good 📚 Excellent 📚 Very Good 📚 Good
Flexible Deployments 🌍 Flexible 🌍 Standard 🌍 Standard 🌍 Standard 🌍 Flexible
Testing Support ✔️ ✔️ ✔️ ✔️ ✔️
Community Size 📢 Growing 📢 Large 📢 Growing 📢 Large 📢 Emerging
Built-in Template Engine ✔️ Jinja2 & builtin ✔️ Jinja2 ✔️ Jinja2 ✔️ Django ✔️ Jinja2
Task Queue Integration ✔️ Celery ✔️ Celery ✔️ Celery ✔️ Celery
Static File Serving 🌍 Manual 🌍 Manual 🚀 Built-in 🚀 Built-in 🚀 Built-in
Analytics Integration ✔️ Easy 🛠️ Manual ✔️ Easy ✔️ Easy

📈 Note: Echonext excels in performance while staying lightweight, making it a top-notch choice for your next project!

📚 Key Features

  • Intuitive API: Pythonic, object-oriented interface for interacting with routes and views.
  • Performance Optimization: Lazy loading, eager loading, and other techniques for efficient web queries.
  • Comprehensive Documentation: Detailed usage examples and API reference to help you get started.
  • Modular Design: Clean, maintainable codebase that follows best software engineering practices.
  • Extensive Test Coverage: Robust test suite to ensure the library's reliability and stability.

(back to top)

⚙️ Functionality

  • i18n localization
  • basic project documentation generator
  • request/response
  • middlewares (with basic session cookie middleware)
  • views and routes
  • settings and config loader
  • built-in template engine and Jinja2

(back to top)

🚀 Getting Started

pyEchoNext is available on PyPI. Simply install the package into your project environment with PIP:

pip install pyechonext

Once installed, you can start using the library in your Python projects. Check out the documentation for detailed usage examples and API reference.

You can create example app architecture:

python3 -m pyechonext --name exampleapp

# Generated arhitecture:
exampleapp/
├── exampleapp.py
├── templates
└── views
    ├── __init__.py
    └── main.py

(back to top)

💻 Usage Examples

Localization i18n & OpenAPI specification generation & Settings loader from python module

import os
from pyechonext.utils.exceptions import MethodNotAllow
from pyechonext.app import ApplicationType, EchoNext
from pyechonext.views import View
from pyechonext.urls import URL, IndexView
from pyechonext.config import SettingsLoader, SettingsConfigType
from pyechonext.response import Response
from pyechonext.template_engine.jinja import render_template
from pyechonext.middleware import middlewares
from pyechonext.docsgen import ProjDocumentation
from pyechonext.apidoc_ui import APIDocumentation


class UsersView(View):
    def get(self, request, response, **kwargs):
        return render_template(
            request,
            "index.html",
            user_name="User",
            session_id=request.session_id,
            friends=["Bob", "Anna", "John"],
        )

    def post(self, request, response, **kwargs):
        raise MethodNotAllow(f"Request {request.path}: method not allow")


url_patterns = [URL(url="/", view=IndexView), URL(url="/users", view=UsersView)]

config_loader = SettingsLoader(SettingsConfigType.PYMODULE, 'el_config.py')
settings = config_loader.get_settings()
echonext = EchoNext(
    __name__,
    settings,
    middlewares,
    urls=url_patterns,
    application_type=ApplicationType.HTML,
)
apidoc = APIDocumentation(echonext)
projdoc = ProjDocumentation(echonext)


@echonext.route_page('/api-docs')
def api_docs(request, response):
    return Response(request, content_type='application/json', body=apidoc.generate_spec())


@echonext.route_page("/book")
@projdoc.documentate_route('/book', str, {}, ['GET', 'POST'])
class BooksResource(View):
    """
    This class describes a books resource.
    """

    def get(self, request, response, **kwargs):
        """
        get queries

        :param      request:   The request
        :type       request:   Request
        :param      response:  The response
        :type       response:  Response
        :param      kwargs:    The keywords arguments
        :type       kwargs:    dictionary

        :returns:   result
        :rtype:     str
        """
        return Response(request, body="title %{name}", use_i18n=True, name='Localization Site')

    def post(self, request, response, **kwargs):
        """
        post queries

        :param      request:   The request
        :type       request:   Request
        :param      response:  The response
        :type       response:  Response
        :param      kwargs:    The keywords arguments
        :type       kwargs:    dictionary

        :returns:   result
        :rtype:     str
        """
        return echonext.locale_loader.get_string('title %{name}', name='Localization Site')


projdoc.generate_documentation()

el_config.py:

import os

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
TEMPLATES_DIR = 'templates'
SECRET_KEY = 'secret-key'
LOCALE = 'RU_RU'
LOCALE_DIR = 'locales'
VERSION = "0.1.0"
DESCRIPTION = 'Example echonext webapp'

Advanced app with flask-like and django-like routes

Django-line classes with get-post methods and routing pages. And with the built-in template engine!

import os
from pyechonext.app import ApplicationType, EchoNext
from pyechonext.views import View
from pyechonext.urls import URL, IndexView
from pyechonext.config import Settings
from pyechonext.template_engine.builtin import render_template # built-in (alpha)
# OR
from pyechonext.template_engine.jinja import render_template


class UsersView(View):
    def get(self, request, response, **kwargs):
        return render_template(
            request, "index.html", user_name="User", friends=["Bob", "Anna", "John"]
        )

    def post(self, request, response, **kwargs):
        return Response(body='post users')


url_patterns = [URL(url="/", view=IndexView), URL(url="/users", view=UsersView)]
settings = Settings(
    BASE_DIR=os.path.dirname(os.path.abspath(__file__)), TEMPLATES_DIR="templates"
)
echonext = EchoNext(
    __name__, settings, urls=url_patterns, application_type=ApplicationType.HTML
)


@echonext.route_page("/book")
class BooksResource(View):
    def get(self, request, response, **kwargs):
        return f"GET Params: {request.GET}"

    def post(self, request, response, **kwargs):
        return f"POST Params: {request.POST}"

(back to top)

Simple app with database

In this example we are using SQLSymphony ORM (our other project, a fast and simple ORM for python)

import os
from pyechonext.app import ApplicationType, EchoNext
from pyechonext.config import Settings
from sqlsymphony_orm.datatypes.fields import IntegerField, RealField, TextField
from sqlsymphony_orm.models.session_models import SessionModel
from sqlsymphony_orm.models.session_models import SQLiteSession


settings = Settings(
    BASE_DIR=os.path.dirname(os.path.abspath(__file__)), TEMPLATES_DIR="templates"
)
echonext = EchoNext(__name__, settings, application_type=ApplicationType.HTML)
session = SQLiteSession("echonext.db")


class User(SessionModel):
    __tablename__ = "Users"

    id = IntegerField(primary_key=True)
    name = TextField(null=False)
    cash = RealField(null=False, default=0.0)

    def __repr__(self):
        return f"<User {self.pk}>"


@echonext.route_page("/")
def home(request, response):
    user = User(name="John", cash=100.0)
    session.add(user)
    session.commit()
    return "Hello from the HOME page"


@echonext.route_page("/users")
def about(request, response):
    users = session.get_all_by_model(User)

    return f"Users: {[f'{user.name}: {user.cash}$' for user in users]}"

(back to top)

🔧 Specifications

Security

A security module created for hash functions and crypto-algorithms.

Crypts

Simple crypto-algorithms.

PSPCAlgorithm

Point Simple Password Crypt Algorithm.

Base: AngryPassword
Crypted: 00778.87999.74379.363401.558001.558001.96058.06107.711601.87999.13309.07469.50075
Decrypted: AngryPassword

Base: S0mesd7623tds@&6^@_
Crypted: 51338.82165.83428.85374.62333.82165.558001.00778.237101.72744.05834.85374.53284.00778.558001.77588.39559.69024.19727
Decrypted: S0mesd7623tds@&6^@_

Base: PassWord
Crypted: 00778.87999.74379.99267.558001.558001.96058.06107
Decrypted: PassWord

Base: Pass
Crypted: 558001.558001.96058.06107
Decrypted: Pass

Example:

from pyechonext.security.crypts import PSPCAlgorithm


pspc = PSPCAlgorithm()

passwords = ['AngryPassword', 'S0mesd7623tds@&6^@_', 'PassWord', 'Pass']

for password in passwords:
    print('Base:', password)
    print('Crypted:', pspc.crypt(password))
    print('Decrypted:', pspc.decrypt(pspc.crypt(password)))
    print()

Hashing

  • Module: pyechonext.security.hashing
HashAlgorithm

Enum class with available hashing algorithms

class HashAlgorithm(Enum):
    """
    This class describes a hash algorithms.
    """

    SHA256 = auto()
    SHA512 = auto()
    MD5 = auto()
    BLAKE2B = auto()
    BLAKE2S = auto()
PlainHasher

A simple class for hashing text. Has no 'salting'.

hasher = PlainHasher(HashAlgorithm.BLAKE2S)
old_hash = hasher.hash("TEXT")
new_hash = hasher.hash("TEXT")

if hasher.verify("TEXT", new_hash): # true
    print('Yes!')

if hasher.verify("TEXT2", old_hash): # false
    print('Yes!')

# Output: one "Yes!"
SaltedHasher

A simple class for hashing text. Has hash salt.

hasher = SaltedHasher(HashAlgorithm.BLAKE2S, salt='bob')
old_hash = hasher.hash("TEXT")
new_hash = hasher.hash("TEXT")

if hasher.verify("TEXT", new_hash): # true
    print('Yes!')

if hasher.verify("TEXT2", old_hash): # false
    print('Yes!')

# Output: one "Yes!"

View

View is an abstract class, with abstract get and post methods (all descendants must create these methods).

class View(ABC):
    """
    Page view
    """

    @abstractmethod
    def get(self, request: Request, response: Response, *args, **kwargs):
        """
        Get

        :param      request:   The request
        :type       request:   Request
        :param      response:  The response
        :type       response:  Response
        :param      args:      The arguments
        :type       args:      list
        :param      kwargs:    The keywords arguments
        :type       kwargs:    dictionary
        """
        raise NotImplementedError

    @abstractmethod
    def post(self, request: Request, response: Response, *args, **kwargs):
        """
        Post

        :param      request:   The request
        :type       request:   Request
        :param      response:  The response
        :type       response:  Response
        :param      args:      The arguments
        :type       args:      list
        :param      kwargs:    The keywords arguments
        :type       kwargs:    dictionary
        """
        raise NotImplementedError

Example of view:

class IndexView(View):
    def get(self, request: Request, response: Response, **kwargs):
        """
        Get

        :param      request:   The request
        :type       request:   Request
        :param      response:  The response
        :type       response:  Response
        :param      args:      The arguments
        :type       args:      list
        :param      kwargs:    The keywords arguments
        :type       kwargs:    dictionary
        """
        return "Hello World!"

    def post(self, request: Request, response: Response, **kwargs):
        """
        Post

        :param      request:   The request
        :type       request:   Request
        :param      response:  The response
        :type       response:  Response
        :param      args:      The arguments
        :type       args:      list
        :param      kwargs:    The keywords arguments
        :type       kwargs:    dictionary
        """
        return "Message has accepted!"

Or you can return response:

class IndexView(View):
    def get(self, request: Request, response: Response, **kwargs):
        """
        Get

        :param      request:   The request
        :type       request:   Request
        :param      response:  The response
        :type       response:  Response
        :param      args:      The arguments
        :type       args:      list
        :param      kwargs:    The keywords arguments
        :type       kwargs:    dictionary
        """
        return Response(request, body="Hello World!")

    def post(self, request: Request, response: Response, **kwargs):
        """
        Post

        :param      request:   The request
        :type       request:   Request
        :param      response:  The response
        :type       response:  Response
        :param      args:      The arguments
        :type       args:      list
        :param      kwargs:    The keywords arguments
        :type       kwargs:    dictionary
        """
        return Response(request, body="Message has accepted!")

💬 Support

If you encounter any issues or have questions about pyEchoNext, please:

(back to top)

🤝 Contributing

We welcome contributions from the community! If you'd like to help improve pyEchoNext, please check out the contributing guidelines to get started.

(back to top)

👥 Join the Community!

If you find Echonext valuable and want to support the project:

  • Star on GitHub ⭐
  • Share it with friends and colleagues!
  • Donate via cryptocurrency 🙌

Connect with fellow Echonext users: Join our Telegram Chat

🔮 Roadmap

Our future goals for pyEchoNext include:

  • 📚 Improve middlewares
  • 🚀 Add async support
  • ✅ Improve logging
  • 🌍 Add auth
  • 🌐 More stability and scalablity

(back to top)

🌟 Get Started Today!

Unlock your potential as a developer with Echonext. Don’t just build applications—craft experiences that resonate with your users! The possibilities are limitless when you harness the power of Echonext.

Happy Coding! 💻✨

This README is designed to grab attention from the very first lines. It emphasizes the framework's strengths and makes a compelling case for why developers should choose Echonext for their projects. Feel free to adjust any specific links or images to fit your project!

Documentation 🌍

Extended documentation and framework specifications are available at the following links:

English

  1. Index
  2. Web framework design
  3. Creating a web application
  4. Creating routes (routes&views)
  5. Request/Response
  6. Localization i18n/l10n

Russian / Русский

  1. Содержание
  2. Устройство веб-фреймворка
  3. Создание веб-приложения
  4. Создание маршрутов (routes&views)
  5. Request/Response
  6. Локализация i18n/l10n

License

Distributed under the GNU LGPL 2.1 License. See LICENSE for more information.

(back to top)


EchoNext is a lightweight, fast and scalable web framework for Python Copyright (C) 2024 Alexeev Bronislav (C) 2024

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyechonext-0.5.7.tar.gz (43.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyechonext-0.5.7-py3-none-any.whl (47.1 kB view details)

Uploaded Python 3

File details

Details for the file pyechonext-0.5.7.tar.gz.

File metadata

  • Download URL: pyechonext-0.5.7.tar.gz
  • Upload date:
  • Size: 43.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/6.11.5-2-cachyos

File hashes

Hashes for pyechonext-0.5.7.tar.gz
Algorithm Hash digest
SHA256 ede0e558b17f8b059a5e1c52708ef9c2c4842ce75a0a354ab12abe09ce7b7682
MD5 02400f3c4b80940290d84e5deeb2a771
BLAKE2b-256 8f36d15cb98a97fbcee8837b33a1f138fc6fab046df8e8d24cee4889a2763c06

See more details on using hashes here.

File details

Details for the file pyechonext-0.5.7-py3-none-any.whl.

File metadata

  • Download URL: pyechonext-0.5.7-py3-none-any.whl
  • Upload date:
  • Size: 47.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/6.11.5-2-cachyos

File hashes

Hashes for pyechonext-0.5.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7cc0e7c182eb08bb01faa38691c8361e94cdaf4187077b1f0a61f99778ccdca7
MD5 698f854e83c4183752b51d9a3a9868b1
BLAKE2b-256 4b271054fd9d1f4fd6551b273a105cdf50b689112f9650b1d19ebcece5cf2c9a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page