Skip to content

Commit

Permalink
Bump ruff to 0.5, normalize conda recipes, clean docs to only use mak…
Browse files Browse the repository at this point in the history
…efile commands

Signed-off-by: Tim Paine <[email protected]>
  • Loading branch information
timkpaine committed Aug 9, 2024
1 parent cc77b7d commit a1dd6d1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 40 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions conda/dev-environment-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies:
- exprtk
- flex
- graphviz
- python-graphviz
- gtest
- httpx>=0.20,<1
- isort>=5,<6
Expand All @@ -24,6 +23,7 @@ dependencies:
- libboost-headers>=1.80.0
- librdkafka
- lz4-c
- make
- mamba
- mdformat>=0.7.17,<0.8
- ninja
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion conda/dev-environment-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ channels:
- conda-forge
- nodefaults
dependencies:
# - bison # not available on windows
- brotli
- build
- bump2version>=1
Expand All @@ -12,6 +13,7 @@ dependencies:
- cyrus-sasl
- deprecated
- exprtk
# - flex # not available on windows
- graphviz
- gtest
- httpx>=0.20,<1
Expand Down Expand Up @@ -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
12 changes: 6 additions & 6 deletions csp/tests/impl/test_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

Expand Down Expand Up @@ -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]
Expand All @@ -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]
Expand Down
29 changes: 0 additions & 29 deletions docs/wiki/dev-guides/Build-CSP-from-Source.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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"
```
Expand All @@ -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
Expand All @@ -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/).
Expand All @@ -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
Expand Down Expand Up @@ -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**
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit a1dd6d1

Please sign in to comment.