Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,26 @@ jobs:

# Use GitHub's Linux Docker host
runs-on: ubuntu-latest

lints:
name: Lints
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install ruff
run: |
python3 -m pip install --break-system-packages ruff
- name: Run ruff format
run: |
ruff --version
if ! ruff format --check --quiet varlink
then
echo "Please run 'ruff format' on the above files or apply the diffs below manually"
ruff format --check --quiet --diff varlink
fi
- name: Run ruff check
run: |
ruff --version
ruff check varlink
runs-on: ubuntu-latest
61 changes: 32 additions & 29 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
Expand All @@ -19,14 +17,14 @@

# -- Project information -----------------------------------------------------

project = u'varlink'
copyright = u'2018, Harald Hoyer<harald@redhat.com>, Lars Karlitski<lars@karlitski.net>'
author = u'Harald Hoyer<harald@redhat.com>, Lars Karlitski<lars@karlitski.net>'
project = "varlink"
copyright = "2018, Harald Hoyer<harald@redhat.com>, Lars Karlitski<lars@karlitski.net>"
author = "Harald Hoyer<harald@redhat.com>, Lars Karlitski<lars@karlitski.net>"

# The short X.Y version
version = u''
version = ""
# The full version, including alpha/beta/rc tags
release = u''
release = ""


# -- General configuration ---------------------------------------------------
Expand All @@ -39,21 +37,21 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.githubpages",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
source_suffix = ['.rst', '.md']
source_suffix = [".rst", ".md"]

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -68,15 +66,15 @@
exclude_patterns = []

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'default'
pygments_style = "default"


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'classic'
html_theme = "classic"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand All @@ -87,7 +85,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand All @@ -103,7 +101,7 @@
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'varlinkdoc'
htmlhelp_basename = "varlinkdoc"


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -112,15 +110,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -130,19 +125,21 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'varlink.tex', u'varlink Documentation',
u'Harald Hoyer\\textless{}harald@redhat.com\\textgreater{}, Lars Karlitski\\textless{}lars@karlitski.net\\textgreater{}', 'manual'),
(
master_doc,
"varlink.tex",
"varlink Documentation",
"Harald Hoyer\\textless{}harald@redhat.com\\textgreater{}, Lars Karlitski\\textless{}lars@karlitski.net\\textgreater{}",
"manual",
),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'varlink', u'varlink Documentation',
[author], 1)
]
man_pages = [(master_doc, "varlink", "varlink Documentation", [author], 1)]


# -- Options for Texinfo output ----------------------------------------------
Expand All @@ -151,9 +148,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'varlink', u'varlink Documentation',
author, 'varlink', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"varlink",
"varlink Documentation",
author,
"varlink",
"One line description of project.",
"Miscellaneous",
),
]


Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ build-backend = 'setuptools.build_meta'

[tool.setuptools_scm]
local_scheme = "no-local-version"

[tool.ruff]
target-version = "py39"
line-length = 109
lint.select = ["E", "F", "I", "UP"]
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from setuptools import setup


def local_scheme(_):
"""Enables a version format so that upload to TestPyPI is successful.
For example: 2.6.2.dev8
See https://github.com/pypa/setuptools_scm/issues/342.
"""
For example: 2.6.2.dev8
See https://github.com/pypa/setuptools_scm/issues/342.
"""
return ""


setup(
use_scm_version={"local_scheme": "no-local-version"},
setup_requires=['setuptools_scm'],
setup_requires=["setuptools_scm"],
)
65 changes: 49 additions & 16 deletions varlink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,57 @@
import os

if hasattr(os, "fork"):
__all__ = ['Client', 'ClientInterfaceHandler', 'SimpleClientInterfaceHandler',
'Service', 'RequestHandler', 'Server', 'ThreadingServer', 'ForkingServer',
'InterfaceNotFound', 'MethodNotFound', 'MethodNotImplemented', 'InvalidParameter',
'VarlinkEncoder', 'VarlinkError',
'Interface', 'Scanner', 'get_listen_fd']
__all__ = [
"Client",
"ClientInterfaceHandler",
"SimpleClientInterfaceHandler",
"Service",
"RequestHandler",
"Server",
"ThreadingServer",
"ForkingServer",
"InterfaceNotFound",
"MethodNotFound",
"MethodNotImplemented",
"InvalidParameter",
"VarlinkEncoder",
"VarlinkError",
"Interface",
"Scanner",
"get_listen_fd",
]
from .server import ForkingServer
else:
__all__ = ['Client', 'ClientInterfaceHandler', 'SimpleClientInterfaceHandler',
'Service', 'RequestHandler', 'Server', 'ThreadingServer',
'InterfaceNotFound', 'MethodNotFound', 'MethodNotImplemented', 'InvalidParameter',
'VarlinkEncoder', 'VarlinkError',
'Interface', 'Scanner', 'get_listen_fd']

from .client import (Client, ClientInterfaceHandler, SimpleClientInterfaceHandler)
from .error import (VarlinkEncoder, VarlinkError, InvalidParameter, InterfaceNotFound, MethodNotImplemented,
MethodNotFound)
from .scanner import (Scanner, Interface)
from .server import (Service, get_listen_fd, Server, ThreadingServer, RequestHandler)
__all__ = [
"Client",
"ClientInterfaceHandler",
"SimpleClientInterfaceHandler",
"Service",
"RequestHandler",
"Server",
"ThreadingServer",
"InterfaceNotFound",
"MethodNotFound",
"MethodNotImplemented",
"InvalidParameter",
"VarlinkEncoder",
"VarlinkError",
"Interface",
"Scanner",
"get_listen_fd",
]

from .client import Client, ClientInterfaceHandler, SimpleClientInterfaceHandler
from .error import (
InterfaceNotFound,
InvalidParameter,
MethodNotFound,
MethodNotImplemented,
VarlinkEncoder,
VarlinkError,
)
from .scanner import Interface, Scanner
from .server import RequestHandler, Server, Service, ThreadingServer, get_listen_fd


# There are no tests here, so don't try to run anything discovered from
Expand Down
Loading