changeset 4081:84f6bee6440d

installation: moved from `setup.py` to `pyproject.toml`: - updated installation to use the now standard `pyproject.toml` instead of legacy `setup.py`. `setup.py` and other legacy files have been deleted. - removed outdated README4PACKAGERS - removed pylintrc which has not been correctly reviewed. Linter conf should go to `pyproject.toml` now. - [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. - update .hgignore - several dependencies version bump, with code update to adapt to changes.
author Goffi <goffi@goffi.org>
date Tue, 06 Jun 2023 16:45:16 +0200
parents 0ea6b34f8f18
children 72e91ea3bc16
files .hgignore INSTALL MANIFEST.in README4PACKAGERS dev-requirements.txt libervia/backend/core/launcher.py libervia/backend/tools/common/template.py pylintrc pyproject.toml requirements.txt setup.py twisted/plugins/libervia_backend_plugin.py twisted/plugins/sat_plugin.py
diffstat 13 files changed, 218 insertions(+), 995 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Tue Jun 06 13:42:00 2023 +0200
+++ b/.hgignore	Tue Jun 06 16:45:16 2023 +0200
@@ -1,25 +1,29 @@
 syntax: glob
+bridge_constructor/generated
+.build
+build
+ctags_links/
+dist/
+.eggs/
+env/
+libervia_backend.egg-info/
+MANIFEST
+.mypy_cache/
+*.orig
 *.pyc
+*.pyo
+.pytest_cache
 *.pyv
-*.swp
+Session.vim
+stubs/
 *.swo
+*.swp
 tags
-twistd.log
-twistd.pid
-bridge_constructor/generated
 tests/e2e/report*
 _trial_temp/
-sat.egg-info
+twistd.log
+twistd.pid
+twisted/plugins/dropin.cache
 *.un~
-dist
-MANIFEST
-build
-ctags_links/
-Session.vim
-.build
-.pytest_cache
-env/
-.eggs/
-libervia_backend.egg-info/
-.mypy_cache/
-twisted/plugins/dropin.cache
+.vim
+.vscode
--- a/INSTALL	Tue Jun 06 13:42:00 2023 +0200
+++ b/INSTALL	Tue Jun 06 16:45:16 2023 +0200
@@ -1,3 +1,3 @@
 You'll find install instructions in documentation (see doc/installation.rst).
 
-If you need help, come the SàT official XMPP room: sat@chat.jabberfr.org or join us with a web browser via https://chat.jabberfr.org/converse.js/sat@chat.jabberfr.org 
+If you need help, come the Libervia official XMPP room: xmpp:libervia@chat.jabberfr.org?join or join us with a web browser via https://chat.jabberfr.org/converse.js/libervia@chat.jabberfr.org 
--- a/MANIFEST.in	Tue Jun 06 13:42:00 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-include MANIFEST.in sat/VERSION
-global-include *.py
-global-include *.ini
-global-include *.po *.mo
-global-include CHANGELOG COPYING* INSTALL README*
-global-include *.sh
-global-include *.yml *.yaml
-global-include Makefile *.rst *.bat
-graft misc
-graft doc
-include sat_frontends/jp/jp sat_frontends/primitivus/primitivus
-include sat/bridge/bridge_constructor
-global-exclude *.un~
-prune sat/bridge/bridge_constructor/generated
--- a/README4PACKAGERS	Tue Jun 06 13:42:00 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-First of all, thank you for packaging SàT :)
-
-
-############
-Dependencies
-############
-
-SàT requires Python 2.7.
-You will find below the list of Python modules the backend and the frontends depend on, as well as additional information.
-
-------------------------------
-Dependencies for SàT's backend
-------------------------------
-
-dbus
-lxml >= 3.1.0
-Mutagen
-pillow
-PyCrypto >= 2.6.1
-PyOpenSSL
-python-dbus
-Python OTR
-Twisted Core
-Twisted Mail
-Twisted Web
-Twisted Words
-Wokkel >= 0.7.1
-XDG
-zope.interface
-
-Recommended: Mutagen, markdown, html2text, netifaces, miniupnp, service-identity
-
---------------------------------
-Dependencies for the Jp frontend
---------------------------------
-
-PyGI (PyGObject 3)
-
-Recommended: progressbar, inotify, lxml
-
-----------------------------------------
-Dependencies for the Primitivus frontend
-----------------------------------------
-
-Urwid >= 1.2.0
-Urwid-satext >= 0.6.1
-GObject 2 (not imported directly in Primitivus, but needed for Urwid's main loop)
-DBus
-
-Suggested: Python X Library (for user notifications in a graphical session)
-
---------------------------------------
-Dependencies for the Libervia frontend
---------------------------------------
-
-Jinja2 (for static blogs only)
-pyjamas (for building only)
-txJSON-RPC
-
-Recommended: pyOpenSSL
-
-
-##################
-Satellite projects
-##################
-
-Several project have been made around SàT, they are all available at http://repos.goffi.org:
-
-	- Libervia: the both Ajax and static web frontend.
-
-	- SàT PubSub: a PubSub service which manage experimental features like fine permission tuning.
-
-	- SàT media: Media needed by the frontends.
-
-	- Urwid SàText: Widgets for urwid library, designed for SàT but can be useful for other projects. Mandatory for Primitivus.
-
-The following ones are not needed in a distribution, because they are in a too early stage of development, or not useful for general purpose:
-
-	- Bellaciao: a Qt frontend, at an early stage of development.
-
-	- Salut: an XMPP directory, at a very early stage of development.
-
-	- SàT Website: the code of the website.
-
-
-########
-Licences
-########
-
-We are careful about the licences we use. Our projects are licenced as follow:
-
-	- Libervia, SàT PubSub, Bellaciao, Salut, SàT Website: AGPL v3+
-
-	- Urwid SàText: LGPL v3+
-
-When an external code is included (portion or library), we indicate the source and the licence, and we are careful to take Libre licences only. If we made a mistake somewhere, please let us know.
-
-The case of SàT Media is particular are there is a compilation of media from severals sources. SàT Logo was made by Adrien Vigneron and is under CC By-SA. Other works are all under Free licences, licences are specified in the base directory of each package.
-
-
-#####################
-Packages and versions
-#####################
-
-We have packaged Primitivus and Jp with the core backend, as we think theses frontends should be shipped with each SàT distribution.
-
-Libervia is distributed as a separate package because of its specificities (it's a huge project by itself, it uses Pyjamas Python => JS Compiler, etc.). But it's part of the same project.
-
-All the official frontends have the same version number, which is the version of the backend they use.
-
-
-#######
-Updates
-#######
-
-There is a SQLite database per user (default in ~/local/share/sat/.sat.db); it is updated automatically if there is a schema change.
-
-
-##############
-Contrat social
-##############
-
-The social contract is an important part of the project, please don't forget to distribute it along with SàT.
-
-
-#############
-Miscellaneous
-#############
-
-There is a completion file for Zsh which detects the parameters of Jp. It's available in the misc/ directory (.jp) and must be available in a path included in user's fpath.
-
-The translations are global to all the frontends (no translations available in Libervia yet). There are not up-to-date since 0.4 version.
-
-The .service file in misc repository is used for auto-launch feature of D-Bus (launching a frontend will automatically launch the backend if it's not already present), setup.py adapt the path once installed. If you put it yourself, be sure that the "Exec=" line link to the sat.sh script.
-This file should be in .services dir, usually /usr/share/dbus-1/services/
-
-
-Thank you again for you help; don't forget to give us your name and contact email so we can credit you, and don't hesitate to contact us if you have any question (on the sat XMPP room at sat@chat.jabberfr.org, or check README for individual contacts).
--- a/dev-requirements.txt	Tue Jun 06 13:42:00 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
--r requirements.txt
-
-lxml-stubs
-
-mypy
-pylint
-pytest
-pytest_twisted
-
-sh
-libervia-templates @ hg+https://repos.goffi.org/sat_templates
-libervia-web @ hg+https://repos.goffi.org/libervia-web
--- a/libervia/backend/core/launcher.py	Tue Jun 06 13:42:00 2023 +0200
+++ b/libervia/backend/core/launcher.py	Tue Jun 06 16:45:16 2023 +0200
@@ -31,8 +31,8 @@
 class LiberviaLogger(app.AppLogger):
 
     def start(self, application):
-        # logging is initialised by sat.core.log_config via the Twisted plugin, nothing
-        # to do here
+        # logging is initialised by libervia.baceknd.core.log_config via the Twisted
+        # plugin, nothing to do here
         self._initialLog()
 
     def stop(self):
--- a/libervia/backend/tools/common/template.py	Tue Jun 06 13:42:00 2023 +0200
+++ b/libervia/backend/tools/common/template.py	Tue Jun 06 16:45:16 2023 +0200
@@ -61,11 +61,11 @@
     )
 
 from lxml import etree
-from jinja2 import Markup as safe
+from markupsafe import Markup as safe
 from jinja2 import is_undefined
 from jinja2 import utils
 from jinja2 import TemplateNotFound
-from jinja2 import contextfilter
+from jinja2 import pass_context
 from jinja2.loaders import split_template_path
 
 HTML_EXT = ("html", "xhtml")
@@ -736,7 +736,7 @@
 
     ## custom filters ##
 
-    @contextfilter
+    @pass_context
     def _front_url(self, ctx, relative_url):
         """Get front URL (URL seen by end-user) from a relative URL
 
@@ -752,13 +752,13 @@
         return os.path.join(site_root_dir, C.TEMPLATE_TPL_DIR, template_data.theme,
                             relative_url)
 
-    @contextfilter
+    @pass_context
     def _next_gidx(self, ctx, value):
         """Use next current global index as suffix"""
         next_ = ctx["gidx"].next(value)
         return value if next_ == 0 else "{}_{}".format(value, next_)
 
-    @contextfilter
+    @pass_context
     def _cur_gidx(self, ctx, value):
         """Use current current global index as suffix"""
         current = ctx["gidx"].current(value)
@@ -821,7 +821,7 @@
                 continue
         return " ".join(classes) or None
 
-    @contextfilter
+    @pass_context
     def _item_filter(self, ctx, item, filters):
         """return item's value, filtered if suitable
 
@@ -847,7 +847,7 @@
                 kwargs = filters_args[idx] if filters_args is not None else {}
                 filter_func = self.env.filters[f_name]
                 try:
-                    eval_context_filter = filter_func.evalcontextfilter
+                    eval_context_filter = filter_func.evalpass_context
                 except AttributeError:
                     eval_context_filter = False
 
--- a/pylintrc	Tue Jun 06 13:42:00 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,499 +0,0 @@
-[MASTER]
-
-# A comma-separated list of package or module names from where C extensions may
-# be loaded. Extensions are loading into the active Python interpreter and may
-# run arbitrary code.
-extension-pkg-allow-list=lxml.etree
-
-# Add files or directories to the blacklist. They should be base names, not
-# paths.
-ignore=CVS
-
-# Add files or directories matching the regex patterns to the blacklist. The
-# regex matches against base names, not paths.
-ignore-patterns=
-
-# Python code to execute, usually for sys.path manipulation such as
-# pygtk.require().
-#init-hook=
-
-# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
-# number of processors available to use.
-jobs=1
-
-# Control the amount of potential inferred values when inferring a single
-# object. This can help the performance when dealing with large functions or
-# complex, nested conditions.
-limit-inference-results=100
-
-# List of plugins (as comma separated values of python module names) to load,
-# usually to register additional checkers.
-load-plugins=
-
-# Pickle collected data for later comparisons.
-persistent=yes
-
-# Specify a configuration file.
-#rcfile=
-
-# When enabled, pylint would attempt to guess common misconfiguration and emit
-# user-friendly hints instead of false-positive error messages.
-suggestion-mode=yes
-
-# Allow loading of arbitrary C extensions. Extensions are imported into the
-# active Python interpreter and may run arbitrary code.
-unsafe-load-any-extension=no
-
-
-[MESSAGES CONTROL]
-
-# Only show warnings with the listed confidence levels. Leave empty to show
-# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
-confidence=
-
-# Disable the message, report, category or checker with the given id(s). You
-# can either give multiple identifiers separated by comma (,) or put this
-# option multiple times (only on the command line, not in the configuration
-# file where it should appear only once). You can also use "--disable=all" to
-# disable everything first and then reenable specific checks. For example, if
-# you want to run only the similarities checker, you can use "--disable=all
-# --enable=similarities". If you want to run only the classes checker, but have
-# no Warning level messages displayed, use "--disable=all --enable=classes
-# --disable=W".
-disable=missing-module-docstring,
-        duplicate-code,
-        fixme,
-        logging-fstring-interpolation,
-        broad-except
-
-# Enable the message, report, category or checker with the given id(s). You can
-# either give multiple identifier separated by comma (,) or put this option
-# multiple time (only on the command line, not in the configuration file where
-# it should appear only once). See also the "--disable" option for examples.
-enable=useless-suppression
-
-
-[REPORTS]
-
-# Python expression which should return a score less than or equal to 10. You
-# have access to the variables 'error', 'warning', 'refactor', and 'convention'
-# which contain the number of messages in each category, as well as 'statement'
-# which is the total number of statements analyzed. This score is used by the
-# global evaluation report (RP0004).
-evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
-
-# Template used to display messages. This is a python new-style format string
-# used to format the message information. See doc for all details.
-#msg-template=
-
-# Set the output format. Available formats are text, parseable, colorized, json
-# and msvs (visual studio). You can also give a reporter class, e.g.
-# mypackage.mymodule.MyReporterClass.
-output-format=text
-
-# Tells whether to display a full report or only the messages.
-reports=no
-
-# Activate the evaluation score.
-score=yes
-
-
-[REFACTORING]
-
-# Maximum number of nested blocks for function / method body
-max-nested-blocks=5
-
-# Complete name of functions that never returns. When checking for
-# inconsistent-return-statements if a never returning function is called then
-# it will be considered as an explicit return statement and no message will be
-# printed.
-never-returning-functions=sys.exit
-
-
-[SPELLING]
-
-# Limits count of emitted suggestions for spelling mistakes.
-max-spelling-suggestions=4
-
-# Spelling dictionary name. Available dictionaries: none. To make it work,
-# install the python-enchant package.
-spelling-dict=
-
-# List of comma separated words that should not be checked.
-spelling-ignore-words=
-
-# A path to a file that contains the private dictionary; one word per line.
-spelling-private-dict-file=
-
-# Tells whether to store unknown words to the private dictionary (see the
-# --spelling-private-dict-file option) instead of raising a message.
-spelling-store-unknown-words=no
-
-
-[VARIABLES]
-
-# List of additional names supposed to be defined in builtins. Remember that
-# you should avoid defining new builtins when possible.
-additional-builtins=
-
-# Tells whether unused global variables should be treated as a violation.
-allow-global-unused-variables=no
-
-# List of strings which can identify a callback function by name. A callback
-# name must start or end with one of those strings.
-callbacks=cb_,
-          _cb
-
-# A regular expression matching the name of dummy variables (i.e. expected to
-# not be used).
-dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
-
-# Argument names that match this expression will be ignored. Default to name
-# with leading underscore.
-ignored-argument-names=_.*|^ignored_|^unused_
-
-# Tells whether we should check for unused import in __init__ files.
-init-import=no
-
-# List of qualified module names which can have objects that can redefine
-# builtins.
-redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
-
-
-[LOGGING]
-
-# Format style used to check logging format string. `old` means using %
-# formatting, `new` is for `{}` formatting,and `fstr` is for f-strings.
-logging-format-style=old
-
-# Logging modules to check that the string format arguments are in logging
-# function parameter format.
-logging-modules=logging
-
-
-[FORMAT]
-
-# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
-expected-line-ending-format=
-
-# Regexp for a line that is allowed to be longer than the limit.
-ignore-long-lines=^\s*(# )?<?https?://\S+>?$
-
-# Number of spaces of indent required inside a hanging or continued line.
-indent-after-paren=4
-
-# String used as indentation unit. This is usually "    " (4 spaces) or "\t" (1
-# tab).
-indent-string='    '
-
-# Maximum number of characters on a single line.
-max-line-length=90
-
-# Maximum number of lines in a module.
-max-module-lines=10000
-
-# Allow the body of a class to be on the same line as the declaration if body
-# contains single statement.
-single-line-class-stmt=no
-
-# Allow the body of an if to be on the same line as the test if there is no
-# else.
-single-line-if-stmt=yes
-
-
-[TYPECHECK]
-
-# List of decorators that produce context managers, such as
-# contextlib.contextmanager. Add to this list to register other decorators that
-# produce valid context managers.
-contextmanager-decorators=contextlib.contextmanager
-
-# List of members which are set dynamically and missed by pylint inference
-# system, and so shouldn't trigger E1101 when accessed. Python regular
-# expressions are accepted.
-generated-members=
-
-# Tells whether missing members accessed in mixin class should be ignored. A
-# mixin class is detected if its name ends with "mixin" (case insensitive).
-ignore-mixin-members=yes
-
-# Tells whether to warn about missing members when the owner of the attribute
-# is inferred to be None.
-ignore-none=no
-
-# This flag controls whether pylint should warn about no-member and similar
-# checks whenever an opaque object is returned when inferring. The inference
-# can return multiple potential results while evaluating a Python object, but
-# some branches might not be evaluated, which results in partial inference. In
-# that case, it might be useful to still emit no-member and other checks for
-# the rest of the inferred objects.
-ignore-on-opaque-inference=no
-
-# List of class names for which member attributes should not be checked (useful
-# for classes with dynamically set attributes). This supports the use of
-# qualified names.
-ignored-classes=optparse.Values,thread._local,_thread._local
-
-# List of module names for which member attributes should not be checked
-# (useful for modules/projects where namespaces are manipulated during runtime
-# and thus existing member attributes cannot be deduced by static analysis). It
-# supports qualified module names, as well as Unix pattern matching.
-ignored-modules=
-
-# Show a hint with possible names when a member name was not found. The aspect
-# of finding the hint is based on edit distance.
-missing-member-hint=yes
-
-# The minimum edit distance a name should have in order to be considered a
-# similar match for a missing member name.
-missing-member-hint-distance=1
-
-# The total number of similar names that should be taken in consideration when
-# showing a hint for a missing member.
-missing-member-max-choices=1
-
-# List of decorators that change the signature of a decorated function.
-signature-mutators=
-
-
-[STRING]
-
-# This flag controls whether the implicit-str-concat-in-sequence should
-# generate a warning on implicit string concatenation in sequences defined over
-# several lines.
-check-str-concat-over-line-jumps=no
-
-
-[SIMILARITIES]
-
-# Ignore comments when computing similarities.
-ignore-comments=yes
-
-# Ignore docstrings when computing similarities.
-ignore-docstrings=yes
-
-# Ignore imports when computing similarities.
-ignore-imports=no
-
-# Minimum lines number of a similarity.
-min-similarity-lines=4
-
-
-[BASIC]
-
-# Naming style matching correct argument names.
-argument-naming-style=snake_case
-
-# Regular expression matching correct argument names. Overrides argument-
-# naming-style.
-#argument-rgx=
-
-# Naming style matching correct attribute names.
-attr-naming-style=snake_case
-
-# Regular expression matching correct attribute names. Overrides attr-naming-
-# style.
-#attr-rgx=
-
-# Bad variable names which should always be refused, separated by a comma.
-bad-names=foo,
-          bar,
-          baz,
-          toto,
-          tutu,
-          tata
-
-# Naming style matching correct class attribute names.
-class-attribute-naming-style=UPPER_CASE
-
-# Regular expression matching correct class attribute names. Overrides class-
-# attribute-naming-style.
-#class-attribute-rgx=
-
-# Naming style matching correct class names.
-class-naming-style=PascalCase
-
-# Regular expression matching correct class names. Overrides class-naming-
-# style.
-#class-rgx=
-
-# Naming style matching correct constant names.
-const-naming-style=any
-
-# Regular expression matching correct constant names. Overrides const-naming-
-# style.
-#const-rgx=
-
-# Minimum line length for functions/classes that require docstrings, shorter
-# ones are exempt.
-docstring-min-length=-1
-
-# Naming style matching correct function names.
-function-naming-style=snake_case
-
-# Regular expression matching correct function names. Overrides function-
-# naming-style.
-#function-rgx=
-
-# Good variable names which should always be accepted, separated by a comma.
-good-names=i,
-           j,
-           e, # exceptions in except blocks
-           _
-
-# Include a hint for the correct naming format with invalid-name.
-include-naming-hint=no
-
-# Naming style matching correct inline iteration names.
-inlinevar-naming-style=any
-
-# Regular expression matching correct inline iteration names. Overrides
-# inlinevar-naming-style.
-#inlinevar-rgx=
-
-# Naming style matching correct method names.
-method-naming-style=snake_case
-
-# Regular expression matching correct method names. Overrides method-naming-
-# style.
-#method-rgx=
-
-# Naming style matching correct module names.
-module-naming-style=snake_case
-
-# Regular expression matching correct module names. Overrides module-naming-
-# style.
-#module-rgx=
-
-# Colon-delimited sets of names that determine each other's naming style when
-# the name regexes allow several styles.
-name-group=
-
-# Regular expression which should only match function or class names that do
-# not require a docstring.
-no-docstring-rgx=^_
-
-# List of decorators that produce properties, such as abc.abstractproperty. Add
-# to this list to register other decorators that produce valid properties.
-# These decorators are taken in consideration only for invalid-name.
-property-classes=abc.abstractproperty
-
-# Naming style matching correct variable names.
-variable-naming-style=snake_case
-
-# Regular expression matching correct variable names. Overrides variable-
-# naming-style.
-#variable-rgx=
-
-
-[MISCELLANEOUS]
-
-# List of note tags to take in consideration, separated by a comma.
-notes=FIXME,
-      XXX,
-      TODO
-
-
-[IMPORTS]
-
-# List of modules that can be imported at any level, not just the top level
-# one.
-allow-any-import-level=
-
-# Allow wildcard imports from modules that define __all__.
-allow-wildcard-with-all=no
-
-# Analyse import fallback blocks. This can be used to support both Python 2 and
-# 3 compatible code, which means that the block might have code that exists
-# only in one or another interpreter, leading to false positives when analysed.
-analyse-fallback-blocks=yes
-
-# Deprecated modules which should not be used, separated by a comma.
-deprecated-modules=optparse,tkinter.tix
-
-# Create a graph of external dependencies in the given file (report RP0402 must
-# not be disabled).
-ext-import-graph=
-
-# Create a graph of every (i.e. internal and external) dependencies in the
-# given file (report RP0402 must not be disabled).
-import-graph=
-
-# Create a graph of internal dependencies in the given file (report RP0402 must
-# not be disabled).
-int-import-graph=
-
-# Force import order to recognize a module as part of the standard
-# compatibility libraries.
-known-standard-library=
-
-# Force import order to recognize a module as part of a third party library.
-known-third-party=enchant
-
-# Couples of modules and preferred modules, separated by a comma.
-preferred-modules=
-
-
-[CLASSES]
-
-# List of method names used to declare (i.e. assign) instance attributes.
-defining-attr-methods=__init__,
-                      __new__,
-                      setUp,
-                      __post_init__,
-                      create
-
-# List of member names, which should be excluded from the protected access
-# warning.
-exclude-protected=_asdict,
-                  _fields,
-                  _replace,
-                  _source,
-                  _make
-
-# List of valid names for the first argument in a class method.
-valid-classmethod-first-arg=cls
-
-# List of valid names for the first argument in a metaclass class method.
-valid-metaclass-classmethod-first-arg=cls
-
-
-[DESIGN]
-
-# Maximum number of arguments for function / method.
-max-args=100
-
-# Maximum number of attributes for a class (see R0902).
-max-attributes=100
-
-# Maximum number of boolean expressions in an if statement (see R0916).
-max-bool-expr=10
-
-# Maximum number of branch for function / method body.
-max-branches=100
-
-# Maximum number of locals for function / method body.
-max-locals=100
-
-# Maximum number of parents for a class (see R0901).
-max-parents=10
-
-# Maximum number of public methods for a class (see R0904).
-max-public-methods=100
-
-# Maximum number of return / yield for function / method body.
-max-returns=100
-
-# Maximum number of statements in function / method body.
-max-statements=1000
-
-# Minimum number of public methods for a class (see R0903).
-min-public-methods=0
-
-
-[EXCEPTIONS]
-
-# Exceptions that will emit a warning when being caught. Defaults to
-# "BaseException, Exception".
-overgeneral-exceptions=BaseException,
-                       Exception
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pyproject.toml	Tue Jun 06 16:45:16 2023 +0200
@@ -0,0 +1,111 @@
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[project]
+name = "libervia-backend"
+dynamic = ["version"]
+description = "Libervia: A feature-rich XMPP client showcasing diverse frontends, uniting instant messaging, blogging, file sharing, and ActivityPub-XMPP interactions seamlessly."
+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 :: Console",
+    "Framework :: Twisted",
+    "Operating System :: POSIX :: Linux",
+    "Topic :: Communications :: Chat",
+    "Topic :: Internet :: XMPP"
+]
+dependencies = [
+    "aiosqlite",
+    "alembic",
+    "babel < 3",
+    "cryptography >= 41.0.1",
+    "dbus-python < 1.3",
+    "html2text < 2020.2",
+    "jinja2 >= 3.1.2",
+    "langid < 2",
+    "lxml >= 3.1.0",
+    "markdown >= 3.0",
+    "miniupnpc < 2.1",
+    "mutagen < 2",
+    "netifaces < 0.12",
+    "oldmemo >= 1.0.0, < 2",
+    "omemo >= 1.0.0, < 2",
+    "pillow >= 6.0.0",
+    "progressbar2 < 3.54",
+    "pygments < 3",
+    "pygobject < 3.40.1",
+    "pyopenssl >= 23.2.0",
+    "python-dateutil >= 2.8.1, < 3",
+    # currently disabled due to incompatibility, OTR feature may be removed in
+    # the close future
+    # "python-potr < 1.1",
+    "pyxdg < 0.30",
+    "pyyaml < 7.0.0",
+    "sat_tmp @ hg+https://repos.goffi.org/sat_tmp#egg=sat_tmp",
+    "setuptools_scm",
+    "shortuuid ~= 1.0.11",
+    "sqlalchemy >= 1.4",
+    "treq < 23.0.0",
+    "twisted[tls] >= 22.10",
+    "twomemo >= 1.0.0, < 2",
+    "txdbus",
+    "urwid >= 1.2.0, < 3",
+    "urwid-satext @ hg+https://repos.goffi.org/urwid-satext#egg=urwid-satext",
+    "wokkel >= 18.0.0, < 19.0.0",
+    "xmlschema",
+]
+keywords = [
+    "XMPP",
+    "chat",
+    "instant_messaging",
+    "blogging",
+    "photo albums",
+    "ActivityPub",
+    "file sharing",
+    "events"
+]
+
+[project.optional-dependencies]
+SVG = [
+    "CairoSVG",
+]
+
+[project.scripts]
+jp = "libervia.cli.base:LiberviaCli.run"
+li = "libervia.cli.base:LiberviaCli.run"
+libervia-backend = "libervia.backend.core.launcher:Launcher.run"
+libervia-cli = "libervia.cli.base:LiberviaCli.run"
+libervia-tui = "libervia.tui.base:LiberviaTUIApp.run"
+primitivus = "libervia.tui.base:LiberviaTUIApp.run"
+sat = "libervia.backend.core.launcher:Launcher.run"
+
+[project.urls]
+Homepage = "https://libervia.org"
+Documentation = "https://libervia.org/documentation"
+Repository = "https://repos.goffi.org/libervia-backend/"
+Roadmap = "https://libervia.org/roadmap"
+
+[tool.hatch.envs.default]
+# we need system-package for GPG
+system-packages = true
+
+[tool.hatch.version]
+path = "libervia/backend/__init__.py"
+
+[tool.hatch.build.targets.wheel.shared-data]
+"i18n/fr/LC_MESSAGES/libervia_backend.mo" = "share/locale/fr/LC_MESSAGES/libervia_backend.mo"
+CHANGELOG = "share/doc/libervia-backend/CHANGELOG"
+COPYING = "share/doc/libervia-backend/COPYING"
+INSTALL = "share/doc/libervia-backend/INSTALL"
+README = "share/doc/libervia-backend/README"
+README4TRANSLATORS = "share/doc/libervia-backend/README4TRANSLATORS"
+"misc/org.libervia.Libervia.service" = "share/dbus-1/services/org.libervia.Libervia.service"
+
+[tool.hatch.metadata]
+allow-direct-references = true
--- a/requirements.txt	Tue Jun 06 13:42:00 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-aiosqlite==0.17.0
-alembic==1.7.7
-attrs==21.4.0
-Automat==20.2.0
-Babel==2.10.1
-cairocffi==1.3.0
-CairoSVG==2.5.2
-certifi==2021.10.8
-cffi==1.15.0
-charset-normalizer==2.0.12
-constantly==15.1.0
-cryptography==3.4.8
-cssselect2==0.6.0
-dbus-python==1.2.18
-defusedxml==0.7.1
-DoubleRatchet @ git+https://github.com/Syndace/python-doubleratchet.git@stable
-greenlet==1.1.2
-html2text==2020.1.16
-hyperlink==21.0.0
-idna==3.3
-incremental==21.3.0
-Jinja2==3.0.3
-langid==1.1.6
-lxml==4.8.0
-Mako==1.2.0
-Markdown==3.3.7
-MarkupSafe==2.1.1
-miniupnpc==2.0.2
-mutagen==1.45.1
-netifaces==0.11.0
-numpy==1.22.3
-Oldmemo @ git+https://github.com/Syndace/python-oldmemo.git
-OMEMO @ git+https://github.com/Syndace/python-omemo.git@stable
-packaging==21.3
-Pillow==9.1.0
-progressbar2==3.53.3
-protobuf==3.20.1
-pyasn1==0.4.8
-pyasn1-modules==0.2.8
-pycairo==1.21.0
-pycparser==2.21
-pycrypto==2.6.1
-Pygments==2.12.0
-PyGObject==3.40.0
-PyNaCl==1.5.0
-pyOpenSSL==20.0.1
-pyparsing==3.0.9
-python-dateutil==2.8.2
-python-potr==1.0.2
-python-utils==3.2.2
-pytz==2022.1
-pyxdg==0.27
-PyYAML==5.4.1
-requests==2.27.1
-service-identity==21.1.0
-setuptools-scm==6.4.2
-shortuuid==1.0.9
-six==1.16.0
-SQLAlchemy==1.4.36
-tinycss2==1.1.1
-tomli==2.0.1
-treq==21.5.0
-Twisted==21.2.0
-Twomemo @ git+https://github.com/Syndace/python-twomemo.git
-txdbus==1.1.2
-typing_extensions==4.3.0
-urllib3==1.26.9
-urwid==2.1.2
-webencodings==0.5.1
-wokkel==18.0.0
-X3DH @ git+https://github.com/Syndace/python-x3dh.git@stable
-XEdDSA @ git+https://github.com/Syndace/python-xeddsa.git@stable
-xmlschema==2.0.4
-zope.interface==5.4.0
-
-sat-tmp @ hg+https://repos.goffi.org/sat_tmp
-urwid-satext @ hg+https://repos.goffi.org/urwid-satext
--e .[SVG]
--- a/setup.py	Tue Jun 06 13:42:00 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-#!/usr/bin/env python3
-
-# Libervia: an XMPP client
-# Copyright (C) 2009-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, find_packages
-import os
-
-NAME = "libervia-backend"
-# NOTE: directory is still "sat" for compatibility reason, should be changed for 0.9
-DIR_NAME = "libervia/backend"
-
-install_requires = [
-    'babel < 3',
-    'dbus-python < 1.3',
-    'html2text < 2020.2',
-    'jinja2>=2.10.3',
-    'langid < 2',
-    'lxml >= 3.1.0',
-    'markdown >= 3.0',
-    'miniupnpc < 2.1',
-    'mutagen < 2',
-    'netifaces < 0.12',
-    'pillow >= 6.0.0',
-    'progressbar2 < 3.54',
-    'cryptography < 3.5',
-    'pygments < 3',
-    'pygobject < 3.40.1',
-    'pyopenssl < 21.0.0',
-    'python-dateutil >= 2.8.1, < 3',
-    'python-potr < 1.1',
-    'pyxdg < 0.30',
-    # during dev we get sat_tmp and urwid-satext directly from the repository
-    # 'sat_tmp == 0.9.*',
-    'sat_tmp @ hg+https://repos.goffi.org/sat_tmp#egg=sat_tmp',
-    # 'urwid-satext == 0.9.*',
-    'urwid-satext @ hg+https://repos.goffi.org/urwid-satext#egg=urwid-satext',
-    'shortuuid < 1.1',
-    'twisted[tls] >= 20.3.0, < 21.3.0',
-    'treq < 23.0.0',
-    'urwid >= 1.2.0, < 3',
-    'wokkel >= 18.0.0, < 19.0.0',
-    'omemo >= 1.0.0, < 2',
-    'twomemo >= 1.0.0, < 2',
-    'oldmemo >= 1.0.0, < 2',
-    'pyyaml < 7.0.0',
-    'sqlalchemy >= 1.4',
-    'alembic',
-    'aiosqlite',
-    'txdbus',
-    'xmlschema',
-]
-
-extras_require = {
-    "SVG": ["CairoSVG"],
-}
-
-DBUS_DIR = 'dbus-1/services'
-DBUS_FILE = 'misc/org.libervia.Libervia.service'
-with open(os.path.join(DIR_NAME, 'VERSION')) as f:
-    VERSION = f.read().strip()
-is_dev_version = VERSION.endswith('.dev0')
-if is_dev_version:
-    install_requires.append("setuptools_scm")
-
-
-def sat_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="Libervia multipurpose and multi frontend XMPP client",
-    long_description="Libervia is a XMPP client based on a daemon/frontend "
-                     "architecture. It's multi frontend (desktop, web, console "
-                     "interface, CLI, etc) and multipurpose (instant messaging, "
-                     "microblogging, games, file sharing, etc).",
-    author="Libervia dev team",
-    author_email="contact@goffi.org",
-    url="https://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 :: Console",
-        "Framework :: Twisted",
-        "License :: OSI Approved :: GNU Affero General Public License v3 "
-        "or later (AGPLv3+)",
-        "Operating System :: POSIX :: Linux",
-        "Topic :: Communications :: Chat"
-    ],
-    packages=find_packages() + ["twisted.plugins"],
-    data_files=[("share/locale/fr/LC_MESSAGES",
-                 ["i18n/fr/LC_MESSAGES/libervia_backend.mo"]),
-                (os.path.join("share/doc", NAME),
-                 ["CHANGELOG", "COPYING", "INSTALL", "README", "README4TRANSLATORS"]),
-                (os.path.join("share", DBUS_DIR), [DBUS_FILE]),
-                ],
-    entry_points={
-        "console_scripts": [
-            # backend + alias
-            "libervia-backend = libervia.backend.core.launcher:Launcher.run",
-            "sat = libervia.backend.core.launcher:Launcher.run",
-
-            # CLI + aliases
-            "libervia-cli = libervia.cli.base:LiberviaCli.run",
-            "li = libervia.cli.base:LiberviaCli.run",
-            "jp = libervia.cli.base:LiberviaCli.run",
-
-            # TUI + alias
-            "libervia-tui = libervia.tui.base:LiberviaTUIApp.run",
-            "primitivus = libervia.tui.base:LiberviaTUIApp.run",
-            ],
-        },
-    zip_safe=False,
-    setup_requires=["setuptools_scm"] if is_dev_version else [],
-    use_scm_version=sat_dev_version if is_dev_version else False,
-    install_requires=install_requires,
-    extras_require=extras_require,
-    package_data={"libervia.backend": ["VERSION", "memory/migration/alembic.ini"]},
-    python_requires=">=3.7",
-)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/twisted/plugins/libervia_backend_plugin.py	Tue Jun 06 16:45:16 2023 +0200
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+
+# Libervia: an XMPP client
+# Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.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 zope.interface import implementer
+from twisted.python import usage
+from twisted.plugin import IPlugin
+from twisted.application.service import IServiceMaker
+
+# XXX: We need to configure logs before any log method is used, so here is the best place.
+from libervia.backend.core.constants import Const as C
+from libervia.backend.core.i18n import _
+
+from sat_tmp.wokkel import install as install_wokkel_patches
+
+
+install_wokkel_patches()
+
+
+def initialise(options):
+    """Method to initialise global modules"""
+    # XXX: We need to configure logs before any log method is used, so here is the best place.
+    from libervia.backend.core import log_config
+    log_config.libervia_configure(C.LOG_BACKEND_TWISTED, C, backend_data=options)
+
+
+class Options(usage.Options):
+    optParameters = []
+
+
+@implementer(IPlugin, IServiceMaker)
+class LiberviaMaker:
+
+    tapname = C.APP_NAME_FILE
+    description = _("%s XMPP client backend") % C.APP_NAME_FULL
+    options = Options
+
+    def set_debugger(self):
+        from twisted.internet import defer
+        if defer.Deferred.debug:
+            # if we are in debug mode, we want to use ipdb instead of pdb
+            try:
+                import ipdb
+                import pdb
+                pdb.set_trace = ipdb.set_trace
+                pdb.post_mortem = ipdb.post_mortem
+            except ImportError:
+                pass
+
+    def makeService(self, options):
+        from twisted.internet import asyncioreactor
+        asyncioreactor.install()
+        self.set_debugger()
+        # XXX: Libervia must be imported after log configuration,
+        #      because it write stuff to logs
+        initialise(options.parent)
+        from libervia.backend.core.main import LiberviaBackend
+        return LiberviaBackend()
+
+
+serviceMaker = LiberviaMaker()
--- a/twisted/plugins/sat_plugin.py	Tue Jun 06 13:42:00 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-#!/usr/bin/env python3
-
-# Libervia: an XMPP client
-# Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.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 zope.interface import implementer
-from twisted.python import usage
-from twisted.plugin import IPlugin
-from twisted.application.service import IServiceMaker
-
-# XXX: We need to configure logs before any log method is used, so here is the best place.
-from libervia.backend.core.constants import Const as C
-from libervia.backend.core.i18n import _
-
-from sat_tmp.wokkel import install as install_wokkel_patches
-
-
-install_wokkel_patches()
-
-
-def initialise(options):
-    """Method to initialise global modules"""
-    # XXX: We need to configure logs before any log method is used, so here is the best place.
-    from libervia.backend.core import log_config
-    log_config.libervia_configure(C.LOG_BACKEND_TWISTED, C, backend_data=options)
-
-
-class Options(usage.Options):
-    optParameters = []
-
-
-@implementer(IPlugin, IServiceMaker)
-class SatMaker:
-
-    tapname = C.APP_NAME_FILE
-    description = _("%s XMPP client backend") % C.APP_NAME_FULL
-    options = Options
-
-    def set_debugger(self):
-        from twisted.internet import defer
-        if defer.Deferred.debug:
-            # if we are in debug mode, we want to use ipdb instead of pdb
-            try:
-                import ipdb
-                import pdb
-                pdb.set_trace = ipdb.set_trace
-                pdb.post_mortem = ipdb.post_mortem
-            except ImportError:
-                pass
-
-    def makeService(self, options):
-        from twisted.internet import asyncioreactor
-        asyncioreactor.install()
-        self.set_debugger()
-        # XXX: Libervia must be imported after log configuration,
-        #      because it write stuff to logs
-        initialise(options.parent)
-        from libervia.backend.core.main import LiberviaBackend
-        return LiberviaBackend()
-
-
-serviceMaker = SatMaker()