Skip to content

Commit

Permalink
add pyproject fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
CagtayFabry committed Apr 2, 2024
1 parent 89a17bc commit a3ac2a3
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 144 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ repos:
- --fix
# Run ruff formatter.
- id: ruff-format
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
hooks:
- id: pyproject-fmt
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
hooks:
Expand Down
3 changes: 1 addition & 2 deletions doc/json_mime_render_plugin/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[project]
name = "myst_nb_json_renderer"
name = "myst-nb-json-renderer"
version = "1"

[project.entry-points."myst_nb.mime_renderers"]
json_mime = "myst_nb_json_render_plugin:MimeRenderPlugin"
272 changes: 130 additions & 142 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,177 +1,100 @@
[project]
name = "weldx"
dynamic = [ # see: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata
"version", # version gets derived from git by setuptools_scm.
description = "Python API for the WelDX file format and standard"
readme = "README.md"
keywords = [
"bam", # TODO: add more keywords here! think of them as in a journal article.
"welding",
"weldx",
]
license = {file = "LICENSE", name="BSD License"}
authors = [
{name="Cagtay Fabry", email="cagtay.fabry@bam.de"},
{name="Çağtay Fabry", email="cagtay.fabry@bam.de"},
{name="Volker Hirthammer", email="volker.hirthammer@bam.de"},
{name="Martin K. Scherer", email="martin.scherer@bam.de"},
]
description = "Python API for the WelDX file format and standard"
readme = "README.md"
license = {file = "LICENSE", name="BSD License"}
keywords = [
"welding",
"weldx",
"bam", # TODO: add more keywords here! think of them as in a journal article.
]
classifiers = [
"Development Status :: 4 - Beta",
"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.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Physics", # TODO: add more topics here!
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
]

# Dependencies
requires-python = ">=3.9"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Physics", # TODO: add more topics here!
]
dynamic = [
# see: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata
"version", # version gets derived from git by setuptools_scm.
]
dependencies = [
"numpy >=1.20",
"asdf >=2.15.1",
"pandas >=1.5",
"xarray >=2022.9.0",
"scipy >=1.6.2",
"sympy >=1.6",
"pint >=0.18",
"pint-xarray >=0.3",
"bottleneck >=1.3.3",
"boltons",
"bidict",
"networkx >=2.8.2",
"fs",
"meshio",
"psutil",
"IPython",
"asdf>=2.15.1",
"bidict",
"boltons",
"bottleneck>=1.3.3",
"fs",
"IPython",
"meshio",
"networkx>=2.8.2",
"numpy>=1.20",
"pandas>=1.5",
"pint>=0.18",
"pint-xarray>=0.3",
"psutil",
"scipy>=1.6.2",
"sympy>=1.6",
"xarray>=2022.9",
]

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

[project.optional-dependencies]
media = [
"av",
"dask-image",
"pims",
"tifffile", # required by dask-image, but not listed in their requirements
]
test = [
"pytest >=6",
"pytest-cov",
"pytest-xdist",
"nbval",
"nbval",
"pytest>=6",
"pytest-cov",
"pytest-xdist",
]
vis = [
"weldx_widgets >=0.2",
"weldx_widgets>=0.2",
]
media = [
"pims",
"av",
"dask-image",
# this is actually required by dask-image, but not listed in their requirements:
"tifffile",
]

# ASDF extension entry points.

[project.urls]
bug_tracker = "https://github.com/BAMweldx/weldx/issues"
changelog = "https://github.com/BAMweldx/weldx/blob/master/CHANGELOG.md"
documentation = "https://weldx.readthedocs.io"
repository = "https://github.com/BAMweldx/weldx"
[project.scripts]
welding_schema = "weldx.asdf.cli.welding_schema:main"
[project.entry-points."asdf.extensions"]
weldx = "weldx.asdf.extension:get_extensions"

[project.entry-points."asdf.resource_mappings"]
weldx_schemas = "weldx.asdf.extension:get_resource_mappings"

# console scripts
[project.scripts]
welding_schema = "weldx.asdf.cli.welding_schema:main"

# Build system config, pip creates a temporary env with "requires" pkgs.
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"wheel",
"setuptools >= 64",
"setuptools>=64",
"setuptools_scm[toml]>=6.2",
"wheel",
]
build-backend = "setuptools.build_meta"


# Tool configs
[tool.setuptools.packages.find]
where = ["."]

[tool.setuptools_scm]
write_to = "weldx/_version.py"
write_to_template = '__version__ = "{version}"'

[tool.pytest.ini_options]
addopts = "--tb=short --color=yes -rsw --cov=weldx --cov-report=term-missing:skip-covered --doctest-modules"
#addopts = --tb=short --color=yes -rs -p no:cov
testpaths = "weldx"
# custom test markers, see https://docs.pytest.org/en/latest/example/markers.html#mark-examples
markers = "slow: marks tests as slow to run (skipped by default, enable with --runslow option)"
asdf_schema_root = "weldx/schemas/weldx.bam.de/weldx" # TODO: couldn't we just use the entry points to resolve this?
#asdf_schema_tests_enabled = true
#asdf_schema_skip_tests =
# weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.schema.yaml
norecursedirs = [
"doc",
".ipynb_checkpoints",
]
filterwarnings = [
"ignore::DeprecationWarning:traittypes.*:",
"ignore:Passing method to :FutureWarning:xarray.*:",
"error::pint.UnitStrippedWarning",
#"error::FutureWarning", # todo: we want to enable this, as it notifies us about upcoming failures due to upstream changes.
]

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

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

# ignore class __repr__-like functions:
"def __repr__",
"def __str__",
"def _ipython_display_",
]

[tool.mypy]
python_version = "3.9"
files = "weldx"
ignore_missing_imports = true # TODO: this is bad!
strict_optional = false
pretty = true
allow_redefinition = true
show_error_context = true
show_error_codes = true
show_column_numbers = true
sqlite_cache = true

# MyPy per-module options:
[[tool.mypy.overrides]]
module = ["weldx.asdf.*", "weldx.tags.*", "weldx.tests.*", "weldx.welding.groove.*", "weldx.geometry.*" ]
ignore_errors = true

# this is a workaround for an xarray related mypy bug
# see https://github.com/python/mypy/pull/9495
# and https://github.com/space-physics/msise00/commit/8b59a9383dd6fcc54b7dac74eb95a350308d7b62
# TODO: is this still mandatory?
[[tool.mypy.overrides]]
module = "xarray"
follow_imports = "skip"
ignore_errors = true

[tool.ruff]
target-version = "py39" # designated Python version
line-length = 88
Expand Down Expand Up @@ -238,3 +161,68 @@ extend-aliases = {xarray = "xr"}
ruff = [
"--extend-ignore=B018"
]

[tool.pytest.ini_options]
addopts = "--tb=short --color=yes -rsw --cov=weldx --cov-report=term-missing:skip-covered --doctest-modules"
#addopts = --tb=short --color=yes -rs -p no:cov
testpaths = "weldx"
# custom test markers, see https://docs.pytest.org/en/latest/example/markers.html#mark-examples
markers = "slow: marks tests as slow to run (skipped by default, enable with --runslow option)"
asdf_schema_root = "weldx/schemas/weldx.bam.de/weldx" # TODO: couldn't we just use the entry points to resolve this?
#asdf_schema_tests_enabled = true
#asdf_schema_skip_tests =
# weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.schema.yaml
norecursedirs = [
"doc",
".ipynb_checkpoints",
]
filterwarnings = [
"ignore::DeprecationWarning:traittypes.*:",
"ignore:Passing method to :FutureWarning:xarray.*:",
"error::pint.UnitStrippedWarning",
#"error::FutureWarning", # todo: we want to enable this, as it notifies us about upcoming failures due to upstream changes.
]

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

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

# ignore class __repr__-like functions:
"def __repr__",
"def __str__",
"def _ipython_display_",
]

[tool.mypy]
python_version = "3.9"
files = "weldx"
ignore_missing_imports = true # TODO: this is bad!
strict_optional = false
pretty = true
allow_redefinition = true
show_error_context = true
show_error_codes = true
show_column_numbers = true
sqlite_cache = true

# MyPy per-module options:
[[tool.mypy.overrides]]
module = ["weldx.asdf.*", "weldx.tags.*", "weldx.tests.*", "weldx.welding.groove.*", "weldx.geometry.*" ]
ignore_errors = true

# this is a workaround for an xarray related mypy bug
# see https://github.com/python/mypy/pull/9495
# and https://github.com/space-physics/msise00/commit/8b59a9383dd6fcc54b7dac74eb95a350308d7b62
# TODO: is this still mandatory?
[[tool.mypy.overrides]]
module = "xarray"
follow_imports = "skip"
ignore_errors = true

0 comments on commit a3ac2a3

Please sign in to comment.