repackage with pdm

add pdm build/copy scripts

update README
This commit is contained in:
Onyx and Iris 2025-01-23 20:05:50 +00:00
parent b090c359b4
commit 68462016a5
6 changed files with 320 additions and 49 deletions

178
.gitignore vendored
View File

@ -1,3 +1,179 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#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
# 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
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# Ruff stuff:
.ruff_cache/
# PyPI configuration file
.pypirc
# NVDA
addon/doc/*.css
addon/doc/en/
*_docHandler.py
@ -10,5 +186,5 @@ manifest.ini
.sconsign.dblite
/[0-9]*.[0-9]*.[0-9]*.json
.venv/
# testing
keybinds.json

View File

@ -1,5 +1,4 @@
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev)
[![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)
# NVDA Addon Voicemeeter

View File

@ -1,25 +1,25 @@
param(
param (
[switch]$build
)
function Copy-FilestoScratchpad {
function Copy-FilesToScratchpad {
$source = Join-Path $PSScriptRoot "addon" "globalPlugins" "voicemeeter"
$target = Join-Path $env:appdata "nvda" "scratchpad" "globalPlugins" "voicemeeter"
Robocopy $source $target | Out-Null
}
function main {
"Copying files to Scratchpad" | Write-Host
Copy-FilestoScratchpad
function Build-Addon {
"Building add-on" | Write-Host
scons
}
function Main {
"Copying updated files to Scratchpad" | Write-Host
Copy-FilesToScratchpad
if ($build) {
Invoke-Expression ".venv/Scripts/Activate.ps1"
"Building add-on" | Write-Host
scons
deactivate
Build-Addon
}
}
if ($MyInvocation.InvocationName -ne '.') { main }
if ($MyInvocation.InvocationName -ne '.') { Main }

View File

@ -16,39 +16,39 @@ def _(arg):
# Add-on information variables
addon_info = {
# add-on Name/identifier, internal for NVDA
"addon_name": "voicemeeter",
'addon_name': 'voicemeeter',
# Add-on summary, usually the user visible name of the addon.
# Translators: Summary for this add-on
# to be shown on installation and add-on information found in Add-ons Manager.
"addon_summary": _("Voicemeeter Controller"),
'addon_summary': _('Voicemeeter Controller'),
# Add-on description
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description": _(
'addon_description': _(
"""This add-on uses Voicemeeter's Remote API to control it's GUI.
The add-on requires Voicemeeter to be installed."""
),
# version
"addon_version": "0.6",
'addon_version': '1.0.0',
# Author(s)
"addon_author": "onyx-and-iris <code@onyxandiris.online>",
'addon_author': 'onyx-and-iris <code@onyxandiris.online>',
# URL for the add-on documentation support
"addon_url": None,
'addon_url': None,
# URL for the add-on repository where the source code can be found
"addon_sourceURL": "https://github.com/onyx-and-iris/nvda-addon-voicemeeter",
'addon_sourceURL': 'https://github.com/onyx-and-iris/nvda-addon-voicemeeter',
# Documentation file name
"addon_docFileName": "readme.html",
'addon_docFileName': 'readme.html',
# Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)
"addon_minimumNVDAVersion": "2023.2",
'addon_minimumNVDAVersion': '2024.4.0',
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
"addon_lastTestedNVDAVersion": "2023.2",
'addon_lastTestedNVDAVersion': '2024.4.2',
# Add-on update channel (default is None, denoting stable releases,
# and for development releases, use "dev".)
# Do not change unless you know what you are doing!
"addon_updateChannel": "dev",
'addon_updateChannel': 'dev',
# Add-on license such as GPL 2
"addon_license": "GPL 2",
'addon_license': 'GPL 2',
# URL for the license document the ad-on is licensed under
"addon_licenseURL": "https://github.com/onyx-and-iris/nvda-addon-voicemeeter/blob/main/LICENSE",
'addon_licenseURL': 'https://github.com/onyx-and-iris/nvda-addon-voicemeeter/blob/main/LICENSE',
}
# Define the python files that are the sources of your add-on.
@ -60,11 +60,11 @@ The add-on requires Voicemeeter to be installed."""
# For more information on SCons Glob expressions please take a look at:
# https://scons.org/doc/production/HTML/scons-user/apd.html
pythonSources = [
"addon/globalPlugins/voicemeeter/*.py",
'addon/globalPlugins/voicemeeter/*.py',
]
# Files that contain strings for translation. Usually your python sources
i18nSources = pythonSources + ["buildVars.py"]
i18nSources = pythonSources + ['buildVars.py']
# Files that will be ignored when building the nvda-addon file
# Paths are relative to the addon directory, not to the root directory of your addon sources.
@ -73,7 +73,7 @@ excludedFiles = []
# Base language for the NVDA add-on
# If your add-on is written in a language other than english, modify this variable.
# For example, set baseLanguage to "es" if your add-on is primarily written in spanish.
baseLanguage = "en"
baseLanguage = 'en'
# Markdown extensions for add-on documentation
# Most add-ons do not require additional Markdown extensions.

36
pdm.lock Normal file
View File

@ -0,0 +1,36 @@
# This file is @generated by PDM.
# It is not intended for manual editing.
[metadata]
groups = ["default", "build"]
strategy = ["inherit_metadata"]
lock_version = "4.5.0"
content_hash = "sha256:ffb180ef920ab37ffd5773fd707e211323fdcdf938a50189f57238ca6222d2c6"
[[metadata.targets]]
requires_python = "==3.11.*"
[[package]]
name = "markdown"
version = "3.7"
requires_python = ">=3.8"
summary = "Python implementation of John Gruber's Markdown."
groups = ["build"]
dependencies = [
"importlib-metadata>=4.4; python_version < \"3.10\"",
]
files = [
{file = "Markdown-3.7-py3-none-any.whl", hash = "sha256:7eb6df5690b81a1d7942992c97fad2938e956e79df20cbc6186e9c3a77b1c803"},
{file = "markdown-3.7.tar.gz", hash = "sha256:2ae2471477cfd02dbbf038d5d9bc226d40def84b4fe2986e49b59b6b472bbed2"},
]
[[package]]
name = "scons"
version = "4.8.1"
requires_python = ">=3.6"
summary = "Open Source next-generation build tool."
groups = ["build"]
files = [
{file = "SCons-4.8.1-py3-none-any.whl", hash = "sha256:a4c3b434330e2d7d975002fd6783284ba348bf394db94c8f83fdc5bf69cdb8d7"},
{file = "scons-4.8.1.tar.gz", hash = "sha256:5b641357904d2f56f7bfdbb37e165ab996b6143c948b9df0efc7305f54949daa"},
]

View File

@ -1,15 +1,29 @@
[tool.black]
line-length = 119
[project]
name = "nvda-addon-voicemeeter"
version = "1.0.0"
description = "A GUI-less NVDA Addon for Voicemeeter using the Remote API"
authors = [
{name = "Onyx and Iris", email = "code@onyxandiris.online"},
]
dependencies = []
requires-python = "==3.11.*"
readme = "README.md"
license = {text = "MIT"}
[dependency-groups]
build = [
"scons>=4.8.1",
"markdown>=3.7",
]
[tool.pdm]
distribution = false
[tool.pdm.scripts]
copy = "pwsh build.ps1"
build = "pwsh build.ps1 -build"
[tool.ruff]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F"]
# Avoid enforcing line-length violations (`E501`). Let Black deal with this.
ignore = ["E501"]
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
unfixable = []
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
@ -33,14 +47,60 @@ exclude = [
"node_modules",
"venv",
]
# Same as Black.
line-length = 119
line-length = 120
indent-width = 4
# Assume Python 3.10
target-version = "py310"
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F"]
ignore = []
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Assume Python 3.7
target-version = "py37"
[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
[tool.ruff.format]
# Unlike Black, use single quotes for strings.
quote-style = "single"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false
# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.per-file-ignores]
"__init__.py" = ["E402", "F401"] # Ignore unused import and variable not accessed violations
[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"E402",
"F401",
]