Skip to content

Commit 10fd0cd

Browse files
committed
update development workflow
use uv and Makefile for commands, switch to ruff for linting, add dependency groups
1 parent 9458109 commit 10fd0cd

File tree

8 files changed

+144
-177
lines changed

8 files changed

+144
-177
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ __pycache__/
44
*$py.class
55
.pytest_cache/
66

7+
78
# C extensions
89
*.so
910

@@ -110,4 +111,6 @@ venv.bak/
110111
*.todo
111112
/extern_docs
112113
.vscode/
113-
docs/source/README.md
114+
docs/source/README.md
115+
uv.lock
116+
.ruff_cache/

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
test:
2+
uv run pytest
3+
4+
spell:
5+
uv run codespell .
6+
7+
lint:
8+
uv run ruff check
9+
10+
format:
11+
# uv run ruff format
12+
uv run black . --config ./pyproject.toml
13+
14+
build:
15+
uv build
16+
17+
doc:
18+
cd docs && $(MAKE) html
19+
20+
.PHONY:
21+

NEWS.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
* restructure imports
77
* switch to pyproject.toml
88
** move file location of demo scripts
9+
** use separate dependencies for development, demo and for generating the documentation
10+
** use ruff instead of pylint
11+
* use uv for development workflow
12+
** add Makefile to automate simple tasks
13+
* move most constant values into separate module for tables, remove duplicate entries
914

1015
## v0.4.10, 10.2025
1116
* @sebastiantuinstra fixed issue #19: Iteration loop in p_hrho(h, rho) used incorrect value for convergence check.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pyXSteam is a Python library designed for calculating thermodynamic properties o
44

55
This library was ported from the original Matlab released by Magnus Holmgren. The original can be founbd at [Sourceforge](http://xsteam.sourceforge.net) and/or <http://www.x-eng.com>.
66

7-
A .NET implementation is availible thanks to the work of rogerlew here: [XSteamNET](https://github.com/rogerlew/XSteamNET).
7+
A .NET implementation is available thanks to the work of rogerlew here: [XSteamNET](https://github.com/rogerlew/XSteamNET).
88

99
XSteam provides (mostly) accurate steam and water properties from 0 -
1010
1000 bar and from 0 - 2000 °C according to the [IAPWS release IF-97](http://www.iapws.org/relguide/IF97-Rev.pdf). For

docs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
# You can set these variables from the command line.
55
SPHINXOPTS =
6-
SPHINXBUILD = sphinx-build
6+
SPHINXBUILD = uv run sphinx-build
77
SOURCEDIR = source
8-
BUILDDIR = build
8+
BUILDDIR = ../dist/sphinx-build
99

1010
# Put it first so that "make" without argument is like "make help".
1111
help:

pyXSteam/Tables.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
Ordinary Water Substances
1313
1414
* IAPWS SR2-01(2014) Revised Supplementary Release on Backward Equations for
15-
Pressure as a Function of Enthalpy and Entropy p(h,s) for Regions 1 and 2 of
16-
the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of
15+
Pressure as a Function of Enthalpy and Entropy p(h,s) for Regions 1 and 2 of
16+
the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of
1717
Water and Steam
1818
19-
* IAPWS SR3-03(2014) Revised Supplementary Release on Backward Equations for
19+
* IAPWS SR3-03(2014) Revised Supplementary Release on Backward Equations for
2020
the Functions T(p,h), v(p,h) and T(p,s), v(p,s) for Region 3 of the IAPWS Industrial
2121
Formulation 1997 for the Thermodynamic Properties of Water and Steam
2222
23-
* IAPWS SR4-04(2014) Revised Supplementary Release on Backward Equations p(h,s)
24-
for Region 3, Equations as a Function of h and s for the Region Boundaries, and
25-
an Equation Tsat(h,s) for Region 4 of the IAPWS Industrial Formulation 1997 for
26-
the Thermodynamic Properties of Water and Steam
23+
* IAPWS SR4-04(2014) Revised Supplementary Release on Backward Equations p(h,s)
24+
for Region 3, Equations as a Function of h and s for the Region Boundaries, and
25+
an Equation Tsat(h,s) for Region 4 of the IAPWS Industrial Formulation 1997 for
26+
the Thermodynamic Properties of Water and Steam
2727
2828
2929
"""

pyXSteam/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from .UnitConverter import UnitConverter
1212
from .Constants import UnitSystem, IceType
1313

14+
1415
__version__ = "0.5.0"
1516
__author__ = "drunsinn"
1617
__license__ = "MIT"

pyproject.toml

Lines changed: 103 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,16 @@ dependencies = []
1717
file = "LICENSE"
1818

1919
[project.optional-dependencies]
20-
SSH = ["numpy", "scipy", "matplotlib"]
20+
demo = [
21+
"matplotlib>=3.7.5",
22+
"numpy>=1.24.4",
23+
"scipy>=1.10.1",
24+
]
25+
documentation = [
26+
"myst-parser>=3.0.1",
27+
"sphinx>=7.1.2",
28+
"sphinx-autodoc-typehints>=2.0.1",
29+
]
2130

2231
[project.urls]
2332
"Homepage" = "https://github.com/drunsinn/pyXSteam"
@@ -27,6 +36,15 @@ SSH = ["numpy", "scipy", "matplotlib"]
2736
pyXSteamDemo = "pyXSteam.scripts.pyXSteamDemo:main"
2837
pyXSteamRankineDemo = "pyXSteam.scripts.pyXSteamRankineDemo:main"
2938

39+
[dependency-groups]
40+
dev = [
41+
"black>=24.8.0",
42+
"codespell>=2.4.1",
43+
"numpy>=1.24.4",
44+
"pytest>=8.3.5",
45+
"ruff>=0.14.0",
46+
]
47+
3048
[tool.setuptools]
3149
packages = ["pyXSteam"]
3250

@@ -47,173 +65,92 @@ log_format = "%(asctime)s %(levelname)s %(message)s"
4765
log_date_format = "%Y-%m-%d %H:%M:%S"
4866

4967
[tool.codespell]
50-
skip = "*.po,*.ts,./docs/build/*,./build/*,./dist/*,./.git,./.venv,*.pdf,*.m"
68+
skip = "*.po,*.ts,./docs/build/*,./build/*,./dist/*,./.git,./.venv,*.pdf,*.m,./*.egg-info/*"
5169
count = ""
5270
quiet-level = 3
5371

54-
[tool.pylint.main]
55-
fail-under = 9
56-
ignore = ["CVS"]
57-
ignore-patterns = ["^\\.#"]
58-
jobs = 0
59-
limit-inference-results = 100
60-
persistent = true
61-
py-version = "3.8"
62-
suggestion-mode = true
63-
64-
[tool.pylint.basic]
65-
argument-naming-style = "any"
66-
attr-naming-style = "snake_case"
67-
bad-names = ["foo", "bar", "baz", "toto", "tutu", "tata"]
68-
class-attribute-naming-style = "any"
69-
class-const-naming-style = "any"
70-
class-naming-style = "PascalCase"
71-
const-naming-style = "UPPER_CASE"
72-
docstring-min-length = -1
73-
function-naming-style = "any"
74-
good-names = ["i", "j", "k", "ex", "Run", "_", "pyXSteam"]
75-
inlinevar-naming-style = "any"
76-
method-naming-style = "any"
77-
module-naming-style = "any"
78-
no-docstring-rgx = "^_"
79-
property-classes = ["abc.abstractproperty"]
80-
variable-naming-style = "any"
81-
82-
[tool.pylint.classes]
83-
defining-attr-methods = [
84-
"__init__",
85-
"__new__",
86-
"setUp",
87-
"asyncSetUp",
88-
"__post_init__",
89-
]
90-
exclude-protected = [
91-
"_asdict",
92-
"_fields",
93-
"_replace",
94-
"_source",
95-
"_make",
96-
"os._exit",
97-
]
98-
valid-classmethod-first-arg = ["cls"]
99-
valid-metaclass-classmethod-first-arg = ["mcs"]
100-
101-
[tool.pylint.design]
102-
max-args = 5
103-
max-attributes = 7
104-
max-bool-expr = 5
105-
max-branches = 12
106-
max-locals = 15
107-
max-parents = 7
108-
max-public-methods = 20
109-
max-returns = 6
110-
max-statements = 50
111-
min-public-methods = 2
112-
113-
[tool.pylint.exceptions]
114-
overgeneral-exceptions = ["builtins.BaseException", "builtins.Exception"]
115-
116-
[tool.pylint.format]
117-
ignore-long-lines = "^\\s*(# )?<?https?://\\S+>?$"
118-
indent-after-paren = 4
119-
indent-string = " "
120-
max-line-length = 140
121-
max-module-lines = 1000
122-
123-
[tool.pylint.imports]
124-
known-third-party = ["enchant"]
125-
126-
[tool.pylint.logging]
127-
logging-format-style = "old"
128-
logging-modules = ["logging"]
129-
130-
[tool.pylint."messages control"]
131-
confidence = [
132-
"HIGH",
133-
"CONTROL_FLOW",
134-
"INFERENCE",
135-
"INFERENCE_FAILURE",
136-
"UNDEFINED",
137-
]
138-
disable = [
139-
#"raw-checker-failed",
140-
#"bad-inline-option",
141-
#"locally-disabled",
142-
#"file-ignored",
143-
#"suppressed-message",
144-
#"useless-suppression",
145-
#"deprecated-pragma",
146-
#"use-symbolic-message-instead",
147-
#"use-implicit-booleaness-not-comparison-to-string",
148-
#"use-implicit-booleaness-not-comparison-to-zero",
149-
#"consider-using-f-string",
72+
[tool.ruff]
73+
# Exclude a variety of commonly ignored directories.
74+
exclude = [
75+
".bzr",
76+
".direnv",
77+
".eggs",
78+
".git",
79+
".git-rewrite",
80+
".hg",
81+
".ipynb_checkpoints",
82+
".mypy_cache",
83+
".nox",
84+
".pants.d",
85+
".pyenv",
86+
".pytest_cache",
87+
".pytype",
88+
".ruff_cache",
89+
".svn",
90+
".tox",
91+
".venv",
92+
".vscode",
93+
"__pypackages__",
94+
"_build",
95+
"buck-out",
96+
"build",
97+
"dist",
98+
"node_modules",
99+
"site-packages",
100+
"venv",
150101
]
151102

152-
[tool.pylint.method_args]
153-
154-
timeout-methods = [
155-
"requests.api.delete",
156-
"requests.api.get",
157-
"requests.api.head",
158-
"requests.api.options",
159-
"requests.api.patch",
160-
"requests.api.post",
161-
"requests.api.put",
162-
"requests.api.request",
163-
]
164-
165-
[tool.pylint.miscellaneous]
166-
notes = ["FIXME", "XXX", "TODO", "ToDo"]
167-
168-
[tool.pylint.refactoring]
169-
max-nested-blocks = 5
170-
never-returning-functions = ["sys.exit", "argparse.parse_error"]
171-
172-
[tool.pylint.reports]
173-
evaluation = "max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))"
174-
score = true
175-
176-
[tool.pylint.similarities]
177-
ignore-comments = true
178-
ignore-docstrings = true
179-
ignore-imports = true
180-
ignore-signatures = true
181-
min-similarity-lines = 4
182-
183-
[tool.pylint.spelling]
184-
max-spelling-suggestions = 4
185-
spelling-ignore-comment-directives = "fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:"
186-
187-
[tool.pylint.typecheck]
188-
contextmanager-decorators = ["contextlib.contextmanager"]
189-
ignore-none = true
190-
ignore-on-opaque-inference = true
191-
ignored-checks-for-mixins = [
192-
"no-member",
193-
"not-async-context-manager",
194-
"not-context-manager",
195-
"attribute-defined-outside-init",
196-
]
197-
ignored-classes = [
198-
"optparse.Values",
199-
"thread._local",
200-
"_thread._local",
201-
"argparse.Namespace",
202-
]
203-
missing-member-hint = true
204-
missing-member-hint-distance = 1
205-
missing-member-max-choices = 1
206-
mixin-class-rgx = ".*[Mm]ixin"
207-
208-
[tool.pylint.variables]
209-
allow-global-unused-variables = true
210-
callbacks = ["cb_", "_cb"]
211-
dummy-variables-rgx = "_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_"
212-
ignored-argument-names = "_.*|^ignored_|^unused_"
213-
redefining-builtins-modules = [
214-
"six.moves",
215-
"past.builtins",
216-
"future.builtins",
217-
"builtins",
218-
"io",
219-
]
103+
# Same as Black.
104+
line-length = 140
105+
indent-width = 4
106+
107+
# Assume Python 3.11
108+
target-version = "py311"
109+
110+
[tool.ruff.lint]
111+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
112+
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
113+
# McCabe complexity (`C901`) by default.
114+
select = ["E4", "E7", "E9", "F"]
115+
ignore = []
116+
117+
# Allow fix for all enabled rules (when `--fix`) is provided.
118+
fixable = ["ALL"]
119+
unfixable = []
120+
121+
# Allow unused variables when underscore-prefixed.
122+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
123+
124+
[tool.ruff.lint.per-file-ignores]
125+
# Allow unused imports in `__init__.py` files.
126+
"__init__.py" = ["F401"]
127+
"pyXSteam/TransportProperties_HW.py" = ["F401"]
128+
"pyXSteam/Regions.py" = ["E741"]
129+
"pyXSteam/RegionBorders.py" = ["E741"]
130+
131+
[tool.ruff.format]
132+
# Like Black, use double quotes for strings.
133+
quote-style = "double"
134+
135+
# Like Black, indent with spaces, rather than tabs.
136+
indent-style = "space"
137+
138+
# Like Black, respect magic trailing commas.
139+
skip-magic-trailing-comma = false
140+
141+
# Like Black, automatically detect the appropriate line ending.
142+
line-ending = "auto"
143+
144+
# Enable auto-formatting of code examples in docstrings. Markdown,
145+
# reStructuredText code/literal blocks and doctests are all supported.
146+
#
147+
# This is currently disabled by default, but it is planned for this
148+
# to be opt-out in the future.
149+
docstring-code-format = false
150+
151+
# Set the line length limit used when formatting code snippets in
152+
# docstrings.
153+
#
154+
# This only has an effect when the `docstring-code-format` setting is
155+
# enabled.
156+
docstring-code-line-length = "dynamic"

0 commit comments

Comments
 (0)