Skip to content

Commit

Permalink
Merge pull request #107 from tekktrik/dev/updates
Browse files Browse the repository at this point in the history
General updates
  • Loading branch information
tekktrik authored Jan 11, 2024
2 parents b141295 + ee184b4 commit 8dc39e6
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 67 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2024 Alec Delaney
#
# SPDX-License-Identifier: MIT

version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
reviewers: ["tekktrik"]
versioning-strategy: increase
41 changes: 8 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,11 @@ repos:
name: Fix end of files
- id: trailing-whitespace
name: Trim trailing whitespace
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
name: Sort imports
args:
- --multi-line
- VERTICAL_HANGING_INDENT
- --tc
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
name: Format via black
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
name: Upgrade python syntax
args:
- --py38-plus
- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
name: Check docstrings compliance
- repo: https://github.com/PyCQA/pylint
rev: v3.0.3
hooks:
- id: pylint
name: Lint via pylint
types: [python]
exclude: "^(docs/conf.py)"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
hooks:
- id: ruff-format
name: Format via ruff
- id: ruff
name: Check via ruff
args: [--fix]
3 changes: 1 addition & 2 deletions circlink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#
# SPDX-License-Identifier: MIT

"""
The main script handling CLI interactions for ``circlink``.
"""The main script handling CLI interactions for ``circlink``.
Author(s): Alec Delaney (Tekktrik)
"""
Expand Down
6 changes: 2 additions & 4 deletions circlink/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#
# SPDX-License-Identifier: MIT

"""
Backend operations for circlink.
"""Backend operations for circlink.
Author(s): Alec Delaney (Tekktrik)
"""
Expand All @@ -23,8 +22,7 @@
import circlink.link


# pylint: disable=too-many-locals,too-many-branches,too-many-arguments
def start_backend(
def start_backend( # noqa: PLR0913, PLR0912
read_path: str,
write_path: str,
base_dir: str,
Expand Down
9 changes: 3 additions & 6 deletions circlink/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#
# SPDX-License-Identifier: MIT

"""
The main script handling CLI interactions for ``circlink``.
"""The main script handling CLI interactions for ``circlink``.
Author(s): Alec Delaney (Tekktrik)
"""
Expand Down Expand Up @@ -37,9 +36,8 @@
app.add_typer(workspace.workspace_app, name="workspace")


# pylint: disable=too-many-arguments
@app.command()
def start(
def start( # noqa: PLR0913
read_path: str = Argument(..., help="The read path/pattern of file(s) to save"),
write_path: str = Argument(
...,
Expand Down Expand Up @@ -282,8 +280,7 @@ def callback(


def reset_cb() -> None:
"""
Reset the app directory.
"""Reset the app directory.
Useful if you upgrade circlink and there are breaking changes.
"""
Expand Down
5 changes: 2 additions & 3 deletions circlink/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#
# SPDX-License-Identifier: MIT

"""
The sub-script for handling the config options for ``circlink``.
"""The sub-script for handling the config options for ``circlink``.
Author(s): Alec Delaney (Tekktrik)
"""
Expand Down Expand Up @@ -42,7 +41,7 @@ def callback(

@config_app.command()
def view(
config_path: str = Argument("all", help="The setting to view, using dot notation")
config_path: str = Argument("all", help="The setting to view, using dot notation"),
) -> None:
"""View a config setting for circlink."""
# Get the settings, show all settings if no specific on is specified
Expand Down
3 changes: 1 addition & 2 deletions circlink/cli/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#
# SPDX-License-Identifier: MIT

"""
The sub-script for handling the workspace options for ``circlink``.
"""The sub-script for handling the workspace options for ``circlink``.
Author(s): Alec Delaney (Tekktrik)
"""
Expand Down
12 changes: 4 additions & 8 deletions circlink/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#
# SPDX-License-Identifier: MIT

"""
Information and methods pertaining to the ledger file.
"""Information and methods pertaining to the ledger file.
Author(s): Alec Delaney (Tekktrik)
"""
Expand All @@ -21,8 +20,7 @@


def with_ledger(mode: str = "a"):
"""
Use the ledger file.
"""Use the ledger file.
Manages locking and unlocking the file
"""
Expand Down Expand Up @@ -65,8 +63,7 @@ def wrapper_with_ledger(

@with_ledger(mode="a")
def append_to_ledger(entry: LedgerEntry, **args) -> Literal[True]:
"""
Add a file to the ledger.
"""Add a file to the ledger.
Returns whether the file actually was added (True) or if it already
existed (False).
Expand All @@ -78,8 +75,7 @@ def append_to_ledger(entry: LedgerEntry, **args) -> Literal[True]:

@with_ledger(mode="w")
def remove_from_ledger(entry: LedgerEntry, **args) -> Literal[True]:
"""
Remove a file from the ledger.
"""Remove a file from the ledger.
Returns whether the file actually was removed (True) or if it didn't
exist (False).
Expand Down
9 changes: 3 additions & 6 deletions circlink/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#
# SPDX-License-Identifier: MIT

"""
Information and methods pertaining to links and link files.
"""Information and methods pertaining to links and link files.
Author(s): Alec Delaney (Tekktrik)
"""
Expand Down Expand Up @@ -31,8 +30,7 @@
class CircuitPythonLink:
"""The link to the device."""

# pylint: disable=too-many-arguments
def __init__(
def __init__( # noqa: PLR0913
self,
read_path: str,
write_path: str,
Expand Down Expand Up @@ -216,8 +214,7 @@ def get_files_monitored(self):

return [file for file in all_potential if file.is_file()]

# pylint: disable=too-many-branches
def begin_monitoring(self) -> None:
def begin_monitoring(self) -> None: # noqa: PLR0912
"""Monitor the listed file(s) for changes."""
# Ensure the write path exists
os.makedirs(self._write_path, exist_ok=True)
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: Unix",
]
dynamic = ["dependencies", "optional-dependencies"]
Expand All @@ -54,3 +56,7 @@ templates = ["*.yaml"]
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
optional-dependencies = {dev = {file = ["requirements-dev.txt"]}}

[tool.ruff.lint]
select = ["D", "PL", "UP", "I"]
ignore = ["D213", "D203"]
6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
#
# SPDX-License-Identifier: MIT

pre-commit~=2.20
sphinx~=5.1
sphinx-rtd-theme~=1.0
pre-commit~=3.6
sphinx~=7.2
sphinx-rtd-theme~=2.0

0 comments on commit 8dc39e6

Please sign in to comment.