24 Commits

Author SHA1 Message Date
70207c98a0 fix replaybuffer docstring
patch bump
2026-03-28 22:22:07 +00:00
65b4142692 remove fail-on-missing, it's breaking the publish workflow. 2026-03-28 22:09:48 +00:00
9e4071aace scope hatch-dotenv to hatch-test env 2026-03-28 21:55:05 +00:00
ba61f7d9a1 bump deps
patch bump
2026-03-28 21:43:54 +00:00
6a02a4fc86 add obsws-python as local path dep
regen gitignore
2026-03-27 14:12:27 +00:00
0c5e1085cc add pre-commit config 2026-03-21 14:28:05 +00:00
22cf1c817f closes #6 2026-02-26 20:29:11 +00:00
da69702a18 temporary fix for hatch build, see https://github.com/pypa/hatch/issues/2193 2026-02-26 14:44:47 +00:00
9b0d20effd upd hatch badge 2026-02-22 11:37:03 +00:00
998e72f43e upd set_logging for improved readability 2026-02-09 10:32:13 +00:00
71d4a81855 upd skip group test env var 2026-02-09 01:55:43 +00:00
e8f0764a50 upd README 2026-02-09 01:50:41 +00:00
d88a0b62ad use hatch-dotenv plugin to load env vars for tests
fail fast if .test.env is not found
2026-02-09 01:50:34 +00:00
7f3d47e7b0 use getLevelNamesMapping() to get loglevel names 2026-02-09 01:49:49 +00:00
fb19a67e64 Merge pull request #5 from onyx-and-iris/dependabot/github_actions/actions/setup-python-6
Bump actions/setup-python from 4 to 6
2026-02-09 00:56:48 +00:00
383df9d4e4 Merge pull request #4 from onyx-and-iris/dependabot/github_actions/actions/checkout-6
Bump actions/checkout from 4 to 6
2026-02-09 00:56:36 +00:00
dependabot[bot]
8116deed27 Bump actions/setup-python from 4 to 6
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-09 00:53:51 +00:00
dependabot[bot]
ae57f0dbc3 Bump actions/checkout from 4 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-09 00:53:47 +00:00
55e4769f32 Configure Dependabot for GitHub Actions and pip
Added support for GitHub Actions and pip updates with a weekly schedule.
2026-02-09 00:53:09 +00:00
35be262b2a patch bump 2026-02-07 08:32:58 +00:00
58907fe2b5 add 0.24.8 to CHANGELOG 2026-02-07 08:32:34 +00:00
1a05a89042 update README 2026-02-07 08:32:26 +00:00
13a2443d48 remove --debug flag, replace it with --loglevel 2026-02-07 08:32:17 +00:00
45479563a0 upd shell completions 2026-02-07 05:25:22 +00:00
14 changed files with 132 additions and 42 deletions

20
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"

View File

@@ -19,10 +19,10 @@ jobs:
id-token: write id-token: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v6
with: with:
python-version: '3.11' python-version: '3.11'
cache: 'pip' cache: 'pip'

View File

@@ -13,7 +13,7 @@ jobs:
ruff: ruff:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: astral-sh/ruff-action@v3 - uses: astral-sh/ruff-action@v3
with: with:
args: 'format --check --diff' args: 'format --check --diff'

68
.gitignore vendored
View File

@@ -1,9 +1,9 @@
# Auto-generated .gitignore by gignore: github.com/onyx-and-iris/gignore # Generated by ignr: github.com/onyx-and-iris/ignr
### Python ### ## Python ##
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[codz]
*$py.class *$py.class
# C extensions # C extensions
@@ -49,7 +49,7 @@ htmlcov/
nosetests.xml nosetests.xml
coverage.xml coverage.xml
*.cover *.cover
*.py,cover *.py.cover
.hypothesis/ .hypothesis/
.pytest_cache/ .pytest_cache/
cover/ cover/
@@ -97,20 +97,35 @@ ipython_config.py
# install all needed dependencies. # install all needed dependencies.
#Pipfile.lock #Pipfile.lock
# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock
# poetry # poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more # This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries. # commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock #poetry.lock
#poetry.toml
# pdm # pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
#pdm.lock #pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it #pdm.toml
# in version control. .pdm-python
# https://pdm.fming.dev/#use-with-ide .pdm-build/
.pdm.toml
# pixi
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
#pixi.lock
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
# in the .venv directory. It is recommended not to include this directory in version control.
.pixi
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/ __pypackages__/
@@ -124,13 +139,13 @@ celerybeat.pid
# Environments # Environments
.env .env
.envrc
.venv .venv
env/ env/
venv/ venv/
ENV/ ENV/
env.bak/ env.bak/
venv.bak/ venv.bak/
.hatch
.test.env .test.env
# Spyder project settings # Spyder project settings
@@ -164,17 +179,38 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
### Python Patch ### # Abstra
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration # Abstra is an AI-powered process automation framework.
poetry.toml # Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/
# ruff # Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/
# Ruff stuff:
.ruff_cache/ .ruff_cache/
# LSP config files # PyPI configuration file
pyrightconfig.json .pypirc
# End of gignore: github.com/onyx-and-iris/gignore # Cursor
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
# refer to https://docs.cursor.com/context/ignore-files
.cursorignore
.cursorindexingignore
# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/
# End of ignr
man/*.1 man/*.1
test-*.py test-*.py

7
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

View File

@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# [0.24.8] - 2026-02-07
### Changed
- --debug flag removed and replaced with --loglevel. See [Flags](https://github.com/onyx-and-iris/obsws-cli/tree/main?tab=readme-ov-file#flags). This gives the user more control over the level of logging. The default level has been set to WARNING.
### Fixed
- shell completion now works, see [Shell Completion](https://github.com/onyx-and-iris/obsws-cli/tree/main?tab=readme-ov-file#shell-completion). Unfortunately, command aliases in the help output are no longer present as it was breaking shell completion. However, the aliases do still work. See [issue #3](https://github.com/onyx-and-iris/obsws-cli/issues/3)
# [0.24.6] - 2026-01-26 # [0.24.6] - 2026-01-26
### Changed ### Changed

View File

@@ -1,6 +1,6 @@
# obsws-cli # obsws-cli
[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![Hatch project](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pypa/hatch/master/docs/assets/badge/v0.json)](https://github.com/pypa/hatch)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
@@ -49,6 +49,8 @@ The CLI should now be discoverable as `obsws-cli`
- --password/-p: Websocket password - --password/-p: Websocket password
- --timeout/-T: Websocket timeout - --timeout/-T: Websocket timeout
- --version/-v: Print the obsws-cli version - --version/-v: Print the obsws-cli version
- --loglevel/-l: Set the application's logging level
- One of *NOTSET, DEBUG, INFO, WARN, WARNING, ERROR, CRITICAL, FATAL*
Pass `--host`, `--port` and `--password` as flags on the root command, for example: Pass `--host`, `--port` and `--password` as flags on the root command, for example:
@@ -66,6 +68,7 @@ Store and load environment variables from:
OBSWS_CLI_HOST=localhost OBSWS_CLI_HOST=localhost
OBSWS_CLI_PORT=4455 OBSWS_CLI_PORT=4455
OBSWS_CLI_PASSWORD=<websocket password> OBSWS_CLI_PASSWORD=<websocket password>
OBSWS_CLI_LOGLEVEL=DEBUG
``` ```
Flags can be used to override environment variables. Flags can be used to override environment variables.
@@ -821,6 +824,8 @@ obsws-cli media restart "Media"
obsws-cli --install-completion obsws-cli --install-completion
``` ```
Currently supported shells: *bash* *zsh* *fish* *powershell*
## License ## License

View File

@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online> # SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
__version__ = '0.24.7' __version__ = '0.24.10'

View File

@@ -28,11 +28,21 @@ def version_callback(value: bool):
raise typer.Exit() raise typer.Exit()
def setup_logging(debug: bool): def setup_logging(loglevel: str):
"""Set up logging for the application.""" """Set up logging for the application."""
log_level = logging.DEBUG if debug else logging.CRITICAL level_map = logging.getLevelNamesMapping()
try:
level_int = level_map[loglevel.upper()]
except KeyError:
possible_levels = ', '.join(
sorted(level_map.keys(), key=lambda k: level_map[k])
)
raise typer.BadParameter(
f'Invalid log level: {loglevel}. Valid options are: {possible_levels}'
) from None
logging.basicConfig( logging.basicConfig(
level=log_level, level=level_int,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
) )
@@ -121,19 +131,18 @@ def main(
callback=version_callback, callback=version_callback,
), ),
] = False, ] = False,
debug: Annotated[ loglevel: Annotated[
bool, str,
typer.Option( typer.Option(
'--debug', '--loglevel',
'-d', '-l',
envvar='OBSWS_CLI_DEBUG', envvar='OBSWS_CLI_LOGLEVEL',
is_eager=True, is_eager=True,
help='Enable debug logging', help='Set the logging level',
show_default=False, show_default=False,
callback=setup_logging, callback=setup_logging,
hidden=True,
), ),
] = envconfig.get('debug'), ] = envconfig.get('loglevel'),
): ):
"""obsws_cli is a command line interface for the OBS WebSocket API.""" """obsws_cli is a command line interface for the OBS WebSocket API."""
ctx.ensure_object(dict) ctx.ensure_object(dict)

View File

@@ -9,7 +9,7 @@ app = typer.Typer()
@app.callback() @app.callback()
def main(): def main():
"""Control profiles in OBS.""" """Control the replay buffer in OBS."""
@app.command('start') @app.command('start')

View File

@@ -124,7 +124,7 @@ _envconfig = EnvConfig(
OBSWS_CLI_PORT=4455, OBSWS_CLI_PORT=4455,
OBSWS_CLI_PASSWORD='', OBSWS_CLI_PASSWORD='',
OBSWS_CLI_TIMEOUT=5, OBSWS_CLI_TIMEOUT=5,
OBSWS_CLI_DEBUG=False, OBSWS_CLI_LOGLEVEL='WARNING',
OBSWS_CLI_STYLE='disabled', OBSWS_CLI_STYLE='disabled',
OBSWS_CLI_STYLE_NO_BORDER=False, OBSWS_CLI_STYLE_NO_BORDER=False,
) )

View File

@@ -21,7 +21,7 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: PyPy",
] ]
dependencies = ["typer>=0.21.1", "obsws-python>=1.8.0", "python-dotenv>=1.1.0"] dependencies = ["typer>=0.24.1", "obsws-python>=1.8.0", "python-dotenv>=1.2.2"]
[project.urls] [project.urls]
@@ -36,12 +36,18 @@ obsws-cli = "obsws_cli:app"
path = "obsws_cli/__about__.py" path = "obsws_cli/__about__.py"
[tool.hatch.envs.default] [tool.hatch.envs.default]
workspace.members = [{ path = "../obsws-python" }]
dependencies = ["click-man>=0.5.1"] dependencies = ["click-man>=0.5.1"]
[tool.hatch.envs.default.scripts] [tool.hatch.envs.default.scripts]
cli = "obsws-cli {args:}"
man = "python man/generate.py --output=./man" man = "python man/generate.py --output=./man"
[tool.hatch.env]
requires = ["hatch-dotenv"]
[tool.hatch.env.collectors.dotenv.hatch-test]
env-files = [".env", ".test.env"]
[tool.hatch.envs.hatch-test] [tool.hatch.envs.hatch-test]
randomize = true randomize = true

View File

@@ -4,7 +4,6 @@ import os
import time import time
import obsws_python as obsws import obsws_python as obsws
from dotenv import find_dotenv, load_dotenv
def pytest_configure(config): def pytest_configure(config):
@@ -34,14 +33,12 @@ def pytest_sessionstart(session):
) )
print(' '.join(out)) print(' '.join(out))
load_dotenv(find_dotenv('.test.env'))
session.obsws.set_stream_service_settings( session.obsws.set_stream_service_settings(
'rtmp_common', 'rtmp_common',
{ {
'service': 'Twitch', 'service': 'Twitch',
'server': 'auto', 'server': 'auto',
'key': os.environ['OBS_STREAM_KEY'], 'key': os.environ['OBSWS_CLI_TESTS_STREAM_KEY'],
}, },
) )
@@ -63,7 +60,7 @@ def pytest_sessionstart(session):
'linux': 'pulse_output_capture', 'linux': 'pulse_output_capture',
'darwin': 'coreaudio_output_capture', 'darwin': 'coreaudio_output_capture',
} }
platform = os.environ.get('OBS_TESTS_PLATFORM', os.uname().sysname.lower()) platform = os.environ['OBSWS_CLI_TESTS_PLATFORM']
try: try:
session.obsws.create_input( session.obsws.create_input(
sceneName='pytest_scene', sceneName='pytest_scene',

View File

@@ -9,7 +9,7 @@ from obsws_cli.app import app
runner = CliRunner() runner = CliRunner()
if os.environ.get('OBS_TESTS_SKIP_GROUP_TESTS'): if os.environ.get('OBSWS_CLI_TESTS_SKIP_GROUP_TESTS'):
pytest.skip( pytest.skip(
'Skipping group tests as per environment variable', allow_module_level=True 'Skipping group tests as per environment variable', allow_module_level=True
) )