diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7ef9c3eb..2efd63cd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: check-github-workflows - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.7 + rev: v0.11.11 hooks: - - id: ruff - args: [--fix] + - id: ruff-check + - id: ruff-format \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 27d2d8ff..b506a00d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,40 +1,33 @@ [build-system] -requires = ["flit_core >=3.2,<3.11"] +requires = ["flit_core >=3.2,<4"] build-backend = "flit_core.buildapi" [project] name = "ansys-tools-common" -version = "0.8.dev0" +version = "0.1.dev0" description = "A set of tools for PyAnsys libraries" readme = "README.rst" requires-python = ">=3.10,<4" -license = { file = "LICENSE" } +license = "MIT" +license-files = ["LICENSE"] authors = [{ name = "ANSYS, Inc.", email = "pyansys.core@ansys.com" }] maintainers = [{ name = "ANSYS, Inc.", email = "pyansys.core@ansys.com" }] classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Science/Research", "Topic :: Scientific/Engineering :: Information Analysis", - "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -dependencies = [ - -] +dependencies = [] [project.optional-dependencies] -tests = [ - -] - -doc = [ - -] +tests = [] +doc = [] [project.urls] Source = "https://github.com/ansys/ansys-tools" @@ -46,17 +39,9 @@ Releases = "https://github.com/ansys/ansys-tools/releases/" [tool.flit.module] name = "ansys.tools" -[tool.black] -line-length = 100 - -[tool.isort] -profile = "black" -force_sort_within_sections = true -line_length = 100 -src_paths = ["doc", "src", "tests"] - [tool.ruff] line-length = 120 +fix = true extend-exclude = ["examples/**/*.py"] [tool.ruff.lint] @@ -68,12 +53,14 @@ select = [ "N", # pep8-naming, see https://beta.ruff.rs/docs/rules/#pep8-naming-n "PTH", # flake8-use-pathlib, https://beta.ruff.rs/docs/rules/#flake8-use-pathlib-pth ] -ignore = ["D416"] +ignore = [] [tool.ruff.format] quote-style = "double" -indent-style = "tab" +indent-style = "space" line-ending = "auto" +docstring-code-format = true +docstring-code-line-length = "dynamic" [tool.ruff.lint.isort] combine-as-imports = true @@ -82,7 +69,7 @@ known-first-party = ["ansys"] [tool.ruff.lint.pydocstyle] # Settings: https://docs.astral.sh/ruff/settings/#lintpydocstyle -convention = "google" +convention = "numpy" [tool.towncrier] package = "ansys.tools" diff --git a/src/ansys/tools/__init__.py b/src/ansys/tools/__init__.py index 963cb56a..984669a9 100644 --- a/src/ansys/tools/__init__.py +++ b/src/ansys/tools/__init__.py @@ -19,4 +19,4 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Main module.""" \ No newline at end of file +"""Main module.""" diff --git a/src/ansys/tools/exceptions.py b/src/ansys/tools/exceptions.py index e4118c5b..ed8370bd 100644 --- a/src/ansys/tools/exceptions.py +++ b/src/ansys/tools/exceptions.py @@ -51,12 +51,13 @@ class AnsysTypeError(AnsysError): def __init__(self, expected_type: str | type, actual_type: str | type = None) -> None: """Initialize the exception with expected and actual types.""" expected_type = expected_type if isinstance(expected_type, str) else expected_type.__name__ - actual_type= actual_type if isinstance(actual_type, str) else actual_type.__name__ + actual_type = actual_type if isinstance(actual_type, str) else actual_type.__name__ message = f"Expected type {expected_type}, but got {actual_type}." super().__init__(message) self.expected_type = expected_type self.actual_type = actual_type + class AnsysLogicError(AnsysError): """Exception raised when an unexpected logical condition occurs.