matteridge 0.2.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 (51) hide show
  1. matteridge-0.2.0/.gitignore +10 -0
  2. matteridge-0.2.0/.pre-commit-config.yaml +39 -0
  3. matteridge-0.2.0/.woodpecker/autoupdate-deps.yaml +28 -0
  4. matteridge-0.2.0/.woodpecker/container-cache.yaml +27 -0
  5. matteridge-0.2.0/.woodpecker/container-ci.yaml +20 -0
  6. matteridge-0.2.0/.woodpecker/container.yaml +40 -0
  7. matteridge-0.2.0/.woodpecker/docs.yaml +24 -0
  8. matteridge-0.2.0/.woodpecker/package.yaml +53 -0
  9. matteridge-0.2.0/.woodpecker/test.yaml +33 -0
  10. matteridge-0.2.0/Dockerfile +24 -0
  11. matteridge-0.2.0/LICENSE +661 -0
  12. matteridge-0.2.0/PKG-INFO +73 -0
  13. matteridge-0.2.0/README.md +54 -0
  14. matteridge-0.2.0/commitlint.config.js +31 -0
  15. matteridge-0.2.0/doap.xml +117 -0
  16. matteridge-0.2.0/docker-compose.yml +26 -0
  17. matteridge-0.2.0/docs/Makefile +20 -0
  18. matteridge-0.2.0/docs/source/codeberg.svg +17 -0
  19. matteridge-0.2.0/docs/source/conf.py +48 -0
  20. matteridge-0.2.0/docs/source/config.rst +14 -0
  21. matteridge-0.2.0/docs/source/features.rst +8 -0
  22. matteridge-0.2.0/docs/source/index.rst +27 -0
  23. matteridge-0.2.0/docs/source/readme.rst +1 -0
  24. matteridge-0.2.0/docs/source/user.rst +21 -0
  25. matteridge-0.2.0/matteridge/__init__.py +7 -0
  26. matteridge-0.2.0/matteridge/__main__.py +9 -0
  27. matteridge-0.2.0/matteridge/api.py +677 -0
  28. matteridge-0.2.0/matteridge/cache.py +155 -0
  29. matteridge-0.2.0/matteridge/config.py +4 -0
  30. matteridge-0.2.0/matteridge/contact.py +341 -0
  31. matteridge-0.2.0/matteridge/events.py +206 -0
  32. matteridge-0.2.0/matteridge/gateway.py +62 -0
  33. matteridge-0.2.0/matteridge/group.py +155 -0
  34. matteridge-0.2.0/matteridge/session.py +437 -0
  35. matteridge-0.2.0/matteridge/util.py +106 -0
  36. matteridge-0.2.0/matteridge/websocket.py +156 -0
  37. matteridge-0.2.0/matteridge.egg-info/PKG-INFO +73 -0
  38. matteridge-0.2.0/matteridge.egg-info/SOURCES.txt +49 -0
  39. matteridge-0.2.0/matteridge.egg-info/dependency_links.txt +1 -0
  40. matteridge-0.2.0/matteridge.egg-info/entry_points.txt +2 -0
  41. matteridge-0.2.0/matteridge.egg-info/requires.txt +4 -0
  42. matteridge-0.2.0/matteridge.egg-info/top_level.txt +1 -0
  43. matteridge-0.2.0/pyproject.toml +125 -0
  44. matteridge-0.2.0/setup.cfg +4 -0
  45. matteridge-0.2.0/tests/conftest.py +161 -0
  46. matteridge-0.2.0/tests/test_api_client.py +122 -0
  47. matteridge-0.2.0/tests/test_base.py +10 -0
  48. matteridge-0.2.0/tests/test_cache.py +32 -0
  49. matteridge-0.2.0/tests/test_mm_events.py +337 -0
  50. matteridge-0.2.0/tests/test_websocket.py +45 -0
  51. matteridge-0.2.0/uv.lock +1549 -0
@@ -0,0 +1,10 @@
1
+ __pycache__
2
+ .mypy_cache
3
+ .pytest_cache
4
+ .ruff_cache
5
+ .idea
6
+ dist
7
+ docs/build
8
+ persistent
9
+ .venv
10
+ matteridge.egg-info
@@ -0,0 +1,39 @@
1
+ default_stages: [pre-commit]
2
+ repos:
3
+ - repo: https://github.com/pre-commit/pre-commit-hooks
4
+ rev: v5.0.0
5
+ hooks:
6
+ - id: trailing-whitespace
7
+ - id: end-of-file-fixer
8
+ - id: check-yaml
9
+ - id: check-added-large-files
10
+ - id: check-merge-conflict
11
+ args: [--assume-in-merge]
12
+
13
+ - repo: https://github.com/astral-sh/uv-pre-commit
14
+ rev: 0.5.21
15
+ hooks:
16
+ - id: uv-lock
17
+
18
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
19
+ rev: v0.9.2
20
+ hooks:
21
+ - id: ruff
22
+ args: [ --fix ]
23
+ - id: ruff-format
24
+
25
+ - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
26
+ rev: v9.20.0
27
+ hooks:
28
+ - id: commitlint
29
+ stages: [commit-msg]
30
+ additional_dependencies: ['@commitlint/config-conventional']
31
+
32
+ - repo: local
33
+ hooks:
34
+ - id: mypy
35
+ name: Static type check with mypy
36
+ entry: .venv/bin/mypy
37
+ language: system
38
+ pass_filenames: false
39
+ files: .*\.py
@@ -0,0 +1,28 @@
1
+ when:
2
+ event: [ cron, manual ]
3
+ cron: lockfile
4
+
5
+ variables:
6
+ - &image codeberg.org/slidge/woodpecker-${CI_REPO_NAME}
7
+
8
+ steps:
9
+ refresh-deps:
10
+ image: *image
11
+ pull: true
12
+ environment:
13
+ CODEBERG_TOKEN:
14
+ from_secret: CODEBERG_TOKEN
15
+ commands:
16
+ - rm uv.lock
17
+ - uv lock --refresh
18
+ - git diff
19
+ - git config --global user.email "c3p0@slidge.im"
20
+ - git config --global user.name "c3p0"
21
+ - |
22
+ if git commit uv.lock -m 'build(lockfile): automatic update'; then
23
+ git remote set-url origin https://$CODEBERG_TOKEN@codeberg.org/${CI_REPO_OWNER}/${CI_REPO_NAME}.git
24
+ git push -u origin main
25
+ echo Pushed lockfile update
26
+ else
27
+ echo Nothing to update, exiting
28
+ fi
@@ -0,0 +1,27 @@
1
+ # Generate build caches for containers used by the legacy modules and the CI images
2
+
3
+ # We cannot do it directly in the container workflow, because buildx does not "magically"
4
+ # merge multi-arch build caches, cf https://github.com/docker/buildx/discussions/1382#discussioncomment-4159926
5
+
6
+ when:
7
+ event: [ manual, cron ]
8
+ cron: container-cache
9
+
10
+ matrix:
11
+ PLATFORM:
12
+ - arm64
13
+ - amd64
14
+
15
+ steps:
16
+ build-cache:
17
+ image: woodpeckerci/plugin-docker-buildx
18
+ settings:
19
+ platforms: linux/${PLATFORM}
20
+ target: ${CI_REPO_NAME}
21
+ cache_images:
22
+ - codeberg.org/${CI_REPO_OWNER}/${CI_REPO_NAME}:buildcache-${PLATFORM}
23
+ registry: codeberg.org
24
+ username: slidge
25
+ password:
26
+ from_secret: CODEBERG_TOKEN
27
+ dry_run: true # we don't want to push the actual image, just the build cache
@@ -0,0 +1,20 @@
1
+ # Build a container with a virtualenv that can be used for tests and to build docs.
2
+
3
+ when:
4
+ event: [ manual, cron ]
5
+ cron: container-ci
6
+
7
+ steps:
8
+ build-and-push:
9
+ image: woodpeckerci/plugin-docker-buildx
10
+ settings:
11
+ platforms: linux/amd64
12
+ repo: codeberg.org/${CI_REPO_OWNER}/woodpecker-${CI_REPO_NAME}
13
+ registry: codeberg.org
14
+ auto_tag: true
15
+ target: woodpecker-${CI_REPO_NAME}
16
+ username: ${CI_REPO_OWNER}
17
+ password:
18
+ from_secret: CODEBERG_TOKEN
19
+ cache_images:
20
+ - codeberg.org/${CI_REPO_OWNER}/woodpecker-${CI_REPO_NAME}:buildcache
@@ -0,0 +1,40 @@
1
+ # Build the production container
2
+
3
+ variables:
4
+ - &settings
5
+ registry: codeberg.org
6
+ tags_file: .tags
7
+ target: ${CI_REPO_NAME}
8
+ platforms: linux/amd64,linux/arm64
9
+ # Unfortunately we can only a single build cache image,
10
+ # cf https://codeberg.org/woodpecker-plugins/docker-buildx/pulls/186
11
+ # since codeberg CI is amd64-only let's use the cache for the arm64 platform…
12
+ cache_from: type=registry,ref=codeberg.org/${CI_REPO_OWNER}/${CI_REPO_NAME}:buildcache-arm64
13
+
14
+ when:
15
+ event: [ push, pull_request, tag ]
16
+ path: [ "${CI_REPO_NAME}/**/*", pyproject.toml, uv.lock, Dockerfile ]
17
+
18
+ steps:
19
+ version:
20
+ image: codeberg.org/slidge/woodpecker-version
21
+ pull: true
22
+
23
+ build:
24
+ image: woodpeckerci/plugin-docker-buildx
25
+ settings:
26
+ dry_run: true
27
+ <<: *settings
28
+ when:
29
+ event: pull_request
30
+
31
+ build-and-push:
32
+ image: woodpeckerci/plugin-docker-buildx
33
+ settings:
34
+ repo: codeberg.org/${CI_REPO_OWNER}/${CI_REPO_NAME}
35
+ username: ${CI_REPO_OWNER}
36
+ password:
37
+ from_secret: CODEBERG_TOKEN
38
+ <<: *settings
39
+ when:
40
+ event: [push, tag]
@@ -0,0 +1,24 @@
1
+ when:
2
+ event: [ push, tag, pull_request ]
3
+ path: [ "${CI_REPO_NAME}/**/*.py", "superduper/**/*.py", "docs/**/*" ]
4
+
5
+ steps:
6
+ build:
7
+ image: codeberg.org/slidge/woodpecker-${CI_REPO_NAME}
8
+ pull: true
9
+ commands:
10
+ # the first 2 commands update the virtualenv, which is a no-op unless uv.lock has been modified
11
+ - uv export > req.txt
12
+ - uv pip install --requirements req.txt
13
+ - uv pip install .
14
+ - cd docs
15
+ - make html
16
+
17
+ publish:
18
+ image: codeberg.org/slidge/woodpecker-publish-pages
19
+ pull: true
20
+ when:
21
+ event: [ push, tag ]
22
+ settings:
23
+ token:
24
+ from_secret: CODEBERG_TOKEN
@@ -0,0 +1,53 @@
1
+ when:
2
+ event: [ push, tag, pull_request ]
3
+ path: [ "${CI_REPO_NAME}/**/*", "pyproject.toml", "uv.lock", "README.md" ]
4
+
5
+ variables:
6
+ - &image codeberg.org/slidge/woodpecker-${CI_REPO_NAME}
7
+ - &only-main-tag
8
+ when:
9
+ branch: main
10
+ event: tag
11
+
12
+ steps:
13
+ version:
14
+ image: codeberg.org/slidge/woodpecker-version
15
+ pull: true
16
+
17
+ changelog:
18
+ image: codeberg.org/slidge/woodpecker-generate-changelog
19
+ pull: true
20
+
21
+ build:
22
+ image: *image
23
+ commands:
24
+ - uv build
25
+
26
+ codeberg-pypi:
27
+ when:
28
+ event: [ push, tag ]
29
+ image: *image
30
+ environment:
31
+ CODEBERG_TOKEN:
32
+ from_secret: CODEBERG_TOKEN
33
+ commands:
34
+ - uv publish --index codeberg --token $CODEBERG_TOKEN
35
+
36
+ pypi:
37
+ image: *image
38
+ <<: *only-main-tag
39
+ environment:
40
+ PYPI_TOKEN:
41
+ from_secret: PYPI_TOKEN
42
+ commands:
43
+ - uv publish --token $PYPI_TOKEN
44
+
45
+ codeberg-release:
46
+ image: woodpeckerci/plugin-release
47
+ <<: *only-main-tag
48
+ settings:
49
+ files:
50
+ - dist/${CI_REPO_NAME}*
51
+ api_key:
52
+ from_secret: CODEBERG_TOKEN
53
+ note: CHANGELOG
@@ -0,0 +1,33 @@
1
+ when:
2
+ event: [ push, pull_request ]
3
+ path: [ pyproject.toml, uv.lock, "**/*.py" ]
4
+
5
+ variables:
6
+ - &image codeberg.org/slidge/woodpecker-${CI_REPO_NAME}
7
+
8
+ steps:
9
+ update-venv:
10
+ image: *image
11
+ pull: true
12
+ commands:
13
+ - cp -r /venv .venv
14
+ - uv venv --allow-existing .venv
15
+ - uv export > req.txt
16
+ - uv pip install --requirements req.txt --link-mode=copy
17
+
18
+ ruff:
19
+ image: *image
20
+ commands:
21
+ - ruff check
22
+ - ruff format
23
+
24
+ mypy:
25
+ image: *image
26
+ commands:
27
+ - mypy
28
+
29
+ test:
30
+ image: *image
31
+ # TODO: set up mattermost service for testing
32
+ commands:
33
+ - python -m pytest tests --ignore tests/test_websocket* --ignore tests/test_api_client*
@@ -0,0 +1,24 @@
1
+ # install dependencies
2
+ FROM codeberg.org/slidge/slidge-builder AS builder
3
+
4
+ COPY uv.lock pyproject.toml /build/
5
+ RUN uv export --no-dev > requirements.txt
6
+ RUN uv venv /venv/
7
+ RUN uv pip install --requirement requirements.txt
8
+
9
+ # ci container
10
+ FROM builder AS woodpecker-matteridge
11
+ # In CI we copy /venv to .venv, then update it for the whole workflow.
12
+ ENV PATH=".venv/bin:$PATH"
13
+ RUN uv export > requirements.txt
14
+ RUN uv pip install --requirement requirements.txt
15
+
16
+ # main container
17
+ FROM codeberg.org/slidge/slidge-base AS matteridge
18
+ COPY --from=builder /venv /venv
19
+ COPY ./matteridge /venv/lib/python/site-packages/legacy_module
20
+
21
+ # dev container
22
+ FROM codeberg.org/slidge/slidge-dev AS dev
23
+
24
+ COPY --from=builder /venv /venv