Skip to content

Commit 7777fd6

Browse files
dguidoclaude
andcommitted
Address review feedback: Switch to hatchling, remove pip, use ruff-action
- Switch build backend from setuptools to hatchling for simpler configuration - Remove all pip support, require uv for installation (10-100x faster) - Update GitHub Actions to use official ruff-action for better performance - Remove daily schedule from ruff workflow (wasteful for just linting) - Clean up ruff exclude configuration using extend-exclude - Update README.md with proper uv tool commands for installation - Update Makefile to use uv exclusively - Update CONTRIBUTING.md to remove pip references - Keep optional-dependencies instead of dependency-groups (uv doesn't fully support PEP 735 yet) All changes tested and verified working: - Build system creates identical wheels/sdists - All 14 entry points preserved and functional - Editable installs work correctly - Ruff configuration simplified and working Note: funding.json changes are from case sensitivity fix already in master 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 37929a8 commit 7777fd6

File tree

5 files changed

+48
-84
lines changed

5 files changed

+48
-84
lines changed

.github/workflows/ruff.yml

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ on:
1616
- "**/*.yaml"
1717
- "pyproject.toml"
1818
- ".github/workflows/ruff.yml"
19-
schedule:
20-
# run CI every day even if no PRs/merges occur
21-
- cron: '0 12 * * *'
2219

2320
concurrency:
2421
group: ${{ github.workflow }}-${{ github.ref }}
@@ -33,28 +30,12 @@ jobs:
3330
- name: Checkout Code
3431
uses: actions/checkout@v4
3532

36-
- name: Set up Python 3.12
37-
uses: actions/setup-python@v5
38-
with:
39-
python-version: "3.12"
40-
41-
- name: Install lint dependencies
42-
run: |
43-
# Using pip for CI stability, but uv is recommended for local development
44-
python -m pip install --upgrade pip
45-
# Install latest ruff within 0.x range to get updates but avoid breaking changes
46-
pip install "ruff>=0.12.0,<1.0" "yamllint>=1.35.1"
47-
4833
- name: Run Ruff linter
49-
run: |
50-
echo "::group::Running Ruff checks"
51-
ruff check slither/ tests/ scripts/ || RUFF_EXIT=$?
52-
echo "::endgroup::"
53-
if [ "${RUFF_EXIT:-0}" -ne 0 ]; then
54-
echo "❌ Ruff check failed. Run 'make reformat' or 'ruff check --fix' locally to fix issues."
55-
exit $RUFF_EXIT
56-
fi
57-
echo "✅ Ruff check passed"
34+
uses: astral-sh/ruff-action@v1
35+
with:
36+
version: ">=0.12.0"
37+
args: "check"
38+
src: "slither/ tests/ scripts/"
5839

5940
# Formatting check disabled to avoid changes to existing code
6041
# - name: Run Ruff formatter check
@@ -68,10 +49,19 @@ jobs:
6849
# fi
6950
# echo "✅ Formatting check passed"
7051

71-
- name: Run yamllint
52+
- name: Set up Python for yamllint
53+
uses: actions/setup-python@v5
54+
with:
55+
python-version: "3.12"
56+
57+
- name: Install and run yamllint
7258
run: |
59+
# Use uv for fast installation
60+
curl -LsSf https://astral.sh/uv/install.sh | sh
61+
source $HOME/.local/bin/env
62+
uv tool install yamllint
7363
echo "::group::Running yamllint"
74-
yamllint .github/ || YAML_EXIT=$?
64+
uvx yamllint .github/ || YAML_EXIT=$?
7565
echo "::endgroup::"
7666
if [ "${YAML_EXIT:-0}" -ne 0 ]; then
7767
echo "❌ YAML linting failed. Fix the YAML syntax errors shown above."

CONTRIBUTING.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,13 @@ A code walkthrough is available [here](https://www.youtube.com/watch?v=EUl3UlYSl
4747

4848
Instructions for installing a development version of Slither can be found in our [wiki](https://github.com/crytic/slither/wiki/Developer-installation).
4949

50-
For fast development setup, we recommend using [uv](https://github.com/astral-sh/uv):
50+
For development setup, we use [uv](https://github.com/astral-sh/uv):
5151
```bash
52-
# Install uv
52+
# Install uv if you haven't already
5353
curl -LsSf https://astral.sh/uv/install.sh | sh
5454

55-
# Quick setup with uv
56-
make dev-uv # Creates venv and installs all dependencies
57-
58-
# Or traditional setup with pip
59-
make dev
55+
# Setup development environment
56+
make dev # Creates venv and installs all dependencies
6057
```
6158

6259
To run the unit tests, you need to clone this repository and run `make test`. Run a specific test with `make test TESTS=$test_name`. The names of tests can be obtained with `pytest tests --collect-only`.

Makefile

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,14 @@ all:
4444
.PHONY: dev
4545
dev: $(VENV)/pyvenv.cfg
4646

47-
.PHONY: dev-uv
48-
dev-uv:
49-
# Fast development setup using uv
50-
uv venv $(VENV) --python 3.11
51-
uv pip install -e .[$(SLITHER_EXTRA)]
52-
5347
.PHONY: run
5448
run: $(VENV)/pyvenv.cfg
5549
@. $(VENV_BIN)/activate && slither $(ARGS)
5650

5751
$(VENV)/pyvenv.cfg: pyproject.toml
58-
# Create our Python 3 virtual environment
59-
# Option 1: Using uv (recommended - 10-100x faster)
60-
# uv venv env && uv pip install -e .[$(SLITHER_EXTRA)]
61-
# Option 2: Using standard pip
62-
python3 -m venv env
63-
$(VENV_BIN)/python -m pip install --upgrade pip
64-
$(VENV_BIN)/python -m pip install -e .[$(SLITHER_EXTRA)]
52+
# Create virtual environment and install dependencies using uv
53+
uv venv $(VENV) --python 3.11
54+
uv pip install --python $(VENV_BIN)/python -e .[$(SLITHER_EXTRA)]
6555

6656
.PHONY: lint
6757
lint: $(VENV)/pyvenv.cfg
@@ -89,7 +79,7 @@ doc: $(VENV)/pyvenv.cfg
8979
.PHONY: package
9080
package: $(VENV)/pyvenv.cfg
9181
. $(VENV_BIN)/activate && \
92-
python3 -m build
82+
uv build
9383

9484
.PHONY: edit
9585
edit:

README.md

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,34 +71,25 @@ slither tests/uninitialized.sol
7171
> Slither requires Python 3.8+.
7272
If you're **not** going to use one of the [supported compilation frameworks](https://github.com/crytic/crytic-compile), you need [solc](https://github.com/ethereum/solidity/), the Solidity compiler; we recommend using [solc-select](https://github.com/crytic/solc-select) to conveniently switch between solc versions.
7373

74-
### Using uv (Recommended)
74+
### Using uv
7575

76-
[uv](https://github.com/astral-sh/uv) is a fast Python package manager that's 10-100x faster than pip.
76+
[uv](https://github.com/astral-sh/uv) is a fast Python package manager that's 10-100x faster than pip. Slither requires uv for installation.
7777

7878
```console
7979
# Install uv if you haven't already
8080
curl -LsSf https://astral.sh/uv/install.sh | sh
8181

82-
# Install slither
83-
uv pip install slither-analyzer
84-
```
85-
86-
#### How to upgrade with uv
82+
# Install slither as a tool (recommended)
83+
uv tool install slither-analyzer
8784

88-
```console
89-
uv pip install --upgrade slither-analyzer
85+
# Or run slither ephemerally without installation
86+
uvx --with slither-analyzer slither <args>
9087
```
9188

92-
### Using Pip
89+
#### How to upgrade
9390

9491
```console
95-
python3 -m pip install slither-analyzer
96-
```
97-
98-
#### How to upgrade with pip
99-
100-
```console
101-
python3 -m pip install --upgrade slither-analyzer
92+
uv tool upgrade slither-analyzer
10293
```
10394

10495
### Using Brew
@@ -107,17 +98,19 @@ python3 -m pip install --upgrade slither-analyzer
10798
brew install slither-analyzer
10899
```
109100

110-
### Using Git
101+
### Using Git (for development)
111102

112103
```bash
113104
git clone https://github.com/crytic/slither.git && cd slither
114-
# Using uv (recommended)
115-
uv pip install .
116-
# Or using pip
117-
python3 -m pip install .
105+
106+
# Install as editable for development
107+
uv tool install -e .
108+
109+
# Or use uv run for testing without installation
110+
uv run slither <args>
118111
```
119112

120-
We recommend using a Python virtual environment, as detailed in the [Developer Installation Instructions](https://github.com/crytic/slither/wiki/Developer-installation), if you prefer to install Slither via git.
113+
The `-e` flag installs in editable mode, meaning changes to the source code are immediately reflected without reinstalling. The `uv run` command automatically creates a virtual environment and installs dependencies.
121114

122115
### Using Docker
123116

pyproject.toml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["setuptools>=61.0", "wheel"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
44

55
[project]
66
name = "slither-analyzer"
@@ -39,6 +39,8 @@ dependencies = [
3939
"eth-utils>=5.0.0",
4040
]
4141

42+
# Note: Using optional-dependencies for development tools until uv fully supports PEP 735
43+
# These are development dependencies, not optional features of the library
4244
[project.optional-dependencies]
4345
lint = [
4446
"ruff>=0.12.0,<1.0", # Use latest ruff, but cap at 1.0 to avoid breaking changes
@@ -80,26 +82,18 @@ slither-doctor = "slither.tools.doctor.__main__:main"
8082
slither-documentation = "slither.tools.documentation.__main__:main"
8183
slither-interface = "slither.tools.interface.__main__:main"
8284

83-
[tool.setuptools.packages.find]
84-
exclude = ["tests*", "docs*"]
85+
[tool.hatch.build.targets.wheel]
86+
packages = ["slither"]
8587

8688
[tool.ruff]
8789
# Match black's line length
8890
line-length = 100
8991
# Target Python 3.8+ (minimum version required by project)
9092
target-version = "py38"
91-
# Exclude test files and documentation
92-
exclude = [
93+
# Additional exclusions beyond defaults and .gitignore
94+
extend-exclude = [
9395
"tests/",
9496
"docs/",
95-
"build/",
96-
"dist/",
97-
".git",
98-
"__pycache__",
99-
".venv",
100-
"env/",
101-
"venv/",
102-
"*.egg-info/",
10397
]
10498

10599
[tool.ruff.lint]

0 commit comments

Comments
 (0)