From 34005443dc1693f7f846c85f8f2bc01ed184e87d Mon Sep 17 00:00:00 2001 From: vitaliypopel Date: Fri, 20 Sep 2024 13:51:47 +0300 Subject: [PATCH 1/2] Added support for Python >= 3.8 and Django >= 4.0 --- .github/workflows/beta.yml | 8 ++++---- pyproject.toml | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 2f00ccb..a8052bd 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -1,4 +1,4 @@ -name: Django-Routify Beta v0.2.1 +name: Django-Routify Beta v0.2.2 on: release: @@ -16,9 +16,9 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] - name: Install dependencies run: | @@ -36,7 +36,7 @@ jobs: password: ${{ secrets.PYPI_API_TOKEN }} - name: Upload build artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: dist-files path: dist/* diff --git a/pyproject.toml b/pyproject.toml index 6b88175..563b5e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,11 +5,11 @@ build-backend = "setuptools.build_meta" [project] name = "django-routify" -version = "0.2.1" +version = "0.2.2" description = "Django-Routify is a package for simple routing Views in the classic Django framework." readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.8" license = {file = "LICENSE"} @@ -39,6 +39,8 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -46,7 +48,7 @@ classifiers = [ ] dependencies = [ - "django>5.0" + "django>4.0" ] [project.urls] From 0d5fd0ae155d0201962101a61a08ed521dd91e65 Mon Sep 17 00:00:00 2001 From: vitaliypopel Date: Fri, 20 Sep 2024 14:21:26 +0300 Subject: [PATCH 2/2] Made string representation of Router --- src/django_routify/_abstraction.py | 16 ++++++++++++++++ src/django_routify/router.py | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/django_routify/_abstraction.py b/src/django_routify/_abstraction.py index 10ed44b..7474f39 100644 --- a/src/django_routify/_abstraction.py +++ b/src/django_routify/_abstraction.py @@ -111,3 +111,19 @@ def route(self, url_path: str, name: str = None): :return: Any ''' ... + + @abstractmethod + def __str__(self) -> str: + ''' + Router string representation + :return: str + ''' + ... + + @abstractmethod + def __repr__(self) -> str: + ''' + Router string representation + :return: str + ''' + ... diff --git a/src/django_routify/router.py b/src/django_routify/router.py index 3647d61..ee04214 100644 --- a/src/django_routify/router.py +++ b/src/django_routify/router.py @@ -94,3 +94,13 @@ def register(view: FUNC_VIEW | View) -> FUNC_VIEW | View: return view return register + + def __str__(self) -> str: + return f'Router(\n' \ + f'\tapp_name:\t"{self.__app_name}"\n' \ + f'\turl_prefix:\t"{self.__prefix}"\n' \ + f'\turls:\t\t{self.__urls}\n' \ + f')' + + def __repr__(self) -> str: + return str(self)