Matridge 0.3.2__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. {matridge-0.3.2 → matridge-0.4.0}/.copier-answers.yml +1 -1
  2. {matridge-0.3.2 → matridge-0.4.0}/.pre-commit-config.yaml +3 -3
  3. matridge-0.4.0/.woodpecker/audit-dependencies.yaml +11 -0
  4. {matridge-0.3.2 → matridge-0.4.0}/.woodpecker/container.yaml +5 -1
  5. {matridge-0.3.2 → matridge-0.4.0}/CONTRIBUTING.md +1 -1
  6. {matridge-0.3.2 → matridge-0.4.0}/Dockerfile +21 -15
  7. {matridge-0.3.2/matridge.egg-info → matridge-0.4.0}/PKG-INFO +6 -5
  8. {matridge-0.3.2 → matridge-0.4.0}/README.md +4 -3
  9. matridge-0.4.0/docs/source/admin/config.rst +117 -0
  10. {matridge-0.3.2 → matridge-0.4.0}/docs/source/admin/install.rst +6 -1
  11. {matridge-0.3.2 → matridge-0.4.0}/docs/source/admin/privileges.rst +3 -0
  12. {matridge-0.3.2 → matridge-0.4.0}/docs/source/index.rst +1 -1
  13. {matridge-0.3.2 → matridge-0.4.0}/matridge/__init__.py +1 -1
  14. matridge-0.4.0/matridge/command.py +724 -0
  15. {matridge-0.3.2 → matridge-0.4.0}/matridge/contact.py +13 -10
  16. {matridge-0.3.2 → matridge-0.4.0}/matridge/gateway.py +17 -11
  17. matridge-0.4.0/matridge/group.py +497 -0
  18. {matridge-0.3.2 → matridge-0.4.0}/matridge/matrix.py +124 -62
  19. {matridge-0.3.2 → matridge-0.4.0}/matridge/reactions.py +8 -7
  20. matridge-0.4.0/matridge/session.py +85 -0
  21. {matridge-0.3.2 → matridge-0.4.0}/matridge/util.py +60 -37
  22. {matridge-0.3.2 → matridge-0.4.0/matridge.egg-info}/PKG-INFO +6 -5
  23. {matridge-0.3.2 → matridge-0.4.0}/matridge.egg-info/SOURCES.txt +3 -0
  24. {matridge-0.3.2 → matridge-0.4.0}/matridge.egg-info/requires.txt +1 -1
  25. matridge-0.4.0/matridge.egg-info/scm_file_list.json +57 -0
  26. matridge-0.4.0/matridge.egg-info/scm_version.json +8 -0
  27. {matridge-0.3.2 → matridge-0.4.0}/pyproject.toml +7 -3
  28. matridge-0.4.0/uv.lock +2570 -0
  29. matridge-0.3.2/docs/source/admin/config.rst +0 -75
  30. matridge-0.3.2/matridge/command.py +0 -182
  31. matridge-0.3.2/matridge/group.py +0 -157
  32. matridge-0.3.2/matridge/session.py +0 -316
  33. matridge-0.3.2/uv.lock +0 -2405
  34. {matridge-0.3.2 → matridge-0.4.0}/.gitignore +0 -0
  35. {matridge-0.3.2 → matridge-0.4.0}/.woodpecker/docs.yaml +0 -0
  36. {matridge-0.3.2 → matridge-0.4.0}/.woodpecker/package.yaml +0 -0
  37. {matridge-0.3.2 → matridge-0.4.0}/.woodpecker/test.yaml +0 -0
  38. {matridge-0.3.2 → matridge-0.4.0}/LICENSE +0 -0
  39. {matridge-0.3.2 → matridge-0.4.0}/assets/matrix_outline.png +0 -0
  40. {matridge-0.3.2 → matridge-0.4.0}/assets/matrix_outline.svg +0 -0
  41. {matridge-0.3.2 → matridge-0.4.0}/commitlint.config.js +0 -0
  42. {matridge-0.3.2 → matridge-0.4.0}/doap.xml +0 -0
  43. {matridge-0.3.2 → matridge-0.4.0}/docker-compose.yml +0 -0
  44. {matridge-0.3.2 → matridge-0.4.0}/docs/Makefile +0 -0
  45. {matridge-0.3.2 → matridge-0.4.0}/docs/source/admin/attachments.rst +0 -0
  46. {matridge-0.3.2 → matridge-0.4.0}/docs/source/admin/examples/ejabberd.yaml +0 -0
  47. {matridge-0.3.2 → matridge-0.4.0}/docs/source/admin/examples/index.rst +0 -0
  48. {matridge-0.3.2 → matridge-0.4.0}/docs/source/admin/examples/prosody-noupload.cfg.lua +0 -0
  49. {matridge-0.3.2 → matridge-0.4.0}/docs/source/admin/examples/prosody-upload.cfg.lua +0 -0
  50. {matridge-0.3.2 → matridge-0.4.0}/docs/source/admin/index.rst +0 -0
  51. {matridge-0.3.2 → matridge-0.4.0}/docs/source/admin/install-custom.rst +0 -0
  52. {matridge-0.3.2 → matridge-0.4.0}/docs/source/admin/quickstart.rst +0 -0
  53. {matridge-0.3.2 → matridge-0.4.0}/docs/source/codeberg.svg +0 -0
  54. {matridge-0.3.2 → matridge-0.4.0}/docs/source/conf.py +0 -0
  55. {matridge-0.3.2 → matridge-0.4.0}/docs/source/contributing.rst +0 -0
  56. {matridge-0.3.2 → matridge-0.4.0}/docs/source/user/features.rst +0 -0
  57. {matridge-0.3.2 → matridge-0.4.0}/docs/source/user/index.rst +0 -0
  58. {matridge-0.3.2 → matridge-0.4.0}/docs/source/user/registration.rst +0 -0
  59. {matridge-0.3.2 → matridge-0.4.0}/docs/source/user/usage.rst +0 -0
  60. {matridge-0.3.2 → matridge-0.4.0}/matridge/__main__.py +0 -0
  61. {matridge-0.3.2 → matridge-0.4.0}/matridge/config.py +0 -0
  62. {matridge-0.3.2 → matridge-0.4.0}/matridge.egg-info/dependency_links.txt +0 -0
  63. {matridge-0.3.2 → matridge-0.4.0}/matridge.egg-info/entry_points.txt +0 -0
  64. {matridge-0.3.2 → matridge-0.4.0}/matridge.egg-info/top_level.txt +0 -0
  65. {matridge-0.3.2 → matridge-0.4.0}/setup.cfg +0 -0
  66. {matridge-0.3.2 → matridge-0.4.0}/tests/test_base.py +0 -0
  67. {matridge-0.3.2 → matridge-0.4.0}/tests/test_conversion.py +0 -0
  68. {matridge-0.3.2 → matridge-0.4.0}/tests/test_reactions.py +0 -0
@@ -1,7 +1,7 @@
1
1
  # Do not edit manually!
2
2
  # Changes here will be overwritten by copier.
3
3
  # https://copier.readthedocs.io/
4
- _commit: 8876a2e
4
+ _commit: 9d0b96b
5
5
  _src_path: git+https://codeberg.org/slidge/legacy-module-template
6
6
  debian_bundle: true
7
7
  native_build: false
@@ -36,13 +36,13 @@ repos:
36
36
  hooks:
37
37
  - id: mypy
38
38
  name: Static type check with mypy
39
- entry: .venv/bin/mypy
39
+ entry: mypy
40
40
  language: system
41
41
  pass_filenames: false
42
- files: .*\.py
42
+ types_or: [python, pyi]
43
43
  - id: pytest-check
44
44
  name: pytest-check
45
- entry: .venv/bin/pytest tests
45
+ entry: pytest tests
46
46
  language: system
47
47
  pass_filenames: false
48
48
  always_run: true
@@ -0,0 +1,11 @@
1
+ when:
2
+ event: [push, pull_request]
3
+
4
+ labels:
5
+ platform: linux/amd64
6
+
7
+ steps:
8
+ audit:
9
+ image: ghcr.io/astral-sh/uv:python3.14-alpine
10
+ commands:
11
+ - uv audit
@@ -40,6 +40,7 @@ when:
40
40
  cron: container-main
41
41
  - event: cron
42
42
  cron: container-latest
43
+ - event: manual
43
44
 
44
45
  steps:
45
46
  build-tag:
@@ -60,6 +61,7 @@ steps:
60
61
  path: *paths
61
62
  - event: cron
62
63
  cron: container-main
64
+ - event: manual
63
65
  image: woodpeckerci/plugin-docker-buildx:6.0.2
64
66
  settings:
65
67
  <<: *settings
@@ -70,8 +72,10 @@ steps:
70
72
 
71
73
  build-ci:
72
74
  when:
75
+ - event: push
73
76
  path: *paths
74
77
  branch: ${CI_REPO_DEFAULT_BRANCH}
78
+ - event: manual
75
79
  image: woodpeckerci/plugin-docker-buildx:6.0.2
76
80
  settings:
77
81
  <<: *settings
@@ -91,7 +95,7 @@ steps:
91
95
  - export TAG=$(git describe --tags --abbrev=0)
92
96
  - git checkout $TAG
93
97
  - git reset --hard
94
- - echo latest > .tags
98
+ - echo -n latest > .tags
95
99
 
96
100
  rebuild-tag:
97
101
  image: woodpeckerci/plugin-docker-buildx:6.0.2
@@ -1,7 +1,7 @@
1
1
  # Contributing
2
2
 
3
3
  We are really happy to welcome new contributors to matridge!
4
- Before starting anything, please join [our chat room](xmpp:slidge@conference.nicoco.fr?join)
4
+ Before starting anything, please join [our chat room](xmpp:dev@rooms.slidge.im?join)
5
5
  to say hi and see if anyone is already working on the bug you want to fix or
6
6
  the feature you want to implement.
7
7
 
@@ -1,8 +1,7 @@
1
1
  ARG PYTHONVERSION=3.13
2
2
  ARG DEBIANVERSION=trixie
3
3
 
4
- # Builder
5
- # *******
4
+ # Builder ======================================================================
6
5
  FROM ghcr.io/astral-sh/uv:python$PYTHONVERSION-$DEBIANVERSION-slim AS builder
7
6
 
8
7
  # install git for setuptools scm
@@ -17,21 +16,30 @@ RUN apt-get update -y && \
17
16
  rm -rf /var/lib/apt/lists/*
18
17
  WORKDIR /build
19
18
  ENV UV_PROJECT_ENVIRONMENT=/venv
20
- ENV PATH="/venv/bin:/root/.cargo/bin:$PATH"
19
+ ENV PATH="/venv/bin:$PATH"
21
20
  RUN uv venv $UV_PROJECT_ENVIRONMENT
21
+
22
22
  COPY pyproject.toml uv.lock README.md .
23
- COPY matridge matridge
24
23
  ARG SLIDGE_USE_LOCKFILE=
25
24
  RUN [ -z "$SLIDGE_USE_LOCKFILE" ] && rm uv.lock || true
26
- # install dependencies in /venv
27
- # .git/ needs to be mounted for setuptools-scm to set the version
25
+ # Install dependencies in /venv. Version is unused at this point.
26
+ RUN SETUPTOOLS_SCM_PRETEND_VERSION_FOR_matridge=0 \
27
+ uv sync --no-dev --no-install-project
28
+ # (Optionnally) append .dev to the required slidge version in pyproject.toml,
29
+ # invalidating the lockfile and setting the prerelease=allow policy for slidge.
30
+ ARG SLIDGE_PRERELEASE=
31
+ RUN [ ! -z "$SLIDGE_PRERELEASE" ] && \
32
+ sed -ri 's/(slidge.=)([^,"d]*)([,"])/\1\2.dev\3/' pyproject.toml && \
33
+ SETUPTOOLS_SCM_PRETEND_VERSION_FOR_matridge=0 \
34
+ uv sync --no-dev --no-install-project \
35
+ || true
36
+
37
+ COPY matridge matridge
38
+ # Need .git/ to be mounted for setuptools-scm to determine the version.
28
39
  RUN --mount=source=.git,target=/build/.git,type=bind \
29
- uv sync --no-dev
30
- ARG SLIDGE_PRERELEASE
31
- RUN [ ! -z "$SLIDGE_PRERELEASE" ] && uv pip install slidge --upgrade --prerelease allow || true
40
+ uv pip install -e .
32
41
 
33
- # CI container
34
- # ************
42
+ # CI container ================================================================
35
43
  FROM builder AS ci
36
44
 
37
45
  # We won't use this venv in CI, but this populates the uv cache in the container,
@@ -42,8 +50,7 @@ ENV UV_PROJECT_ENVIRONMENT="/woodpecker/src/codeberg.org/slidge/matridge/.venv"
42
50
  ENV UV_LINK_MODE=copy
43
51
  ENV PATH="$UV_PROJECT_ENVIRONMENT/bin:$PATH"
44
52
 
45
- # Dev container
46
- # *************
53
+ # Dev container ================================================================
47
54
  FROM builder AS dev
48
55
 
49
56
  # copy "localhost" certs from the prosody slidge dev container, so
@@ -71,8 +78,7 @@ ENTRYPOINT ["watchmedo", "auto-restart", \
71
78
  "--admins", "test@localhost", \
72
79
  "--dev-mode"]
73
80
 
74
- # Prod container
75
- # **************
81
+ # Prod container ===============================================================
76
82
  FROM docker.io/python:$PYTHONVERSION-slim-$DEBIANVERSION AS matridge
77
83
 
78
84
  ARG PYTHONVERSION
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matridge
3
- Version: 0.3.2
3
+ Version: 0.4.0
4
4
  Summary: A Matrix/XMPP gateway
5
5
  Author-email: Nicolas Cedilnik <nicoco@nicoco.fr>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -19,7 +19,7 @@ Requires-Dist: matrix-nio[e2e]<0.26,>=0.25
19
19
  Requires-Dist: beautifulsoup4<5,>=4.12.2
20
20
  Requires-Dist: async-lru<3,>=2.0.3
21
21
  Requires-Dist: slidge-style-parser>=0.1.6
22
- Requires-Dist: slidge<0.4,>=0.3.3
22
+ Requires-Dist: slidge<0.5,>=0.4.0b1.dev7
23
23
  Dynamic: license-file
24
24
 
25
25
  # matridge
@@ -44,10 +44,11 @@ matridge lets you chat with users of Matrix without leaving your favorite XMPP c
44
44
  ## Quickstart
45
45
 
46
46
  ```sh
47
- docker run codeberg.org/slidge/matridge \ # works with podman too
47
+ docker run -v /somewhere/writeable:/var/lib/slidge \ # for data persistence
48
+ --network=host \ # easiest setup to reach your XMPP server
49
+ codeberg.org/slidge/matridge:latest \
48
50
  --jid matrix.example.org \ # can be whatever you want it to be
49
- --secret some-secret \ # must match your XMPP server config
50
- --home-dir /somewhere/writeable # for data persistence
51
+ --secret some-secret # must match your XMPP server config
51
52
  ```
52
53
 
53
54
  Use the `:latest` tag for the latest release, `:vX.X.X` for release X.X.X, and `:main`
@@ -20,10 +20,11 @@ matridge lets you chat with users of Matrix without leaving your favorite XMPP c
20
20
  ## Quickstart
21
21
 
22
22
  ```sh
23
- docker run codeberg.org/slidge/matridge \ # works with podman too
23
+ docker run -v /somewhere/writeable:/var/lib/slidge \ # for data persistence
24
+ --network=host \ # easiest setup to reach your XMPP server
25
+ codeberg.org/slidge/matridge:latest \
24
26
  --jid matrix.example.org \ # can be whatever you want it to be
25
- --secret some-secret \ # must match your XMPP server config
26
- --home-dir /somewhere/writeable # for data persistence
27
+ --secret some-secret # must match your XMPP server config
27
28
  ```
28
29
 
29
30
  Use the `:latest` tag for the latest release, `:vX.X.X` for release X.X.X, and `:main`
@@ -0,0 +1,117 @@
1
+ .. GENERATED FILE, DO NOT EDIT DIRECTLY
2
+
3
+ This file is automatically generated using https://codeberg.org/slidge/legacy-module-template/
4
+ Its source is at:
5
+ https://codeberg.org/slidge/legacy-module-template/src/branch/main/docs/source/admin/config.rst.jinja
6
+ Open a pull request for this repository instead, to benefit the documentation of all slidge-based gateways.
7
+
8
+ .. _config:
9
+
10
+ Configuration
11
+ =============
12
+
13
+ Both
14
+ :ref:`matridge-specific options <config-matridge>` and
15
+ :ref:`slidge generic options <generic-config>`
16
+ can be set using
17
+ :ref:`config text file(s) <config-file>`,
18
+ :ref:`command-line arguments <config-cli>`,
19
+ or :ref:`environment variables <config-env>`.
20
+
21
+ .. _config-file:
22
+
23
+ Config files
24
+ ************
25
+
26
+ Location
27
+ --------
28
+
29
+ By default, matridge uses all config files found in ``/etc/slidge/conf.d/*.conf``.
30
+ You can change this using the ``SLIDGE_CONF_DIR`` env var, eg
31
+ ``SLIDGE_CONF_DIR=/path/dir1:/path/dir2:/path/dir3``.
32
+
33
+ We recommend using ``/etc/slidge/conf.d/common.conf`` file to set
34
+ the options common to several slidge-based gateways
35
+ (eg, attachment handling, logging options, etc.),
36
+ then use a matridge-specific dedicated config file, eg
37
+ ``/etc/slidge/matridge.conf``.
38
+
39
+ Point to this specific file using the ``-c`` command line argument when
40
+ launching matridge.
41
+
42
+ .. code-block:: bash
43
+
44
+ matridge -c /etc/slidge/matridge.conf
45
+
46
+
47
+ Syntax
48
+ ------
49
+
50
+ Config files are simple text files with ``key=value`` entries.
51
+
52
+ .. code-block::
53
+
54
+ some-option=some-value
55
+ some-other-option=some-other-value
56
+
57
+ .. _config-cli:
58
+
59
+ Command-line arguments
60
+ **********************
61
+
62
+ To pass options as command-line arguments, prepend their name with ``--``.
63
+
64
+ .. code-block::
65
+
66
+ matridge --some-option=some-value --some-other-option=some-other-value
67
+
68
+ .. _config-env:
69
+
70
+ Environment variables
71
+ *********************
72
+
73
+ To pass options as environment variables:
74
+
75
+ * uppercase their name;
76
+ * substitue dashed for underscores;
77
+ * prepend with ``SLIDGE_`` for :ref:`generic slidge options <generic-config>`,
78
+ or ``MATRIDGE_`` for
79
+ :ref:`matridge-specific options <config-matridge>`.
80
+
81
+ .. code-block::
82
+
83
+ SLIDGE_SOME_GENERIC_OPTION=some-value
84
+ MATRIDGE_SOME_SPECIFIC_OPTION=some-other-value
85
+
86
+ .. _config-matridge:
87
+
88
+ matridge-specific config
89
+ ************************
90
+
91
+ matridge provides the instance-wide options displayed in the table below.
92
+
93
+ .. config-obj:: matridge.config
94
+
95
+ .. _generic-config:
96
+
97
+ Generic slidge config
98
+ *********************
99
+
100
+ .. note::
101
+
102
+ The following options are for slidge version |slidge_version|.
103
+ Depending on how you installed matridge, you might have a different version of slidge.
104
+ Use ``matridge --help`` for the exact list of options you can use.
105
+
106
+ Slidge provides the generic instance-wide options displayed in the table below.
107
+ They may not all have an effect on matridge's behaviour.
108
+
109
+ .. config-obj:: slidge.core.config
110
+
111
+
112
+ Advanced logging configuration
113
+ ******************************
114
+
115
+ To customize the output of the slidge, you can use the command line argument ``--log-config``
116
+ to specify a `logging configuration file
117
+ <https://docs.python.org/3/library/logging.config.html#configuration-file-format>`_.
@@ -16,12 +16,17 @@ registry <https://codeberg.org/slidge/-/packages/container/matridge/latest>`__.
16
16
 
17
17
  .. code:: sh
18
18
 
19
- docker run codeberg.org/slidge/matridge # works with podman too
19
+ docker run codeberg.org/slidge/matridge:latest # works with podman too
20
20
 
21
21
  Use the ``:latest`` tag for the latest release, ``:vX.X.X`` for release
22
22
  X.X.X, and ``:main`` for the bleeding edge.
23
23
 
24
24
 
25
+ For data persistence, mount a writeable directory into ``/var/lib/slidge``. Inside the container,
26
+ matridge runs as the ``slidge`` user with UID/GID 10000/10000.
27
+
28
+ matridge must be able to :ref:`reach your XMPP server <setup-component>`, so set up networking accordingly.
29
+
25
30
  Python packages
26
31
  ~~~~~~~~~~~~~~~
27
32
 
@@ -61,6 +61,9 @@ declare matridge privileges in the appropriate virtualhost block:
61
61
  ["matrix.example.org"] = _privileges;
62
62
  }
63
63
 
64
+ Component "matrix.example.org"
65
+ modules_enabled = {"privilege"}
66
+
64
67
  Then either restart the prosody server, or reload the config.
65
68
  You might need to use
66
69
  `mod_reload_component <https://modules.prosody.im/mod_reload_components.html>`_,
@@ -12,7 +12,7 @@ matridge
12
12
 
13
13
  `Source <https://codeberg.org/slidge/matridge>`_
14
14
 
15
- `Chat room <xmpp:slidge@conference.nicoco.fr?join>`_
15
+ `Chat room <xmpp:support@rooms.slidge.im?join>`_
16
16
 
17
17
  `Bug tracker <https://codeberg.org/slidge/matridge/issues>`_
18
18
 
@@ -16,7 +16,7 @@ except PackageNotFoundError:
16
16
  __version__ = "dev"
17
17
 
18
18
 
19
- def main():
19
+ def main() -> None:
20
20
  if len(sys.argv) == 2 and sys.argv[1] == "--version":
21
21
  print("matridge version", __version__)
22
22
  exit(0)