matrix-python 1.0.0b0__tar.gz → 1.0.2__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 (144) hide show
  1. matrix_python-1.0.2/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
  2. matrix_python-1.0.2/.github/ISSUE_TEMPLATE/feature--good-first.md +29 -0
  3. matrix_python-1.0.2/.github/ISSUE_TEMPLATE/feature_request.md +21 -0
  4. matrix_python-1.0.2/.github/dependabot.yml +6 -0
  5. matrix_python-1.0.2/.github/pull_request_template.md +14 -0
  6. matrix_python-1.0.2/.github/workflows/CODEOWNERS +1 -0
  7. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/.github/workflows/codeql.yml +1 -1
  8. matrix_python-1.0.2/.github/workflows/docs.yml +38 -0
  9. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/.github/workflows/publish.yml +2 -2
  10. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/.github/workflows/scorecard.yml +1 -1
  11. matrix_python-1.0.2/.github/workflows/tests.yml +44 -0
  12. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/.gitignore +2 -1
  13. matrix_python-1.0.2/.pre-commit-config.yaml +44 -0
  14. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/CONTRIBUTING.md +24 -6
  15. matrix_python-1.0.2/LICENSE +21 -0
  16. matrix_python-1.0.2/PKG-INFO +153 -0
  17. matrix_python-1.0.2/README.md +100 -0
  18. matrix_python-1.0.2/docs/docs/examples/checks.md +15 -0
  19. matrix_python-1.0.2/docs/docs/examples/cooldown.md +14 -0
  20. matrix_python-1.0.2/docs/docs/examples/error-handling.md +17 -0
  21. matrix_python-1.0.2/docs/docs/examples/extension.md +26 -0
  22. matrix_python-1.0.2/docs/docs/examples/index.md +20 -0
  23. matrix_python-1.0.2/docs/docs/examples/ping.md +9 -0
  24. matrix_python-1.0.2/docs/docs/examples/reaction.md +14 -0
  25. matrix_python-1.0.2/docs/docs/examples/scheduler.md +19 -0
  26. matrix_python-1.0.2/docs/docs/guides/bigger-bot.md +95 -0
  27. matrix_python-1.0.2/docs/docs/guides/checks.md +114 -0
  28. matrix_python-1.0.2/docs/docs/guides/commands.md +158 -0
  29. matrix_python-1.0.2/docs/docs/guides/component.md +141 -0
  30. matrix_python-1.0.2/docs/docs/guides/configuration.md +86 -0
  31. matrix_python-1.0.2/docs/docs/guides/error-handling.md +97 -0
  32. matrix_python-1.0.2/docs/docs/guides/events.md +115 -0
  33. matrix_python-1.0.2/docs/docs/guides/groups.md +111 -0
  34. matrix_python-1.0.2/docs/docs/guides/index.md +87 -0
  35. matrix_python-1.0.2/docs/docs/guides/introduction.md +126 -0
  36. matrix_python-1.0.2/docs/docs/img/favicon.svg +68 -0
  37. matrix_python-1.0.2/docs/docs/img/matrixpy-black.svg +72 -0
  38. matrix_python-1.0.2/docs/docs/img/matrixpy-white.svg +89 -0
  39. matrix_python-1.0.2/docs/docs/index.md +175 -0
  40. matrix_python-1.0.2/docs/docs/reference/bot.md +20 -0
  41. matrix_python-1.0.2/docs/docs/reference/checks.md +17 -0
  42. matrix_python-1.0.2/docs/docs/reference/command.md +15 -0
  43. matrix_python-1.0.2/docs/docs/reference/component.md +27 -0
  44. matrix_python-1.0.2/docs/docs/reference/config.md +19 -0
  45. matrix_python-1.0.2/docs/docs/reference/content.md +34 -0
  46. matrix_python-1.0.2/docs/docs/reference/context.md +15 -0
  47. matrix_python-1.0.2/docs/docs/reference/errors.md +18 -0
  48. matrix_python-1.0.2/docs/docs/reference/extension.md +30 -0
  49. matrix_python-1.0.2/docs/docs/reference/group.md +19 -0
  50. matrix_python-1.0.2/docs/docs/reference/message.md +15 -0
  51. matrix_python-1.0.2/docs/docs/reference/protocols.md +5 -0
  52. matrix_python-1.0.2/docs/docs/reference/registry.md +7 -0
  53. matrix_python-1.0.2/docs/docs/reference/room.md +15 -0
  54. matrix_python-1.0.2/docs/docs/reference/scheduler.md +16 -0
  55. matrix_python-1.0.2/docs/docs/reference/space.md +15 -0
  56. matrix_python-1.0.2/docs/docs/reference/types.md +26 -0
  57. matrix_python-1.0.2/docs/docs/stylesheets/extra.css +3 -0
  58. matrix_python-1.0.2/docs/mkdocs.yml +125 -0
  59. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/examples/checks.py +2 -2
  60. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/examples/config.yaml +1 -1
  61. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/examples/cooldown.py +2 -2
  62. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/examples/error_handling.py +2 -2
  63. matrix_python-1.0.2/examples/extension.py +47 -0
  64. matrix_python-1.0.2/examples/member.py +33 -0
  65. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/examples/ping.py +2 -2
  66. matrix_python-1.0.2/examples/reaction.py +39 -0
  67. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/examples/scheduler.py +5 -5
  68. matrix_python-1.0.2/examples/table.py +20 -0
  69. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/__init__.py +13 -2
  70. matrix_python-1.0.2/matrix/_error_handler.py +14 -0
  71. matrix_python-1.0.2/matrix/_version.py +24 -0
  72. matrix_python-1.0.2/matrix/api.py +111 -0
  73. matrix_python-1.0.2/matrix/bot.py +432 -0
  74. matrix_python-1.0.2/matrix/checks.py +122 -0
  75. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/command.py +50 -51
  76. matrix_python-1.0.2/matrix/component.py +109 -0
  77. matrix_python-1.0.2/matrix/config.py +125 -0
  78. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/content.py +15 -0
  79. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/context.py +6 -5
  80. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/errors.py +23 -6
  81. matrix_python-1.0.2/matrix/extension.py +90 -0
  82. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/group.py +61 -7
  83. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/help/help_command.py +62 -72
  84. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/help/pagination.py +4 -22
  85. matrix_python-1.0.2/matrix/member.py +217 -0
  86. matrix_python-1.0.2/matrix/message.py +295 -0
  87. matrix_python-1.0.2/matrix/protocols.py +13 -0
  88. matrix_python-1.0.2/matrix/py.typed +0 -0
  89. matrix_python-1.0.2/matrix/registry.py +460 -0
  90. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/room.py +175 -48
  91. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/scheduler.py +13 -10
  92. matrix_python-1.0.2/matrix/space.py +45 -0
  93. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/types.py +15 -0
  94. matrix_python-1.0.2/matrix_python.egg-info/PKG-INFO +153 -0
  95. matrix_python-1.0.2/matrix_python.egg-info/SOURCES.txt +122 -0
  96. matrix_python-1.0.2/matrix_python.egg-info/requires.txt +21 -0
  97. matrix_python-1.0.2/matrix_python.egg-info/scm_file_list.json +118 -0
  98. matrix_python-1.0.2/matrix_python.egg-info/scm_version.json +8 -0
  99. matrix_python-1.0.2/pyproject.toml +64 -0
  100. matrix_python-1.0.2/tests/test_api.py +220 -0
  101. matrix_python-1.0.2/tests/test_bot.py +1143 -0
  102. matrix_python-1.0.2/tests/test_checks.py +258 -0
  103. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/tests/test_command.py +89 -27
  104. matrix_python-1.0.2/tests/test_component.py +102 -0
  105. matrix_python-1.0.2/tests/test_config.py +139 -0
  106. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/tests/test_context.py +0 -1
  107. matrix_python-1.0.2/tests/test_error_handler.py +70 -0
  108. matrix_python-1.0.2/tests/test_extension.py +252 -0
  109. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/tests/test_group.py +34 -2
  110. matrix_python-1.0.2/tests/test_member.py +392 -0
  111. matrix_python-1.0.2/tests/test_message.py +465 -0
  112. matrix_python-1.0.2/tests/test_registry.py +416 -0
  113. matrix_python-1.0.2/tests/test_room.py +570 -0
  114. matrix_python-1.0.2/tests/test_space.py +151 -0
  115. matrix_python-1.0.0b0/.github/workflows/tests.yml +0 -35
  116. matrix_python-1.0.0b0/LICENSE +0 -674
  117. matrix_python-1.0.0b0/PKG-INFO +0 -773
  118. matrix_python-1.0.0b0/README.md +0 -74
  119. matrix_python-1.0.0b0/examples/reaction.py +0 -43
  120. matrix_python-1.0.0b0/matrix/_version.py +0 -34
  121. matrix_python-1.0.0b0/matrix/bot.py +0 -495
  122. matrix_python-1.0.0b0/matrix/checks.py +0 -21
  123. matrix_python-1.0.0b0/matrix/config.py +0 -61
  124. matrix_python-1.0.0b0/matrix/message.py +0 -131
  125. matrix_python-1.0.0b0/matrix_python.egg-info/PKG-INFO +0 -773
  126. matrix_python-1.0.0b0/matrix_python.egg-info/SOURCES.txt +0 -53
  127. matrix_python-1.0.0b0/matrix_python.egg-info/requires.txt +0 -13
  128. matrix_python-1.0.0b0/pyproject.toml +0 -47
  129. matrix_python-1.0.0b0/tests/config_fixture.yaml +0 -4
  130. matrix_python-1.0.0b0/tests/config_fixture_token.yaml +0 -1
  131. matrix_python-1.0.0b0/tests/test_bot.py +0 -414
  132. matrix_python-1.0.0b0/tests/test_config.py +0 -81
  133. matrix_python-1.0.0b0/tests/test_message.py +0 -139
  134. matrix_python-1.0.0b0/tests/test_room.py +0 -356
  135. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/CODE_OF_CONDUCT.md +0 -0
  136. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/examples/README.md +0 -0
  137. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix/help/__init__.py +0 -0
  138. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix_python.egg-info/dependency_links.txt +0 -0
  139. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/matrix_python.egg-info/top_level.txt +0 -0
  140. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/mypy.ini +0 -0
  141. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/setup.cfg +0 -0
  142. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/tests/help/test_default_help_command.py +0 -0
  143. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/tests/help/test_help_command.py +0 -0
  144. {matrix_python-1.0.0b0 → matrix_python-1.0.2}/tests/help/test_pagination.py +0 -0
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: PenguinBoi12
7
+ type: Bug
8
+
9
+ ---
10
+
11
+ **Describe the bug**
12
+ A clear and concise description of what the bug is.
13
+
14
+ **To Reproduce**
15
+ Steps to reproduce the behavior:
16
+ 1. Go to '...'
17
+ 2. Click on '....'
18
+ 3. Scroll down to '....'
19
+ 4. See error
20
+
21
+ **Expected behavior**
22
+ A clear and concise description of what you expected to happen.
23
+
24
+ **Screenshots**
25
+ If applicable, add screenshots to help explain your problem.
26
+
27
+ **Additional context**
28
+ Add any other context about the problem here.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: 'Feature: Good First'
3
+ about: 'This template is for good first issues '
4
+ title: ''
5
+ labels: good first issue
6
+ assignees: ''
7
+ type: Feature
8
+
9
+ ---
10
+
11
+ Explain clearly what we want to add and why it's useful to add it. Give context when necessary.
12
+
13
+ ### Proposed API
14
+ This is a proposed API. It does not necessarily mean it's the final API but it's a good place to start.
15
+
16
+ ```python
17
+ Some code here
18
+ ```
19
+
20
+ **Example**
21
+ ```python
22
+ An example of usage of the feature
23
+ ```
24
+
25
+ ### Before opening a PR
26
+ - Write unit tests
27
+ - Run `mypy matrix/`
28
+ - Run `pytest tests/`
29
+ - Run `black .`
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+ type: Feature
8
+
9
+ ---
10
+
11
+ **Is your feature request related to a problem? Please describe.**
12
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
13
+
14
+ **Describe the solution you'd like**
15
+ A clear and concise description of what you want to happen.
16
+
17
+ **Describe alternatives you've considered**
18
+ A clear and concise description of any alternative solutions or features you've considered.
19
+
20
+ **Additional context**
21
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "monthly"
@@ -0,0 +1,14 @@
1
+ ## Description
2
+ Brief description of what this PR does and why.
3
+
4
+ ### Type of Change
5
+ - [ ] Feature
6
+ - [ ] Refactor
7
+ - [ ] Bug fix
8
+ - [ ] Documentation
9
+ - [ ] Other: ___
10
+
11
+ ### Pre-merge Checklist
12
+ - [ ] Run tests: `pytest`
13
+ - [ ] Run type check: `mypy`
14
+ - [ ] Run formatting: `black .
@@ -0,0 +1 @@
1
+ * @PenguinBoi12
@@ -96,4 +96,4 @@ jobs:
96
96
  - name: Perform CodeQL Analysis
97
97
  uses: github/codeql-action/analyze@v4
98
98
  with:
99
- category: "/language:${{matrix.language}}"
99
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,38 @@
1
+ name: Deploy Docs
2
+
3
+ on:
4
+ release:
5
+ types: [ published ]
6
+
7
+ permissions:
8
+ contents: read
9
+ pages: write
10
+ id-token: write
11
+
12
+ jobs:
13
+ deploy:
14
+ runs-on: ubuntu-latest
15
+ environment:
16
+ name: github-pages
17
+ url: ${{ steps.deployment.outputs.page_url }}
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.10"
25
+
26
+ - name: Install dependencies
27
+ run: pip install .[doc]
28
+
29
+ - name: Build docs
30
+ run: cd docs && mkdocs build
31
+
32
+ - uses: actions/upload-pages-artifact@v3
33
+ with:
34
+ path: docs/site
35
+
36
+ - name: Deploy to GitHub Pages
37
+ id: deployment
38
+ uses: actions/deploy-pages@v4
@@ -43,7 +43,7 @@ jobs:
43
43
  environment:
44
44
  name: release
45
45
  url: https://pypi.org/project/matrix-python/${{ github.event.release.tag_name }}
46
-
46
+
47
47
  steps:
48
48
  - name: Retrieve release distributions
49
49
  uses: actions/download-artifact@v4
@@ -52,4 +52,4 @@ jobs:
52
52
  path: dist/
53
53
 
54
54
  - name: Publish release distributions to PyPI
55
- uses: pypa/gh-action-pypi-publish@release/v1
55
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -49,4 +49,4 @@ jobs:
49
49
  - name: "Upload to code-scanning"
50
50
  uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
51
51
  with:
52
- sarif_file: results.sarif
52
+ sarif_file: results.sarif
@@ -0,0 +1,44 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ build:
14
+
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Set up Python 3.12
20
+ uses: actions/setup-python@v3
21
+ with:
22
+ python-version: "3.12"
23
+ - name: Install dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install -e .[dev]
27
+ - name: Lint with Black
28
+ id: black
29
+ continue-on-error: true
30
+ run: |
31
+ black --check matrix/ tests/ examples/
32
+ - name: Check typing with mypy
33
+ id: mypy
34
+ continue-on-error: true
35
+ run: |
36
+ mypy matrix
37
+ - name: Test with pytest
38
+ id: pytest
39
+ continue-on-error: true
40
+ run: |
41
+ pytest -v --cov=matrix --cov-report=term-missing --cov-fail-under=90
42
+ - name: All checks succeeded
43
+ if: steps.black.outcome == 'failure' || steps.mypy.outcome == 'failure' || steps.pytest.outcome == 'failure'
44
+ run: exit 1
@@ -176,4 +176,5 @@ cython_debug/
176
176
  .DS_Store
177
177
 
178
178
  .vscode
179
- matrix/_version.py
179
+ matrix/_version.py
180
+ site/
@@ -0,0 +1,44 @@
1
+ default_language_version:
2
+ python: python3
3
+
4
+ default_stages: [pre-commit]
5
+
6
+ repos:
7
+ - repo: https://github.com/pre-commit/pre-commit-hooks
8
+ rev: v6.0.0
9
+ hooks:
10
+ - id: check-added-large-files
11
+ stages: [pre-commit]
12
+ - id: check-toml
13
+ stages: [pre-commit]
14
+ - id: check-yaml
15
+ exclude: ^docs/mkdocs\.yml$
16
+ stages: [pre-commit]
17
+ - id: end-of-file-fixer
18
+ stages: [pre-commit]
19
+ - id: trailing-whitespace
20
+ stages: [pre-commit]
21
+
22
+ - repo: local
23
+ hooks:
24
+ - id: black
25
+ name: black
26
+ entry: python -m black
27
+ language: system
28
+ stages: [pre-commit]
29
+ types_or: [python, pyi]
30
+
31
+ - id: mypy
32
+ name: mypy
33
+ entry: python -m mypy matrix
34
+ language: system
35
+ pass_filenames: false
36
+ stages: [pre-commit]
37
+ types_or: [python, pyi]
38
+
39
+ - id: pytest
40
+ name: pytest
41
+ entry: python -m pytest
42
+ language: system
43
+ pass_filenames: false
44
+ stages: [pre-commit]
@@ -2,7 +2,7 @@
2
2
  Thank you for your interest in contributing to the matrix.py! As an open source project, many kinds of contributions are welcome.
3
3
 
4
4
  ## How can you contribute?
5
- You can contribute to this project in the follwing ways
5
+ You can contribute to this project in the following ways
6
6
 
7
7
  - Report Bugs
8
8
  - Add new features
@@ -12,9 +12,27 @@ You can contribute to this project in the follwing ways
12
12
  **Warning:** Non-trivial pull requests must have an [issue](https://github.com/Code-Society-Lab/matrixpy/issues) proposing the changes.
13
13
 
14
14
  ## Setup
15
- 1. Clone the Textual repository
16
- 2. Create a virtual enviroment
17
- 3. Install the dependencies
15
+ 1. Clone the matrix.py repository
16
+ 2. Create and activate a virtual environment
17
+ 3. Install the development dependencies and enable the Git hooks.
18
+
19
+ ```bash
20
+ pip install -e ".[dev]"
21
+ pre-commit install
22
+ ```
23
+
24
+
25
+ After installation, the Git hooks run automatically before each commit to check formatting, typing, and tests.
26
+ The hooks include running:
27
+ - black
28
+ - mypy
29
+ - pytest
30
+
31
+ Run the full hook suite manually with:
32
+
33
+ ```bash
34
+ pre-commit run --all-files
35
+ ```
18
36
 
19
37
  ## Guidelines
20
38
  Read any issue instructions carefully. Feel free to ask for clarification if any details are missing.
@@ -22,8 +40,8 @@ Read any issue instructions carefully. Feel free to ask for clarification if any
22
40
  Add docstrings to all of your code (functions, methods, classes, ...). The codebase should have enough examples for you to copy from.
23
41
 
24
42
  Write tests for your code.
25
- If you are fixing a bug, make sure to add regression tests that link to the original issue.
26
- If you are implementing new features, make sure to add tests
43
+ - If you are fixing a bug, add a regression test that references the original issue.
44
+ - If you are implementing a new feature, add tests covering the new functionality.
27
45
 
28
46
  ## Before opening a PR
29
47
 
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Code Society Lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,153 @@
1
+ Metadata-Version: 2.4
2
+ Name: matrix-python
3
+ Version: 1.0.2
4
+ Summary: An easy-to-use Matrix bot framework designed for quick development and minimal setup
5
+ Author: Simon Roy, Chris Dedman Rollet
6
+ Maintainer-email: Code Society Lab <admin@codesociety.xyz>
7
+ License: The MIT License (MIT)
8
+
9
+ Copyright (c) 2025 Code Society Lab
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in
19
+ all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
+ THE SOFTWARE.
28
+
29
+ Project-URL: Homepage, https://codesociety.xyz
30
+ Project-URL: Source, https://github.com/Code-Society-Lab/matrixpy
31
+ Project-URL: Issues, https://github.com/Code-Society-Lab/matrixpy/issues
32
+ Requires-Python: >=3.10
33
+ Description-Content-Type: text/markdown
34
+ Requires-Dist: matrix-nio==0.26.0
35
+ Requires-Dist: logger
36
+ Requires-Dist: PyYAML==6.0.3
37
+ Requires-Dist: markdown==3.10.3
38
+ Requires-Dist: APScheduler==3.11.3
39
+ Requires-Dist: envyaml==1.10.211231
40
+ Provides-Extra: dev
41
+ Requires-Dist: pytest==9.2.0; extra == "dev"
42
+ Requires-Dist: pytest-cov==7.1.0; extra == "dev"
43
+ Requires-Dist: pytest-asyncio==1.4.1; extra == "dev"
44
+ Requires-Dist: black==26.10.1; extra == "dev"
45
+ Requires-Dist: mypy==2.4.1; extra == "dev"
46
+ Requires-Dist: pre-commit==4.6.2; extra == "dev"
47
+ Requires-Dist: types-PyYAML==6.0.12.20260906; extra == "dev"
48
+ Requires-Dist: types-Markdown==3.11.2.20261029; extra == "dev"
49
+ Provides-Extra: doc
50
+ Requires-Dist: mkdocs==1.6.1; extra == "doc"
51
+ Requires-Dist: mkdocs-material==9.7.7; extra == "doc"
52
+ Requires-Dist: mkdocstrings[python]==1.0.6; extra == "doc"
53
+
54
+ <div align="center">
55
+ <em>A simple, developer-friendly library to create powerful <a href="https://matrix.org">Matrix</a> bots.</em>
56
+ </div>
57
+
58
+ <div align="center">
59
+ <img alt="matrix.py" src="https://github.com/user-attachments/assets/d9140a9e-27fa-44e4-a5ca-87ee7bbf868f" />
60
+ </div>
61
+
62
+ <div align="center">
63
+
64
+ [<img src="https://img.shields.io/badge/Get%20Started-black?style=for-the-badge" />](https://matrixpy.codesociety.xyz/guides/introduction/)
65
+ [<img src="https://img.shields.io/badge/Reference-555555?style=for-the-badge" />](https://matrixpy.codesociety.xyz/reference/bot/)
66
+
67
+ </div>
68
+
69
+ <div align="center">
70
+
71
+ [![Join Discord](https://discordapp.com/api/guilds/823178343943897088/widget.png?style=shield)](https://discord.gg/code-society-823178343943897088)
72
+ [![Join Matrix](https://img.shields.io/matrix/codesociety%3Amatrix.org?logo=matrix&label=%20&labelColor=%23202020&color=%23202020)](https://matrix.to/#/%23codesociety:matrix.org)
73
+ [![Tests](https://github.com/Code-Society-Lab/matrixpy/actions/workflows/tests.yml/badge.svg)](https://github.com/Code-Society-Lab/matrixpy/actions/workflows/tests.yml)
74
+ [![PyPI](https://img.shields.io/pypi/v/matrix-python)](https://pypi.org/project/matrix-python/)
75
+ [![CodeQL Advanced](https://github.com/Code-Society-Lab/matrixpy/actions/workflows/codeql.yml/badge.svg)](https://github.com/Code-Society-Lab/matrixpy/actions/workflows/codeql.yml)
76
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/Code-Society-Lab/matrixpy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/Code-Society-Lab/matrixpy)
77
+
78
+ </div>
79
+
80
+ ---
81
+
82
+ Matrix.py is a lightweight and intuitive Python library to build bots on the [Matrix protocol](https://matrix.org). It
83
+ provides a clean, decorator-based API similar to popular event-driven frameworks, allowing developers to focus on
84
+ behavior rather than boilerplate.
85
+
86
+ - **Minimal setup** — install and have a working bot running in minutes
87
+ - **Event-driven** — async/await API reacting to any Matrix room event
88
+ - **Command system** — decorator-based commands with automatic argument parsing
89
+ - **Extensions** — split your bot into modules as it grows
90
+
91
+ ## Quickstart
92
+
93
+ **Requirements:** Python 3.10+
94
+
95
+ ```bash
96
+ pip install matrix-python
97
+ ```
98
+
99
+ Using a virtual environment is strongly recommended:
100
+
101
+ ```bash
102
+ python -m venv venv
103
+ source venv/bin/activate # Windows: venv\Scripts\activate
104
+ pip install matrix-python
105
+ ```
106
+
107
+ Create a `config.yml`:
108
+
109
+ ```yaml
110
+ USERNAME: "@yourbot:matrix.org"
111
+ PASSWORD: "your_password"
112
+ ```
113
+
114
+ ```python
115
+ from matrix import Bot, Context
116
+
117
+ bot = Bot()
118
+
119
+
120
+ @bot.command("ping")
121
+ async def ping(ctx: Context):
122
+ await ctx.reply("Pong!")
123
+
124
+
125
+ bot.start(config="config.yml")
126
+ ```
127
+
128
+ Send `!ping` in any room the bot is in, it will reply `Pong!`.
129
+
130
+ ## Where to go next
131
+
132
+ - [**Guides**](https://matrixpy.codesociety.xyz/guides/introduction/) — step-by-step tutorials covering commands,
133
+ events, checks, extensions, and more
134
+ - [**Reference**](https://matrixpy.codesociety.xyz/reference/bot/) — complete API documentation for every class and
135
+ function
136
+ - [**Examples**](https://matrixpy.codesociety.xyz/examples/) — ready-to-run example bots
137
+ demonstrating common patterns
138
+
139
+ ## Contributing
140
+
141
+ We welcome everyone to contribute! Whether it's fixing bugs, suggesting features, or improving the docs. Every bit
142
+ helps.
143
+
144
+ - [Submit an issue](https://github.com/Code-Society-Lab/matrixpy/issues)
145
+ - [Open a pull request](https://github.com/Code-Society-Lab/matrixpy/blob/main/CONTRIBUTING.md)
146
+ - Hop into our [Matrix](https://matrix.to/#/%23codesociety:matrix.org)
147
+ or [Discord](https://discord.gg/code-society-823178343943897088) and say hi!
148
+
149
+ Please read the [CONTRIBUTING.md](./CONTRIBUTING.md) and follow the [code of conduct](./CODE_OF_CONDUCT.md).
150
+
151
+ ## License
152
+
153
+ Released under the [MIT License](https://github.com/Code-Society-Lab/matrixpy/blob/main/LICENSE).
@@ -0,0 +1,100 @@
1
+ <div align="center">
2
+ <em>A simple, developer-friendly library to create powerful <a href="https://matrix.org">Matrix</a> bots.</em>
3
+ </div>
4
+
5
+ <div align="center">
6
+ <img alt="matrix.py" src="https://github.com/user-attachments/assets/d9140a9e-27fa-44e4-a5ca-87ee7bbf868f" />
7
+ </div>
8
+
9
+ <div align="center">
10
+
11
+ [<img src="https://img.shields.io/badge/Get%20Started-black?style=for-the-badge" />](https://matrixpy.codesociety.xyz/guides/introduction/)
12
+ [<img src="https://img.shields.io/badge/Reference-555555?style=for-the-badge" />](https://matrixpy.codesociety.xyz/reference/bot/)
13
+
14
+ </div>
15
+
16
+ <div align="center">
17
+
18
+ [![Join Discord](https://discordapp.com/api/guilds/823178343943897088/widget.png?style=shield)](https://discord.gg/code-society-823178343943897088)
19
+ [![Join Matrix](https://img.shields.io/matrix/codesociety%3Amatrix.org?logo=matrix&label=%20&labelColor=%23202020&color=%23202020)](https://matrix.to/#/%23codesociety:matrix.org)
20
+ [![Tests](https://github.com/Code-Society-Lab/matrixpy/actions/workflows/tests.yml/badge.svg)](https://github.com/Code-Society-Lab/matrixpy/actions/workflows/tests.yml)
21
+ [![PyPI](https://img.shields.io/pypi/v/matrix-python)](https://pypi.org/project/matrix-python/)
22
+ [![CodeQL Advanced](https://github.com/Code-Society-Lab/matrixpy/actions/workflows/codeql.yml/badge.svg)](https://github.com/Code-Society-Lab/matrixpy/actions/workflows/codeql.yml)
23
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/Code-Society-Lab/matrixpy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/Code-Society-Lab/matrixpy)
24
+
25
+ </div>
26
+
27
+ ---
28
+
29
+ Matrix.py is a lightweight and intuitive Python library to build bots on the [Matrix protocol](https://matrix.org). It
30
+ provides a clean, decorator-based API similar to popular event-driven frameworks, allowing developers to focus on
31
+ behavior rather than boilerplate.
32
+
33
+ - **Minimal setup** — install and have a working bot running in minutes
34
+ - **Event-driven** — async/await API reacting to any Matrix room event
35
+ - **Command system** — decorator-based commands with automatic argument parsing
36
+ - **Extensions** — split your bot into modules as it grows
37
+
38
+ ## Quickstart
39
+
40
+ **Requirements:** Python 3.10+
41
+
42
+ ```bash
43
+ pip install matrix-python
44
+ ```
45
+
46
+ Using a virtual environment is strongly recommended:
47
+
48
+ ```bash
49
+ python -m venv venv
50
+ source venv/bin/activate # Windows: venv\Scripts\activate
51
+ pip install matrix-python
52
+ ```
53
+
54
+ Create a `config.yml`:
55
+
56
+ ```yaml
57
+ USERNAME: "@yourbot:matrix.org"
58
+ PASSWORD: "your_password"
59
+ ```
60
+
61
+ ```python
62
+ from matrix import Bot, Context
63
+
64
+ bot = Bot()
65
+
66
+
67
+ @bot.command("ping")
68
+ async def ping(ctx: Context):
69
+ await ctx.reply("Pong!")
70
+
71
+
72
+ bot.start(config="config.yml")
73
+ ```
74
+
75
+ Send `!ping` in any room the bot is in, it will reply `Pong!`.
76
+
77
+ ## Where to go next
78
+
79
+ - [**Guides**](https://matrixpy.codesociety.xyz/guides/introduction/) — step-by-step tutorials covering commands,
80
+ events, checks, extensions, and more
81
+ - [**Reference**](https://matrixpy.codesociety.xyz/reference/bot/) — complete API documentation for every class and
82
+ function
83
+ - [**Examples**](https://matrixpy.codesociety.xyz/examples/) — ready-to-run example bots
84
+ demonstrating common patterns
85
+
86
+ ## Contributing
87
+
88
+ We welcome everyone to contribute! Whether it's fixing bugs, suggesting features, or improving the docs. Every bit
89
+ helps.
90
+
91
+ - [Submit an issue](https://github.com/Code-Society-Lab/matrixpy/issues)
92
+ - [Open a pull request](https://github.com/Code-Society-Lab/matrixpy/blob/main/CONTRIBUTING.md)
93
+ - Hop into our [Matrix](https://matrix.to/#/%23codesociety:matrix.org)
94
+ or [Discord](https://discord.gg/code-society-823178343943897088) and say hi!
95
+
96
+ Please read the [CONTRIBUTING.md](./CONTRIBUTING.md) and follow the [code of conduct](./CODE_OF_CONDUCT.md).
97
+
98
+ ## License
99
+
100
+ Released under the [MIT License](https://github.com/Code-Society-Lab/matrixpy/blob/main/LICENSE).
@@ -0,0 +1,15 @@
1
+ # Checks
2
+
3
+ Shows how to restrict a command to a specific set of users using a [check](../reference/checks.md). The `!secret` command is only accessible to users in the `allowed_users` set — anyone else receives an "Access denied" reply.
4
+
5
+ ```python
6
+ --8<-- "examples/checks.py"
7
+ ```
8
+
9
+ Key points:
10
+
11
+ - `@secret_command.check` decorates an async function that returns `True` (allow) or `False` (deny). Returning `False` raises a [`CheckError`](../reference/errors.md).
12
+ - `@secret_command.error(CheckError)` handles the denial and sends a friendly reply instead of silently failing.
13
+ - `ctx.sender` is the full Matrix ID of the user who sent the command (e.g. `@alice:matrix.org`).
14
+
15
+ See the [Checks guide](../guides/checks.md) for built-in checks like `@is_owner` and how to compose multiple checks.
@@ -0,0 +1,14 @@
1
+ # Cooldowns
2
+
3
+ Demonstrates two ways to apply a rate limit to a command, and how to handle the [`CooldownError`](../reference/errors.md) when the limit is exceeded.
4
+
5
+ ```python
6
+ --8<-- "examples/cooldown.py"
7
+ ```
8
+
9
+ There are two ways to set a cooldown:
10
+
11
+ - **`@cooldown(rate, period)` decorator** — applied before `@bot.command`. `rate=2, period=10` means 2 uses per 10 seconds per user.
12
+ - **`cooldown=(rate, period)` argument** — passed directly to `@bot.command` for a more compact one-liner.
13
+
14
+ Both produce a `CooldownError` when the limit is exceeded. The error object exposes `error.retry` — the number of seconds until the user can try again — which you can surface in the reply.
@@ -0,0 +1,17 @@
1
+ # Error Handling
2
+
3
+ Shows both per-command error handlers and a global error handler, covering argument validation, runtime errors, and unknown commands.
4
+
5
+ ```python
6
+ --8<-- "examples/error_handling.py"
7
+ ```
8
+
9
+ Three layers of error handling are demonstrated:
10
+
11
+ - **Global handler** — `@bot.error(CommandNotFoundError)` catches any command the bot doesn't recognise, across the whole bot. No `ctx` is available here since no command was matched.
12
+ - **Per-command handlers** — `@division.error(ZeroDivisionError)` and `@division.error(ValueError)` handle errors raised inside the `division` function itself.
13
+ - **Argument handler** — `@division.error(MissingArgumentError)` fires when the user doesn't supply enough arguments.
14
+
15
+ Handlers are matched by exception type. If no handler is registered for a raised exception, it propagates normally.
16
+
17
+ See the [Error Handling guide](../guides/error-handling.md) for the full picture.