Skip to content

Commit

Permalink
Bump version of dependecies and migrate to ruff and sonar 20241213
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Faraone committed Dec 14, 2024
1 parent 97b4a6d commit 0d7fb9c
Show file tree
Hide file tree
Showing 38 changed files with 2,369 additions and 2,238 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.12

RUN apt update && apt install -y vim

Expand Down
54 changes: 38 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -27,24 +27,17 @@ jobs:
python -m pip install --upgrade pip
pip install poetry
poetry install
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
- name: Linting
run: |
poetry run flake8
poetry run ruff check .
- name: Testing
run: |
poetry run pytest
- name: Publish coverage
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
fail_ci_if_error: true
verbose: true
win:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -61,13 +54,42 @@ jobs:
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
- name: Linting
run: |
poetry run flake8
poetry run ruff check .
- name: Testing
run: |
poetry run pytest
- name: Publish coverage
uses: codecov/codecov-action@v1
quality:
runs-on: ubuntu-latest
needs: [win, linux]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Linting
run: |
poetry run ruff check .
- name: Testing
run: |
poetry run pytest
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@v4
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: SonarQube Quality Gate check
id: sonarqube-quality-gate-check
uses: sonarsource/sonarqube-quality-gate-action@master
with:
file: ./coverage.xml
fail_ci_if_error: true
verbose: true
pollingTimeoutSec: 600
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Linting
run: |
poetry run flake8
poetry run ruff check .
- name: Testing
run: |
poetry run pytest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@ venv.bak/
local

.vscode/
.ruff_cache
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# interrogatio

![Python versions](https://img.shields.io/pypi/pyversions/interrogatio.svg) [![PyPi Status](https://img.shields.io/pypi/v/interrogatio.svg)](https://pypi.org/project/interrogatio/) ![Read the Docs](https://img.shields.io/readthedocs/interrogatio) [![Build Status](https://img.shields.io/github/workflow/status/ffaraone/interrogatio/Build%20interrogatio)](https://github.com/ffaraone/interrogatio/actions) [![codecov](https://codecov.io/gh/ffaraone/interrogatio/branch/master/graph/badge.svg)](https://codecov.io/gh/ffaraone/interrogatio)

![Python versions](https://img.shields.io/pypi/pyversions/interrogatio.svg) [![PyPi Status](https://img.shields.io/pypi/v/interrogatio.svg)](https://pypi.org/project/interrogatio/) ![Read the Docs](https://img.shields.io/readthedocs/interrogatio) [![Build Status](https://img.shields.io/github/workflow/status/ffaraone/interrogatio/Build%20interrogatio)](https://github.com/ffaraone/interrogatio/actions) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ffaraone_interrogatio&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=ffaraone_interrogatio) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=ffaraone_interrogatio&metric=coverage)](https://sonarcloud.io/summary/new_code?id=ffaraone_interrogatio)

A python library to prompt users for inputs in a terminal application.

Expand Down
60 changes: 32 additions & 28 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
Expand All @@ -16,20 +15,20 @@
import sys
from datetime import datetime

sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))

# on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

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

project = 'interrogatio'
copyright = '{}, Francesco Faraone.'.format(datetime.now().year)
author = 'Francesco Faraone'
project = "interrogatio"
copyright = f"{datetime.now().year}, Francesco Faraone."
author = "Francesco Faraone"

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


# -- General configuration ---------------------------------------------------
Expand All @@ -42,7 +41,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
"sphinx.ext.autodoc",
]

# if not on_rtd: # only import and set the theme if we're building docs locally
Expand All @@ -52,16 +51,16 @@


# 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'
source_suffix = ".rst"

# 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 @@ -73,7 +72,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
Expand All @@ -85,7 +84,7 @@
# a list of builtin themes.
#

html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# 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 @@ -96,7 +95,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 @@ -112,7 +111,7 @@
# -- Options for HTMLHelp output ---------------------------------------------

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


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -121,15 +120,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 @@ -139,19 +135,21 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'interrogatio.tex', 'interrogatio Documentation',
'Francesco Faraone', 'manual'),
(
master_doc,
"interrogatio.tex",
"interrogatio Documentation",
"Francesco Faraone",
"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, 'interrogatio', 'interrogatio Documentation',
[author], 1)
]
man_pages = [(master_doc, "interrogatio", "interrogatio Documentation", [author], 1)]


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


Expand All @@ -181,7 +185,7 @@
# epub_uid = ''

# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
epub_exclude_files = ["search.html"]


# -- Extension configuration -------------------------------------------------
9 changes: 3 additions & 6 deletions interrogatio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
from pkg_resources import DistributionNotFound, get_distribution
from importlib_metadata import version

from interrogatio.core.dialog import dialogus
from interrogatio.core.prompt import interrogatio

__all__ = ('dialogus', 'interrogatio')
__all__ = ("dialogus", "interrogatio")


try:
__version__ = get_distribution('interrogatio').version
except DistributionNotFound: # pragma: no cover
__version__ = '0.0.0'
__version__ = version("interrogatio")


def get_version():
Expand Down
34 changes: 19 additions & 15 deletions interrogatio/core/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from interrogatio.themes import for_dialog, set_theme
from interrogatio.widgets.wizard import WizardDialog


__all__ = ['dialogus']
__all__ = ["dialogus"]


def show_dialog(
Expand All @@ -16,19 +15,24 @@ def show_dialog(
intro=None,
summary=False,
fast_forward=False,
next_text='Next',
previous_text='Previous',
cancel_text='Cancel',
finish_text='Finish',
next_text="Next",
previous_text="Previous",
cancel_text="Cancel",
finish_text="Finish",
):
handlers = [get_instance(q) for q in questions]
app = Application(
layout=Layout(
WizardDialog(
title, handlers,
intro=intro, summary=summary, fast_forward=fast_forward,
next_text=next_text, previous_text=previous_text,
cancel_text=cancel_text, finish_text=finish_text,
title,
handlers,
intro=intro,
summary=summary,
fast_forward=fast_forward,
next_text=next_text,
previous_text=previous_text,
cancel_text=cancel_text,
finish_text=finish_text,
),
),
mouse_support=False,
Expand All @@ -51,11 +55,11 @@ def dialogus(
intro=None,
summary=False,
fast_forward=False,
next_text='Next',
previous_text='Previous',
cancel_text='Cancel',
finish_text='Finish',
theme='default',
next_text="Next",
previous_text="Previous",
cancel_text="Cancel",
finish_text="Finish",
theme="default",
):
"""
Show a dialog with inputs as defined in the questions parameter and returns
Expand Down
3 changes: 2 additions & 1 deletion interrogatio/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ class ValidationError(Exception):
"""
Exception raised when validation fails.
"""

def __init__(self, message):
super(ValidationError, self).__init__()
super().__init__()
self._message = message

def __str__(self):
Expand Down
Loading

0 comments on commit 0d7fb9c

Please sign in to comment.