slidcord 0.3.1__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 (56) hide show
  1. slidcord-0.3.1/.copier-answers.yml +16 -0
  2. slidcord-0.3.1/.gitignore +11 -0
  3. slidcord-0.3.1/.pre-commit-config.yaml +48 -0
  4. slidcord-0.3.1/.woodpecker/container.yaml +102 -0
  5. slidcord-0.3.1/.woodpecker/docs.yaml +23 -0
  6. slidcord-0.3.1/.woodpecker/package.yaml +62 -0
  7. slidcord-0.3.1/.woodpecker/test.yaml +35 -0
  8. slidcord-0.3.1/CONTRIBUTING.md +100 -0
  9. slidcord-0.3.1/Dockerfile +92 -0
  10. slidcord-0.3.1/LICENSE +661 -0
  11. slidcord-0.3.1/PKG-INFO +70 -0
  12. slidcord-0.3.1/README.md +48 -0
  13. slidcord-0.3.1/commitlint.config.js +34 -0
  14. slidcord-0.3.1/doap.xml +125 -0
  15. slidcord-0.3.1/docker-compose.yml +23 -0
  16. slidcord-0.3.1/docs/Makefile +20 -0
  17. slidcord-0.3.1/docs/source/admin/attachments.rst +153 -0
  18. slidcord-0.3.1/docs/source/admin/config.rst +75 -0
  19. slidcord-0.3.1/docs/source/admin/examples/ejabberd.yaml +58 -0
  20. slidcord-0.3.1/docs/source/admin/examples/index.rst +42 -0
  21. slidcord-0.3.1/docs/source/admin/examples/prosody-noupload.cfg.lua +33 -0
  22. slidcord-0.3.1/docs/source/admin/examples/prosody-upload.cfg.lua +38 -0
  23. slidcord-0.3.1/docs/source/admin/index.rst +25 -0
  24. slidcord-0.3.1/docs/source/admin/install-custom.rst +0 -0
  25. slidcord-0.3.1/docs/source/admin/install.rst +69 -0
  26. slidcord-0.3.1/docs/source/admin/privileges.rst +104 -0
  27. slidcord-0.3.1/docs/source/admin/quickstart.rst +71 -0
  28. slidcord-0.3.1/docs/source/codeberg.svg +17 -0
  29. slidcord-0.3.1/docs/source/conf.py +52 -0
  30. slidcord-0.3.1/docs/source/contributing.rst +1 -0
  31. slidcord-0.3.1/docs/source/index.rst +36 -0
  32. slidcord-0.3.1/docs/source/user/features.rst +15 -0
  33. slidcord-0.3.1/docs/source/user/index.rst +19 -0
  34. slidcord-0.3.1/docs/source/user/registration.rst +29 -0
  35. slidcord-0.3.1/docs/source/user/usage.rst +14 -0
  36. slidcord-0.3.1/pyproject.toml +149 -0
  37. slidcord-0.3.1/setup.cfg +4 -0
  38. slidcord-0.3.1/slidcord/__init__.py +35 -0
  39. slidcord-0.3.1/slidcord/__main__.py +6 -0
  40. slidcord-0.3.1/slidcord/client.py +232 -0
  41. slidcord-0.3.1/slidcord/command.py +65 -0
  42. slidcord-0.3.1/slidcord/config.py +24 -0
  43. slidcord-0.3.1/slidcord/contact.py +161 -0
  44. slidcord-0.3.1/slidcord/gateway.py +45 -0
  45. slidcord-0.3.1/slidcord/group.py +297 -0
  46. slidcord-0.3.1/slidcord/session.py +288 -0
  47. slidcord-0.3.1/slidcord/util.py +341 -0
  48. slidcord-0.3.1/slidcord.egg-info/PKG-INFO +70 -0
  49. slidcord-0.3.1/slidcord.egg-info/SOURCES.txt +54 -0
  50. slidcord-0.3.1/slidcord.egg-info/dependency_links.txt +1 -0
  51. slidcord-0.3.1/slidcord.egg-info/entry_points.txt +2 -0
  52. slidcord-0.3.1/slidcord.egg-info/requires.txt +3 -0
  53. slidcord-0.3.1/slidcord.egg-info/top_level.txt +1 -0
  54. slidcord-0.3.1/tests/__init__.py +0 -0
  55. slidcord-0.3.1/tests/test_base.py +10 -0
  56. slidcord-0.3.1/uv.lock +2193 -0
@@ -0,0 +1,16 @@
1
+ # Do not edit manually!
2
+ # Changes here will be overwritten by copier.
3
+ # https://copier.readthedocs.io/
4
+ _commit: 4d7f077
5
+ _src_path: git+https://codeberg.org/slidge/legacy-module-template
6
+ debian_bundle: true
7
+ native_build: false
8
+ project_name: slidcord
9
+ repology: ''
10
+ silo:
11
+ hostile: true
12
+ lib:
13
+ name: discord.py-self
14
+ url: https://discordpy-self.readthedocs.io
15
+ name: Discord
16
+ url: https://discord.com/
@@ -0,0 +1,11 @@
1
+ __pycache__
2
+ .mypy_cache
3
+ .pytest_cache
4
+ .ruff_cache
5
+ .idea
6
+ dist
7
+ docs/build
8
+ persistent
9
+ .venv
10
+ slidcord.egg-info
11
+ build
@@ -0,0 +1,48 @@
1
+ # DO NOT EDIT
2
+ # This file is automatically generated with copier using https://codeberg.org/slidge/legacy-module-template
3
+
4
+ default_stages: [pre-commit]
5
+ repos:
6
+ - repo: https://github.com/pre-commit/pre-commit-hooks
7
+ rev: v5.0.0
8
+ hooks:
9
+ - id: trailing-whitespace
10
+ - id: end-of-file-fixer
11
+ - id: check-yaml
12
+ - id: check-added-large-files
13
+ - id: check-merge-conflict
14
+ args: [--assume-in-merge]
15
+
16
+ - repo: https://github.com/astral-sh/uv-pre-commit
17
+ rev: 0.5.21
18
+ hooks:
19
+ - id: uv-lock
20
+
21
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
22
+ rev: v0.9.2
23
+ hooks:
24
+ - id: ruff
25
+ args: [ --fix ]
26
+ - id: ruff-format
27
+
28
+ - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
29
+ rev: v9.20.0
30
+ hooks:
31
+ - id: commitlint
32
+ stages: [commit-msg]
33
+ additional_dependencies: ['@commitlint/config-conventional']
34
+
35
+ - repo: local
36
+ hooks:
37
+ - id: mypy
38
+ name: Static type check with mypy
39
+ entry: .venv/bin/mypy
40
+ language: system
41
+ pass_filenames: false
42
+ files: .*\.py
43
+ - id: pytest-check
44
+ name: pytest-check
45
+ entry: .venv/bin/pytest tests
46
+ language: system
47
+ pass_filenames: false
48
+ always_run: true
@@ -0,0 +1,102 @@
1
+ # DO NOT EDIT
2
+ # Generated from .copier-answers.yml
3
+
4
+
5
+ labels:
6
+ platform: linux/amd64
7
+
8
+ clone:
9
+ - name: clone-deep
10
+ image: woodpeckerci/plugin-git
11
+ settings:
12
+ tags: true
13
+ partial: false
14
+
15
+ variables:
16
+ - &settings
17
+ repo: codeberg.org/${CI_REPO_OWNER}/slidcord
18
+ username: ${CI_REPO_OWNER}
19
+ password:
20
+ from_secret: CODEBERG_TOKEN
21
+ registry: codeberg.org
22
+ target: slidcord
23
+ # this only caches one of the two platforms unfortunately
24
+ # https://github.com/docker/buildx/discussions/1382
25
+ # https://github.com/docker/buildx/issues/1044
26
+ cache_images:
27
+ - codeberg.org/${CI_REPO_OWNER}/slidcord:buildcache
28
+ platforms: linux/amd64,linux/arm64
29
+ - &paths
30
+ - "slidcord/**"
31
+ - Dockerfile
32
+ - pyproject.toml
33
+ - .woodpecker/container.yaml
34
+
35
+ when:
36
+ - event: tag
37
+ - event: push
38
+ path: *paths
39
+ - event: cron
40
+ cron: container-main
41
+ - event: cron
42
+ cron: container-latest
43
+
44
+ steps:
45
+ build-tag:
46
+ image: woodpeckerci/plugin-docker-buildx:6.0.2
47
+ when:
48
+ event: [tag]
49
+ settings:
50
+ <<: *settings
51
+ build_args:
52
+ SLIDGE_USE_LOCKFILE: "1"
53
+ tags:
54
+ - latest
55
+ - ${CI_COMMIT_TAG}
56
+
57
+ build-branch:
58
+ when:
59
+ - event: push
60
+ path: *paths
61
+ - event: cron
62
+ cron: container-main
63
+ image: woodpeckerci/plugin-docker-buildx:6.0.2
64
+ settings:
65
+ <<: *settings
66
+ build_args:
67
+ SLIDGE_PRERELEASE: "1"
68
+ tags:
69
+ - ${CI_COMMIT_BRANCH}
70
+
71
+ build-ci:
72
+ when:
73
+ path: *paths
74
+ branch: ${CI_REPO_DEFAULT_BRANCH}
75
+ image: woodpeckerci/plugin-docker-buildx:6.0.2
76
+ settings:
77
+ <<: *settings
78
+ build_args:
79
+ SLIDGE_USE_LOCKFILE: "1"
80
+ target: ci
81
+ tag: ci
82
+ cache_images:
83
+ - codeberg.org/${CI_REPO_OWNER}/slidcord:buildcache-ci
84
+
85
+ checkout-latest-tag:
86
+ image: woodpeckerci/plugin-git
87
+ when:
88
+ - event: cron
89
+ cron: container-latest
90
+ commands:
91
+ - export TAG=$(git describe --tags --abbrev=0)
92
+ - git checkout $TAG
93
+ - git reset --hard
94
+ - echo latest > .tags
95
+
96
+ rebuild-tag:
97
+ image: woodpeckerci/plugin-docker-buildx:6.0.2
98
+ when:
99
+ - event: cron
100
+ cron: container-latest
101
+ settings:
102
+ <<: *settings
@@ -0,0 +1,23 @@
1
+ # DO NOT EDIT
2
+ # Generated from .copier-answers.yml
3
+
4
+ when:
5
+ event: [push, tag, pull_request]
6
+ path: ["slidcord/**/*.py", "docs/**/*", "uv.lock", ".woodpecker/docs.yaml"]
7
+
8
+ steps:
9
+ build:
10
+ image: codeberg.org/${CI_REPO_OWNER}/slidcord:ci
11
+ pull: true
12
+ commands:
13
+ - uv sync --all-groups --all-extras
14
+ - cd docs && make html
15
+
16
+ publish:
17
+ image: codeberg.org/slidge/woodpecker-publish-pages
18
+ pull: true
19
+ when:
20
+ event: [push, tag]
21
+ settings:
22
+ token:
23
+ from_secret: CODEBERG_TOKEN
@@ -0,0 +1,62 @@
1
+ # DO NOT EDIT
2
+ # Generated from .copier-answers.yml
3
+
4
+ when:
5
+ event: [push, tag]
6
+ path: ["slidcord/**/*", "pyproject.toml", "README.md"]
7
+ branch: main
8
+
9
+ variables:
10
+ - &ci-image codeberg.org/${CI_REPO_OWNER}/slidcord:ci
11
+
12
+ clone:
13
+ - name: clone-deep
14
+ image: woodpeckerci/plugin-git
15
+ settings:
16
+ tags: true
17
+ partial: false
18
+
19
+ steps:
20
+ changelog:
21
+ image: codeberg.org/slidge/woodpecker-generate-changelog
22
+ pull: true
23
+
24
+ build:
25
+ image: *ci-image
26
+ pull: true
27
+ commands:
28
+ - uv build
29
+
30
+ codeberg-pypi:
31
+ when:
32
+ event: [push, tag]
33
+ image: *ci-image
34
+ depends_on: build
35
+ environment:
36
+ CODEBERG_TOKEN:
37
+ from_secret: CODEBERG_TOKEN
38
+ commands:
39
+ - uv publish --index codeberg --token $CODEBERG_TOKEN
40
+
41
+ pypi:
42
+ image: *ci-image
43
+ depends_on: build
44
+ when:
45
+ event: tag
46
+ environment:
47
+ PYPI_TOKEN:
48
+ from_secret: PYPI_TOKEN
49
+ commands:
50
+ - uv publish --token $PYPI_TOKEN
51
+
52
+ codeberg-release:
53
+ image: woodpeckerci/plugin-release
54
+ depends_on: [changelog, build]
55
+ when:
56
+ event: tag
57
+ settings:
58
+ files:
59
+ - dist/slidcord*
60
+ api_key:
61
+ from_secret: CODEBERG_TOKEN
62
+ note: CHANGELOG
@@ -0,0 +1,35 @@
1
+ # DO NOT EDIT
2
+ # Generated from .copier-answers.yml
3
+
4
+ when:
5
+ event: [push, pull_request]
6
+ path: [pyproject.toml, uv.lock, "**/*.py", ".woodpecker/test.yaml"]
7
+
8
+ variables:
9
+ - &ci-image codeberg.org/${CI_REPO_OWNER}/slidcord:ci
10
+
11
+ steps:
12
+ update-venv:
13
+ image: *ci-image
14
+ pull: true
15
+ commands:
16
+ - uv sync --all-groups --all-extras
17
+
18
+ ruff:
19
+ image: *ci-image
20
+ depends_on: update-venv
21
+ commands:
22
+ - ruff check
23
+ - ruff format --check
24
+
25
+ mypy:
26
+ image: *ci-image
27
+ depends_on: update-venv
28
+ commands:
29
+ - mypy
30
+
31
+ test:
32
+ image: *ci-image
33
+ depends_on: update-venv
34
+ commands:
35
+ - python -m pytest tests
@@ -0,0 +1,100 @@
1
+ # Contributing
2
+
3
+ We are really happy to welcome new contributors to slidcord!
4
+ Before starting anything, please join [our chat room](xmpp:slidge@conference.nicoco.fr?join)
5
+ to say hi and see if anyone is already working on the bug you want to fix or
6
+ the feature you want to implement.
7
+
8
+ ## Quickstart
9
+
10
+ To start hacking on slidcord, you need to:
11
+
12
+ 1. Clone the repository: `git clone https://codeberg.org/slidge/slidcord`.
13
+ 2. Install the required dependencies. (see below)
14
+ 3. Spin up a development XMPP server for slidcord to connect to. (see below)
15
+
16
+ ### Easy mode: docker-compose
17
+
18
+ The easiest way to achieve 2 and 3 at the same time is to use the provided
19
+ `docker-compose.yml` file. Run ``docker compose up`` (or ``podman-compose up``)
20
+ in the directory of the repository you just cloned. It will:
21
+
22
+ - spin up a [prosody](https://prosody.im) instance configured for development;
23
+ - launch slidcord in a dedicated container, with hot code reload.
24
+
25
+ You will then be able to connect to that prosody using any XMPP client, using
26
+ "test@localhost" as JID and "password" as password. We recommended
27
+ [gajim](https://gajim.org) which lets you start a different profile than your
28
+ main profile: `gajim -p slidge -c ~/.local/share/gajim-slidge`.
29
+
30
+ To avoid having to accept self-signed certificates, you can add prosody's
31
+ certificate to your local store. In debian, you can do that with:
32
+
33
+ ```bash
34
+ # download the certificate
35
+ curl https://codeberg.org/slidge/prosody-dev-container/raw/branch/main/localhost.crt | sudo tee /usr/local/share/ca-certificates/localhost.crt
36
+ # set the right perms
37
+ chmod 600 /usr/local/share/ca-certificates/localhost.crt
38
+ # import it
39
+ sudo update-ca-certificates
40
+ ```
41
+
42
+ ### Slightly harder mode: setting up a virtualenv
43
+
44
+ In some situations, developing in containers is not optimal, for instance if
45
+ you want to attach an interactive debugger to the slidcord process.
46
+
47
+ slidcord defines its dependencies in a [PEP 517](https://peps.python.org/pep-0517/)-compliant
48
+ `pyproject.toml` file. This means that you can use different tools to set up a
49
+ virtualenv with the appropriate dependencies.
50
+
51
+ We recommend using [uv](https://docs.astral.sh/uv/) which is fast and has some
52
+ nice features. By running ``uv sync --frozen --all-groups --all-extras``, a
53
+ standard virtualenv will be installed in `./.venv`. You can then activate it
54
+ with `source .venv/bin/activate` and launch `slidcord --help`.
55
+
56
+ NB: you will need to set up a local XMPP server. An easy way to do that is to
57
+ use the `slidge-prosody-dev` container: `docker run --network host codeberg.org/slidge/prosody-slidge-dev`.
58
+ With it you will be able to launch slidcord with
59
+ ``slidcord --jid slidge.localhost --secret secret --debug --home-dir ./persistent``.
60
+
61
+ ### Hacking on slidge core simultaneously
62
+
63
+ Maybe you will discover that what you want to change, add or fix is not part
64
+ of slidcord but part of slidge core. To modify slidge core, first you
65
+ need to clone [the slidge repo](https://codeberg.org/slidge/slidge) somewhere
66
+ on your computer.
67
+
68
+ Let's assume you cloned `slidge` in the same root dir as `slidcord`,
69
+ e.g., `~/src/slidcord` and `~/src/slidge`.
70
+ With the `docker-compose`-based dev setup, you will need to add an additional
71
+ mount for the slidge dir, e.g., `../slidge:/build/slidge`. If you opted for
72
+ the virtualenv solution, you can install slidge in your virtualenv in editable
73
+ mode with `[uv] pip install -e ../slidge`.
74
+
75
+ ## Guidelines
76
+
77
+ slidcord uses these tools to ensure some level of code quality:
78
+
79
+ - [mypy](https://www.mypy-lang.org/)
80
+ for static type checking,
81
+ - [ruff](https://docs.astral.sh/ruff/)
82
+ to detect common python mistakes and enforce a consistent style,
83
+ - [pytest](https://docs.pytest.org/en/stable/)
84
+ for automated tests.
85
+
86
+ Commit messages should be in the form of
87
+ [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/), with
88
+ some additional types defined in [./commitlinx.config.js](https://codeberg.org/slidge/slidcord/src/branch/main/commitlint.config.js).
89
+ This makes it possible to automatically generate changelogs on releases, it
90
+ is worth it! We use [git-cliff](https://git-cliff.org/) for this. You don't have
91
+ to install git-cliff locally, the magic happens in CI.
92
+
93
+ We recommended setting up [pre-commit](https://pre-commit.com/) to ensure that
94
+ these pass for each commit: `pre-commit install && pre-commit install --hook-type commit-msg`.
95
+
96
+ Make a new git branch, commit your changes, push it to your fork and open a
97
+ pull request!
98
+
99
+ NB: we also accept contributions without pull requests. Just push your changes
100
+ somewhere and tell us where to pull via the group chat.
@@ -0,0 +1,92 @@
1
+ ARG PYTHONVERSION=3.13
2
+ ARG DEBIANVERSION=trixie
3
+
4
+ # Builder
5
+ # *******
6
+ FROM ghcr.io/astral-sh/uv:python$PYTHONVERSION-$DEBIANVERSION-slim AS builder
7
+
8
+ # install git for setuptools scm
9
+ RUN apt-get update -y && \
10
+ apt-get install \
11
+ git \
12
+ make \
13
+ -y --no-install-recommends && \
14
+ rm -rf /var/lib/apt/lists/*
15
+ WORKDIR /build
16
+ ENV UV_PROJECT_ENVIRONMENT=/venv
17
+ ENV PATH="/venv/bin:/root/.cargo/bin:$PATH"
18
+ RUN uv venv $UV_PROJECT_ENVIRONMENT
19
+ COPY pyproject.toml uv.lock README.md .
20
+ COPY slidcord slidcord
21
+ ARG SLIDGE_USE_LOCKFILE=
22
+ RUN [ -z "$SLIDGE_USE_LOCKFILE" ] && rm uv.lock || true
23
+ # install dependencies in /venv
24
+ # .git/ needs to be mounted for setuptools-scm to set the version
25
+ RUN --mount=source=.git,target=/build/.git,type=bind \
26
+ uv sync --no-dev
27
+ ARG SLIDGE_PRERELEASE
28
+ RUN [ ! -z "$SLIDGE_PRERELEASE" ] && uv pip install slidge --upgrade --prerelease allow || true
29
+
30
+ # CI container
31
+ # ************
32
+ FROM builder AS ci
33
+
34
+ # We won't use this venv in CI, but this populates the uv cache in the container,
35
+ # minimizing (or even nulling) downloads.
36
+ RUN --mount=source=.git,target=/build/.git,type=bind \
37
+ uv sync --all-groups --no-install-project
38
+ ENV UV_PROJECT_ENVIRONMENT="/woodpecker/src/codeberg.org/slidge/slidcord/.venv"
39
+ ENV UV_LINK_MODE=copy
40
+ ENV PATH="$UV_PROJECT_ENVIRONMENT/bin:$PATH"
41
+
42
+ # Dev container
43
+ # *************
44
+ FROM builder AS dev
45
+
46
+ # copy "localhost" certs from the prosody slidge dev container, so
47
+ COPY --from=codeberg.org/slidge/prosody-slidge-dev:latest \
48
+ /etc/prosody/certs/localhost.crt \
49
+ /usr/local/share/ca-certificates/
50
+ RUN update-ca-certificates
51
+ RUN apt-get update -y \
52
+ && apt-get install -y --no-install-recommends \
53
+ libmagic1 \
54
+ media-types \
55
+ shared-mime-info \
56
+ && rm -rf /var/lib/apt/lists/*
57
+ RUN uv pip install watchdog[watchmedo]
58
+ COPY --from=ci /venv /venv
59
+ ENTRYPOINT ["watchmedo", "auto-restart", \
60
+ "--pattern", "*.py", \
61
+ "--directory", "/build/slidcord", \
62
+ "--recursive", \
63
+ "slidcord", "--", \
64
+ "--jid", "slidge.localhost", \
65
+ "--secret", "secret", \
66
+ "--debug", \
67
+ "--upload-service", "upload.localhost", \
68
+ "--admins", "test@localhost", \
69
+ "--dev-mode"]
70
+
71
+ # Prod container
72
+ # **************
73
+ FROM docker.io/python:$PYTHONVERSION-slim-$DEBIANVERSION AS slidcord
74
+ ARG PYTHONVERSION
75
+ ENV PYTHONUNBUFFERED=1
76
+ ENV PATH="/venv/bin:$PATH"
77
+ STOPSIGNAL SIGINT
78
+ WORKDIR /var/lib/slidge
79
+ # libmagic1: to guess mime type from files
80
+ # media-types: to determine file name suffix based on file type
81
+ RUN apt-get update -y \
82
+ && apt-get install -y --no-install-recommends \
83
+ libmagic1 \
84
+ media-types \
85
+ shared-mime-info \
86
+ && rm -rf /var/lib/apt/lists/*
87
+ RUN addgroup --system --gid 10000 slidge
88
+ RUN adduser --system --uid 10000 --ingroup slidge --home /var/lib/slidge slidge
89
+ USER slidge
90
+ COPY --from=builder /venv /venv
91
+ COPY --from=builder /build/slidcord /venv/lib/python$PYTHONVERSION/site-packages/slidcord
92
+ ENTRYPOINT ["slidcord"]