From a1dd6d16c252c66bb81a7505ac7bf13fb57e4201 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sat, 13 Jul 2024 13:32:26 -0400 Subject: [PATCH] Bump ruff to 0.5, normalize conda recipes, clean docs to only use makefile commands Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com> --- Makefile | 1 + conda/dev-environment-unix.yml | 7 +++-- conda/dev-environment-win.yml | 7 ++++- csp/tests/impl/test_struct.py | 12 ++++---- docs/wiki/dev-guides/Build-CSP-from-Source.md | 29 ------------------- pyproject.toml | 2 +- 6 files changed, 18 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index 6c8bf66f0..d5d438710 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,7 @@ lints: lint fix-py: python -m isort csp/ examples/ setup.py + python -m ruff check --fix csp/ examples/ setup.py python -m ruff format csp/ examples/ setup.py fix-cpp: diff --git a/conda/dev-environment-unix.yml b/conda/dev-environment-unix.yml index d6ad291c8..5f35fc84b 100644 --- a/conda/dev-environment-unix.yml +++ b/conda/dev-environment-unix.yml @@ -15,7 +15,6 @@ dependencies: - exprtk - flex - graphviz - - python-graphviz - gtest - httpx>=0.20,<1 - isort>=5,<6 @@ -24,6 +23,7 @@ dependencies: - libboost-headers>=1.80.0 - librdkafka - lz4-c + - make - mamba - mdformat>=0.7.17,<0.8 - ninja @@ -33,17 +33,18 @@ dependencies: - polars - psutil - pyarrow=16 - - pytz - pytest - pytest-asyncio - pytest-cov - pytest-sugar - python<3.13 + - python-graphviz - python-rapidjson + - pytz - rapidjson - requests - ruamel.yaml - - ruff>=0.3,<0.4 + - ruff>=0.5,<0.6 - scikit-build - sqlalchemy - tar diff --git a/conda/dev-environment-win.yml b/conda/dev-environment-win.yml index 8c1ce5fdb..d230d2e38 100644 --- a/conda/dev-environment-win.yml +++ b/conda/dev-environment-win.yml @@ -3,6 +3,7 @@ channels: - conda-forge - nodefaults dependencies: +# - bison # not available on windows - brotli - build - bump2version>=1 @@ -12,6 +13,7 @@ dependencies: - cyrus-sasl - deprecated - exprtk +# - flex # not available on windows - graphviz - gtest - httpx>=0.20,<1 @@ -42,10 +44,13 @@ dependencies: - rapidjson - requests - ruamel.yaml - - ruff>=0.3,<0.4 + - ruff>=0.5,<0.6 - scikit-build - sqlalchemy +# - tar # not available on windows - threadpoolctl - tornado - twine +# - unzip # not available on windows - wheel +# - zip # not available on windows diff --git a/csp/tests/impl/test_struct.py b/csp/tests/impl/test_struct.py index ae9f2e452..0d20d4f6e 100644 --- a/csp/tests/impl/test_struct.py +++ b/csp/tests/impl/test_struct.py @@ -858,16 +858,16 @@ class S(csp.Struct): i: 2 f: 2.5 b: false - ls: - - 1 - - 2 + ls: + - 1 + - 2 - 3 lc: - value: [1,2,3] set_value: ["x","y","z"] - - value: + value: - 4 """ @@ -2540,7 +2540,7 @@ def test_list_field_repr(self): for ann_typ in struct_list_annotation_types: for typ, v in struct_list_test_values.items(): # Excluding str due to own repr implementation - if typ != str: + if typ is not str: class A(csp.Struct): a: ann_typ[typ] @@ -2562,7 +2562,7 @@ def test_list_field_str(self): for ann_typ in struct_list_annotation_types: for typ, v in struct_list_test_values.items(): # Excluding str due to own repr implementation - if typ != str: + if typ is not str: class A(csp.Struct): a: ann_typ[typ] diff --git a/docs/wiki/dev-guides/Build-CSP-from-Source.md b/docs/wiki/dev-guides/Build-CSP-from-Source.md index c24299f08..bd9f1422e 100644 --- a/docs/wiki/dev-guides/Build-CSP-from-Source.md +++ b/docs/wiki/dev-guides/Build-CSP-from-Source.md @@ -124,9 +124,6 @@ git submodule update --init --recursive ```bash # for vcpkg sudo make dependencies-debian -# or -# sudo apt-get install -y automake bison cmake curl flex ninja-build tar unzip zip - # for g++ sudo apt install build-essential ``` @@ -136,9 +133,6 @@ sudo apt install build-essential ```bash # for vcpkg sudo make dependencies-fedora -# or -# yum install -y automake bison cmake curl flex perl-IPC-Cmd tar unzip zip - # for g++ sudo dnf group install "Development Tools" ``` @@ -150,8 +144,6 @@ sudo dnf group install "Development Tools" ```bash # for vcpkg make dependencies-mac -# or -# brew install bison cmake flex make ninja ``` ### Install Python dependencies @@ -160,11 +152,6 @@ Python build and develop dependencies are specified in the `pyproject.toml`, but ```bash make requirements - -# or -# python -m pip install toml -# python -m pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))'` -# python -m pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["project"]["optional-dependencies"]["develop"]))'` ``` Note that these dependencies would otherwise be installed normally as part of [PEP517](https://peps.python.org/pep-0517/) / [PEP518](https://peps.python.org/pep-0518/). @@ -178,8 +165,6 @@ make build # on aarch64 linux, comment the above command and use this instead # VCPKG_FORCE_SYSTEM_BINARIES=1 make build -# or -# python setup.py build build_ext --inplace ``` ### Building on `aarch64` Linux @@ -210,44 +195,30 @@ CSP has linting and auto formatting. ```bash make lint-cpp -# or -# clang-format --dry-run -Werror -i -style=file `find ./cpp/ -name "*.*pp"` ``` **C++ Autoformatting** ```bash make fix-cpp -# or -# clang-format -i -style=file `find ./cpp/ -name "*.*pp"` ``` **Python Linting** ```bash make lint-py -# or -# python -m isort --check csp/ setup.py -# python -m ruff check csp/ setup.py -# python -m ruff format --check csp/ setup.py ``` **Python Autoformatting** ```bash make fix-py -# or -# python -m isort csp/ setup.py -# python -m ruff format csp/ setup.py ``` **Documentation Linting** ```bash make lint-docs -# or -# python -m mdformat --check docs/wiki/ README.md examples/README.md -# python -m codespell_lib docs/wiki/ README.md examples/README.md ``` **Documentation Autoformatting** diff --git a/pyproject.toml b/pyproject.toml index fb02c2fb5..0b67505af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ develop = [ "codespell>=2.2.6,<2.3", "isort>=5,<6", "mdformat>=0.7.17,<0.8", - "ruff>=0.3,<0.4", + "ruff>=0.5,<0.6", # test "pytest", "pytest-asyncio",