Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project metadata to pyproject.toml + remove i18n #107

Merged
merged 41 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
47fc7fd
project metadata defined in project.toml
marscher Dec 4, 2023
da672d5
remove i18n base class
marscher Dec 4, 2023
9672c0f
remove i18n base class
marscher Dec 4, 2023
2ab8901
remove i18n base class
marscher Dec 4, 2023
ce1409e
remove i18n base class
marscher Dec 4, 2023
b014b8b
remove i18n base class
marscher Dec 4, 2023
3cafa8e
remove i18n base class
marscher Dec 4, 2023
52cb454
ruff
marscher Dec 4, 2023
6ac619c
ruff2
marscher Dec 4, 2023
e0b7a85
removed i18n
marscher Dec 4, 2023
e70ef7c
do not run cov per default with pytest
marscher Dec 4, 2023
38be7a4
wip
marscher Dec 4, 2023
df028b1
black
marscher Dec 4, 2023
2ab6da8
fix
marscher Dec 7, 2023
6bb1b7a
minor
marscher Dec 7, 2023
700280b
minor
marscher Dec 7, 2023
e7e6bb8
removed tautological argument
marscher Dec 7, 2023
08c8546
format
marscher Dec 7, 2023
8b5f6df
fix k3d test
CagtayFabry Dec 11, 2023
fbf66c3
fix unit stripped in min/max reduction
marscher Dec 13, 2023
a95ea8b
added ruff
marscher Dec 13, 2023
78ca8b1
removed kisa submod
marscher Dec 13, 2023
8648740
fix b017, raise specific exception
marscher Dec 13, 2023
b3fe01a
removed obsolete test file
marscher Dec 13, 2023
cbf0ffb
fix bugbear os.environ assignment
marscher Dec 13, 2023
db9b96c
fix bugbear exception chaining
marscher Dec 13, 2023
da29b4a
fix bugbear caching of class instance
marscher Dec 13, 2023
dfbb8ea
format
marscher Dec 13, 2023
c7bd6fd
fix docstring
marscher Dec 13, 2023
b27c7c4
remove flake8 settings (moved to ruff)
marscher Dec 13, 2023
d45e1c7
remove pydocstyle precommit (moved to ruff)
marscher Dec 13, 2023
5362d91
remove redundant parentheses around strings
marscher Dec 13, 2023
4f79c64
[pytest] re-enable coverage recording
marscher Dec 14, 2023
ed80ef5
avoid attaching unit twice
marscher Dec 14, 2023
31e2fb4
f
marscher Dec 14, 2023
a743378
removed unused abstract methods in import/export interface
marscher Dec 14, 2023
4f59430
Merge branch 'main' into pyproject_toml
marscher Dec 14, 2023
ed1d0f3
renamed FloatWithUnit -> WidgetFloatWithUnit
marscher Dec 14, 2023
313a17b
reformat
marscher Dec 14, 2023
1b5188e
format
marscher Dec 14, 2023
1efcc7d
ff
marscher Dec 14, 2023
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
29 changes: 10 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ci:
for more information, see https://pre-commit.ci
autofix_prs: false
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
autoupdate_schedule: monthly
skip: []
submodules: false
repos:
Expand All @@ -16,21 +16,12 @@ repos:
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: check-yaml
exclude: devtools/conda.recipe/meta.yaml # doesn't play nice with jinja
# - id: no-commit-to-branch # only makes sense for local pre-commit hooks
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.7
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
142 changes: 142 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,151 @@
[project]
name = "weldx_widgets"
dynamic = [ # see: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata
"version", # version gets derived from git by setuptools_scm.
]
authors = [
{name="Martin K. Scherer", email="[email protected]"},
{name="Cagtay Fabry", email="[email protected]"}
]
description="Python based widgets for the weldx core package"
readme = "README.md"
license = {file = "LICENSE", name="BSD License"}
keywords = [
"weldx",
"ipywidgets",
"widgets",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Scientific/Engineering :: Physics",
]

# Dependencies
requires-python = ">=3.9"
dependencies = [
"weldx >=0.6",
"ipywidgets",
"k3d >=2.12",
"ipympl",
"bidict",
"ipyfilechooser",
"tqdm",
]
[project.optional-dependencies]
test = [
"pytest-cov",
"pytest-xdist"
]

[project.urls]
documentation = "https://weldx.readthedocs.io"
repository = "https://github.com/BAMweldx/weldx-widgets"
bug_tracker = "https://github.com/BAMweldx/weldx-widgets/issues"
changelog = "https://github.com/BAMweldx/weldx-widgets/blob/master/CHANGELOG.md"

[build-system]
requires = ["setuptools>=45",
"wheel",
"setuptools_scm[toml]>=6.0",
"babel",
]

# Tool configs
[tool.setuptools_scm]
write_to = "weldx_widgets/_version.py"
write_to_template = '__version__ = "{version}"'

[tool.setuptools.packages.find]
where = ["."]

[tool.pytest.ini_options]
addopts = "--tb=short --color=yes -rsw --doctest-modules --cov=weldx_widgets"
testpaths = "weldx_widgets/tests"
filterwarnings = [
"ignore::DeprecationWarning:traittypes.*:",
"ignore:Passing method to :FutureWarning:xarray.*:",
"error::pint.UnitStrippedWarning",
]

[tool.coverage.run]
source = ["weldx_widgets"]

[tool.coverage.report]
omit = [
"weldx_widgets/_version.py",
"weldx_widgets/tests/*",
]
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
]

[tool.ruff]
target-version = "py38" # designated Python version
exclude = [
"__init__.py",
"doc/src/conf.py",
]
# TODO: should be the following list, but Ruff does not yet impl all of them.
# W503,W504
# E203
# C408
ignore = [
"C408",
#"E203",
"E402",
#"W503",
#"W504",
"D203", "D211", "D213"
]
line-length = 88
select = [
"B", # flake8-bugbear
"C", # flake8-comprehensions
#"D", # note: all relevant D's will be set by setting pydocstyle.convention=numpy!
"E", # pycodestyles
"F", # pyflakes
"W", # pycodestyle warnings
"UP", # pyupgrade
"T2", # flake8-print
"I001", # isort
"ICN", # import conventions, e.g. import numpy as np
#"B950", # not yet implemented by Ruff.
"RUF100", # ensure 'noqa' declarations are still valid.
]

# Allow pydocstyle violations in certain areas.
per-file-ignores."**/{tests,tags,asdf,devtools}/**" = ["D"]
per-file-ignores."conftest.py" = ["D"]
per-file-ignores."doc/src/tutorials/*" = ["D"]
per-file-ignores."doc/src/conf.py" = ["E501", # ignore long lines.
"RUF100", # do no check if 'noqa' is needed (circular import workaround)
]
# Allow prints in certain areas.
per-file-ignores."**/{cli,tests,tutorials,devtools}/**/*{.py,ipynb}" = ["T2"]

external = ["B950"]
pydocstyle = {convention = "numpy"}
pyupgrade = {keep-runtime-typing = true}

mccabe = {max-complexity = 15} # max branches inside a function.

[tool.ruff.isort]
known-first-party = ["weldx"]
required-imports = ["from __future__ import annotations"]

[tool.ruff.flake8-import-conventions]
extend-aliases = {xarray = "xr"}

[tool.nbqa.addopts]
ruff = [
"--extend-ignore=B018"
]
87 changes: 0 additions & 87 deletions setup.cfg

This file was deleted.

27 changes: 0 additions & 27 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions weldx_widgets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Weldx widgets."""
from .generic import WidgetSaveButton, WidgetTimeSeries
from .widget_factory import FloatWithUnit, WidgetLabeledTextInput
from .widget_factory import WidgetFloatWithUnit, WidgetLabeledTextInput
from .widget_gas import WidgetShieldingGas
from .widget_gmaw import WidgetGMAW
from .widget_groove_sel import WidgetGrooveSelection, WidgetGrooveSelectionTCPMovement
Expand All @@ -13,7 +13,7 @@
WidgetLabeledTextInput,
WidgetSaveButton,
WidgetGMAW,
FloatWithUnit, # TODO: rename
WidgetFloatWithUnit,
]
__all__ = map(str, (x.__name__ for x in __all__))

Expand Down
20 changes: 6 additions & 14 deletions weldx_widgets/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from ipywidgets import HTML, Button, HBox, Label

import weldx
from weldx_widgets.translation_utils import _i18n as _
from weldx_widgets.widget_base import WeldxImportExport, WidgetMyHBox, WidgetMyVBox
from weldx_widgets.widget_factory import (
WidgetLabeledTextInput,
Expand Down Expand Up @@ -59,14 +58,12 @@
filename=filename,
filter_pattern=filter_pattern,
select_default=select_default,
select_desc=_("Select"),
change_desc=_("Change"),
select_desc="Select",
change_desc="Change",
)
self.button = Button(description=_(desc), layout=button_layout)
self.button = Button(description=desc, layout=button_layout)

Check warning on line 64 in weldx_widgets/generic.py

View check run for this annotation

Codecov / codecov/patch

weldx_widgets/generic.py#L64

Added line #L64 was not covered by tests

super(WidgetSaveButton, self).__init__(
children=(self.file_chooser, self.button)
)
super().__init__(children=(self.file_chooser, self.button))

Check warning on line 66 in weldx_widgets/generic.py

View check run for this annotation

Codecov / codecov/patch

weldx_widgets/generic.py#L66

Added line #L66 was not covered by tests

def set_handler(self, handler: Callable):
"""Set action handler on save button click."""
Expand All @@ -91,11 +88,6 @@
class WidgetTimeSeries(WidgetMyVBox, WeldxImportExport):
"""Preliminary time series editing widget."""

@property
def schema(self) -> str:
"""Return schema to validate data against."""
return "time_series"

# TODO: handle math-expr
def __init__(
self, base_unit, time_unit="s", base_data="0", time_data="0", title=""
Expand All @@ -121,7 +113,7 @@
]
if title:
children.insert(0, Label(title))
super(WidgetTimeSeries, self).__init__(children=children)
super().__init__(children=children)

def to_tree(self) -> dict:
"""Get mapping of input fields."""
Expand Down Expand Up @@ -153,7 +145,7 @@
button_description: str,
html_instance: Optional[HTML] = None,
) -> HTML:
"""Load data from buffer into base64 payload embedded into a HTML button.
"""Load data from buffer into base64 payload embedded into an HTML button.

Parameters
----------
Expand Down
1 change: 0 additions & 1 deletion weldx_widgets/kisa/__init__.py

This file was deleted.

Loading