-
Notifications
You must be signed in to change notification settings - Fork 0
attempts to fix integration test #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
9824f9f
1eb1a10
c6e4b68
27bf584
a9e47fa
2a99d03
a393bdc
2b28873
550e7cc
3692a99
f34a1ec
a749a53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/bin/bash | ||
|
|
||
| if [ -f .venv/bin/activate ]; then | ||
| source .venv/bin/activate | ||
| fi | ||
|
|
||
| if [ -f .env ]; then | ||
| dotenv .env | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,9 @@ | ||
| [flake8] | ||
| max-line-length = 88 | ||
| exclude = .venv, .git, __pycache__, build, dist | ||
| extend-ignore = E203 | ||
|
|
||
| [flake8:local-plugins] | ||
| # Flake8 doesn't support per-directory line length natively in the config file | ||
| # without plugins, but we can use the --max-line-length flag in the Makefile | ||
| # or just keep this here for general use. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -214,3 +214,5 @@ __marimo__/ | |
|
|
||
| # Streamlit | ||
| .streamlit/secrets.toml | ||
| config.json | ||
| _version.py | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "overrides": [ | ||
| { | ||
| "files": ["*.json", ".prettierrc"], | ||
| "options": { | ||
| "tabWidth": 4, | ||
| "useTabs": false | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,59 +23,98 @@ If you want to run this constantly in the background as a Linux service, indepen | |
| git clone https://github.com/user/matrix-premid | ||
| cd matrix-premid | ||
|
|
||
| 2. Configure your credentials locally (or edit later): | ||
| 2. Install the script, systemd user service, and dependencies globally to ``/opt``: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| cp .env.example .env | ||
| nano .env | ||
| make install | ||
|
|
||
| This creates the directory ``/opt/matrix-premid``, sets up an isolated Python virtual environment exclusively for the service, symlinks the script to ``/usr/local/bin/matrix-premid``, and automatically initializes a systemd user service and config template for your user account. | ||
|
|
||
| *(Note: If you populate the ``.env`` file locally before installing, the installer will automatically copy and use it for the background service.)* | ||
| 3. Edit your configuration file at ``~/.config/matrix-premid/config.json`` to add your homeserver and username. | ||
|
|
||
| 3. Install the script, systemd service, and dependencies globally to ``/opt``: | ||
| 4. Store your Matrix access token in the system keyring: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| make install | ||
| python -m keyring set matrix-premid @username:domain.com | ||
|
|
||
| User Installation | ||
| ----------------- | ||
|
|
||
| Alternatively, you can install the package to your user site-packages: | ||
|
|
||
| This creates the directory ``/opt/matrix-premid``, copies the script and ``.env`` there, sets up an isolated Python virtual environment exclusively for the service, and symlinks the script to ``/usr/local/bin/matrix_premid``. The systemd service is placed in ``/etc/systemd/system/``. | ||
| .. code-block:: bash | ||
|
|
||
| pip install --user . | ||
|
|
||
| This will install the ``matrix-premid`` command to your ``~/.local/bin`` (make sure ``~/.local/bin`` is on your ``PATH``). | ||
|
|
||
| 4. (Optional) Edit credentials after installation: | ||
| Basic Usage | ||
| ----------- | ||
|
|
||
| 1. **Install dependencies**: ``pip install .`` (or use installation methods above). | ||
| 2. **Setup configuration**: Create your configuration file at ``~/.config/matrix-premid/config.json``. You can use ``matrix-premid install-service`` to generate a default template, or copy ``config.template.json`` from this repository to that location. | ||
| 3. **Store credentials**: For security, store your Matrix access token in your system keyring rather than putting it in plain text inside the config file: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| sudo nano /opt/matrix-premid/.env | ||
| sudo systemctl restart matrix-premid.service | ||
| python -m keyring set matrix-premid @username:domain.com | ||
|
|
||
| *(Alternatively, for non-interactive setups like CI, you can set the ``access_token`` directly in the ``accounts`` section of ``config.json``).* | ||
|
|
||
| 5. Start and enable the background service: | ||
| 4. **Run the script**: ``matrix-premid`` | ||
|
|
||
|
Comment on lines
+56
to
67
|
||
| Command-line Options | ||
| -------------------- | ||
|
|
||
| * ``--unset`` or ``--clear``: Manually set Matrix presence to ``offline``, clear the status message/account data, and exit. | ||
| * ``--debug``: Enable verbose debug logging. | ||
| * ``--help``: Show all available options. | ||
|
|
||
| Shell Completion | ||
| ---------------- | ||
|
|
||
| This script supports bash/zsh completion via ``argcomplete``. To enable it: | ||
|
|
||
| 1. Install ``argcomplete`` (included in requirements). | ||
| 2. Register the script: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| sudo systemctl daemon-reload | ||
| sudo systemctl enable --now matrix-premid.service | ||
| eval "$(register-python-argcomplete matrix-premid)" | ||
|
|
||
| (Add this to your ``.bashrc`` or ``.zshrc`` for persistence). | ||
|
|
||
| Development / Local Running | ||
| --------------------------- | ||
|
|
||
| If you want to run the script locally from the folder (for testing or development) without installing it system-wide: | ||
|
|
||
| 1. Clone the repository and configure your environment: | ||
| 1. Clone the repository and configure your configuration: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| git clone https://github.com/user/matrix-premid | ||
| cd matrix-premid | ||
| cp .env.example .env | ||
| mkdir -p ~/.config/matrix-premid | ||
| cp config.template.json ~/.config/matrix-premid/config.json | ||
|
|
||
| Edit the ``~/.config/matrix-premid/config.json`` file to set your Matrix username and homeserver. | ||
|
|
||
| 2. Store your Matrix access token in the system keyring: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| Edit the ``.env`` file and fill in your Matrix credentials. Make sure to export them to your shell (e.g., using ``direnv allow`` or sourcing the file) because the script reads directly from ``os.environ``. | ||
| python -m keyring set matrix-premid @your_username:homeserver.com | ||
|
|
||
| 2. Install development dependencies: | ||
| 3. Install development dependencies: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| make deps | ||
|
|
||
| 3. Run the script directly: | ||
| 4. Run the script directly: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.