changeset 1522:a44f77559279

installation: moved from `setup.py` to `pyproject.toml`: - following backend change, installation is now using `pyproject.toml`, and legacy `setup.py` as well as other legacy files have been deleted/updated. - [hatch](https://hatch.pypa.io) is now used as main building tool. However, thanks to the use of standards, other tools can be used too. - `VERSION` file has been deleted, in favor or using directly `__version__`, in `libervia/web/__init__.py`. Version can be updated directly from Hatch - update .hgignore - several dependencies version bump, with code update to adapt to changes.
author Goffi <goffi@goffi.org>
date Wed, 07 Jun 2023 15:28:10 +0200
parents 0d517b596568
children 81216e9476ca
files .hgignore libervia/web/VERSION libervia/web/__init__.py libervia/web/server/server.py pyproject.toml setup.py twisted/plugins/libervia_server.py
diffstat 7 files changed, 95 insertions(+), 123 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed Jun 07 09:35:36 2023 +0200
+++ b/.hgignore	Wed Jun 07 15:28:10 2023 +0200
@@ -1,18 +1,27 @@
 syntax: glob
+.build
+build
+ctags_links/
+dist/
+.eggs/
+env/
+MANIFEST
+.mypy_cache/
+*.orig
 *.pyc
+*.pyo
+.pytest_cache
 *.pyv
+Session.vim
+stubs/
+*.swo
 *.swp
-*.swo
-*.js
 tags
+tests/e2e/report*
+_trial_temp/
 twistd.log
 twistd.pid
-sat.egg-info
+twisted/plugins/dropin.cache
 *.un~
-dist
-MANIFEST
-*.sh
-build/
-Session.vim
-ctags_links/
-html/
+.vim
+.vscode
--- a/libervia/web/VERSION	Wed Jun 07 09:35:36 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0.9.0.dev0
--- a/libervia/web/__init__.py	Wed Jun 07 09:35:36 2023 +0200
+++ b/libervia/web/__init__.py	Wed Jun 07 15:28:10 2023 +0200
@@ -1,5 +1,1 @@
-import os.path
-
-version_file = os.path.join(os.path.dirname(__file__), "VERSION")
-with open(version_file) as f:
-    __version__ = f.read().strip()
+__version__ = "0.9.0.dev0"
--- a/libervia/web/server/server.py	Wed Jun 07 09:35:36 2023 +0200
+++ b/libervia/web/server/server.py	Wed Jun 07 15:28:10 2023 +0200
@@ -295,7 +295,7 @@
     def _namespaces_get_eb(self, failure_):
         log.error(_("Can't get namespaces map: {msg}").format(msg=failure_))
 
-    @template.contextfilter
+    @template.pass_context
     def _front_url_filter(self, ctx, relative_url):
         template_data = ctx['template_data']
         return os.path.join(
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pyproject.toml	Wed Jun 07 15:28:10 2023 +0200
@@ -0,0 +1,67 @@
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[project]
+name = "libervia-web"
+dynamic = ["version"]
+description = "Web frontend for Libervia, a feature-rich XMPP client"
+readme = "README.md"
+license = "AGPL-3.0-or-later"
+requires-python = ">=3.7"
+authors = [
+    { name = "Libervia Dev Team", email = "contact@goffi.org" },
+]
+classifiers = [
+    "Development Status :: 5 - Production/Stable",
+    "Environment :: Web Environment",
+    "Framework :: Twisted",
+    "Operating System :: POSIX :: Linux",
+    "Topic :: Communications :: Chat",
+]
+dependencies = [
+    "autobahn >= 23.6.1",
+    "brython >= 3.10",
+    "jinja2 >= 3.1.2",
+    # use during dev mode to have current version of backend
+    "libervia-backend @ {root:uri}/../libervia-backend",
+    "libervia-templates @ {root:uri}/../libervia-backend",
+    "pyopenssl >= 23.2.0",
+    "shortuuid ~= 1.0.11",
+    "twisted[tls] >= 22.10",
+    "zope.interface >= 5",
+]
+keywords = [
+    "XMPP",
+    "web",
+    "brython",
+    "chat",
+    "instant_messaging",
+    "blogging",
+    "photo albums",
+    "file sharing",
+    "events"
+]
+
+[project.scripts]
+libervia-web = "libervia.web.server.launcher:Launcher.run"
+
+[project.urls]
+Homepage = "https://www.libervia.org"
+
+[tool.hatch.build.targets.wheel]
+packages = ["libervia"]
+
+[tool.hatch.envs.default]
+# we need system-package for GPG
+system-packages = true
+
+[tool.hatch.metadata]
+allow-direct-references = true
+
+[tool.hatch.version]
+path = "libervia/web/__init__.py"
+
+[tool.hatch.build.targets.wheel.shared-data]
+COPYING = "share/doc/libervia-web/COPYING"
+"README.md" = "share/doc/libervia-web/README.md"
--- a/setup.py	Wed Jun 07 09:35:36 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-#!/usr/bin/env python3
-
-# Libervia Web Frontend
-# Copyright (C) 2011-2021  Jérôme Poisson (goffi@goffi.org)
-# Copyright (C) 2013-2016 Adrien Cossa (souliane@mailoo.org)
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program 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 Affero General Public License for more details.
-
-# You should have received a copy of the GNU Affero General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from setuptools import setup
-import os
-
-NAME = "libervia-web"
-DIR_NAME = "libervia/web"
-
-install_requires = [
-    "libervia-backend == 0.9.*",
-    "libervia-templates >0.8.0b1",
-    'twisted[tls] >=20.3.0',
-    "zope.interface <5.5.0",
-    'pyopenssl <21.0.0',
-    "jinja2 >=2.9, <3.1",
-    'shortuuid <1.1',
-    "autobahn <21.4.0",
-    "brython >=3.9.2, <3.10",
-]
-long_description = """\
-Web frontend for Libervia (formerly Salut à Toi), a multi-frontends and multi-purposes XMPP client.
-It features chat, blog, forums, events, tickets, merge requests, file sharing, photo albums, etc.
-It is also a decentralized, XMPP based web framework.
-"""
-
-with open(os.path.join(DIR_NAME, "VERSION")) as v:
-    VERSION = v.read().strip()
-is_dev_version = VERSION.endswith(".dev0")
-
-
-def libervia_dev_version():
-    """Use mercurial data to compute version"""
-
-    def version_scheme(version):
-        return VERSION
-
-    def local_scheme(version):
-        return "+{rev}.{distance}".format(rev=version.node[1:], distance=version.distance)
-
-    return {"version_scheme": version_scheme, "local_scheme": local_scheme}
-
-
-setup(
-    name=NAME,
-    version=VERSION,
-    description="Web frontend for Libervia",
-    long_description=long_description,
-    author="Libervia Dev Team",
-    author_email="contact@goffi.org",
-    url="https://www.libervia.org",
-    classifiers=[
-        "Programming Language :: Python :: 3 :: Only",
-        "Programming Language :: Python :: 3.7",
-        "Programming Language :: Python :: 3.8",
-        "Programming Language :: Python :: 3.9",
-        "Development Status :: 5 - Production/Stable",
-        "Environment :: Web Environment",
-        "Framework :: Twisted",
-        "License :: OSI Approved :: GNU Affero General Public License v3 "
-        "or later (AGPLv3+)",
-        "Operating System :: POSIX :: Linux",
-        "Topic :: Communications :: Chat",
-    ],
-    packages=["libervia.web", "libervia.web.common", "libervia.web.server", "twisted.plugins"],
-    include_package_data=True,
-    data_files=[(os.path.join("share", "doc", NAME), ["COPYING", "README", "INSTALL"])]
-    + [
-        (os.path.join("share", NAME, root), [os.path.join(root, f) for f in files])
-        for root, dirs, files in os.walk("themes")
-    ],
-    entry_points={
-        "console_scripts": [
-            "libervia-web = libervia.web.server.launcher:Launcher.run",
-            ],
-        },
-    zip_safe=False,
-    setup_requires=["setuptools_scm"] if is_dev_version else [],
-    use_scm_version=libervia_dev_version if is_dev_version else False,
-    install_requires=install_requires,
-    package_data={"libervia.web": ["VERSION"]},
-    python_requires=">=3.7",
-)
--- a/twisted/plugins/libervia_server.py	Wed Jun 07 09:35:36 2023 +0200
+++ b/twisted/plugins/libervia_server.py	Wed Jun 07 15:28:10 2023 +0200
@@ -55,18 +55,18 @@
     import sys
 
     sys.stderr.write(
-        """libervia.backend module version ({sat_version}) and {current_app} version ({current_version}) mismatch
+        """libervia.backend module version ({libervia_backend_version}) and {current_app} version ({current_version}) mismatch
 
-libervia.backend module is located at {sat_path}
-libervia module is located at {libervia_path}
+libervia.backend module is located at {libervia_backend_path}
+libervia module is located at {libervia_web_path}
 
 Please be sure to have the same version running
 """.format(
-            sat_version=libervia.backend.__version__,
+            libervia_backend_version=libervia.backend.__version__,
             current_app=C.APP_NAME,
             current_version=libervia.web.__version__,
-            sat_path=os.path.dirname(libervia.backend.__file__),
-            libervia_path=os.path.dirname(libervia.web.__file__),
+            libervia_backend_path=os.path.dirname(libervia.backend.__file__),
+            libervia_web_path=os.path.dirname(libervia.web.__file__),
         )
     )
     sys.stderr.flush()
@@ -160,7 +160,7 @@
     #      so here is the best place.
     from libervia.backend.core import log_config
 
-    log_config.sat_configure(C.LOG_BACKEND_TWISTED, C, backend_data=options)
+    log_config.libervia_configure(C.LOG_BACKEND_TWISTED, C, backend_data=options)
 
 
 class Options(usage.Options):