diff --git a/.github/workflows/test-torchfix.yml b/.github/workflows/test-torchfix.yml index e6a1aac..c465286 100644 --- a/.github/workflows/test-torchfix.yml +++ b/.github/workflows/test-torchfix.yml @@ -10,12 +10,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Install requirements + - name: Upgrade build dependencies run: | - pip3 install -r requirements-dev.txt + pip3 install -U pip + pip3 install -U setuptools - name: Install TorchFix run: | - pip3 install . + pip3 install ".[dev]" - name: Run pytest run: | pytest tests diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ea84a36..8995e56 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,22 +20,22 @@ We actively welcome your pull requests. ## Linting -We use `black`, `flake8`, and `mypy` to lint the code. -``` -pip install -r requirements-dev.txt +We use `black`, `flake8`, and `mypy` to lint the code. Configuration is available to run lints via `pre-commit`. + +```shell +pip install ".[dev]" ``` Linting via pre-commit hook: -``` -# install pre-commit hooks for the first time -pre-commit install +```shell # manually run pre-commit hooks on all files (runs all linters) pre-commit run --all-files ``` Manually running individual linters: -``` + +```shell black . flake8 mypy . diff --git a/pyproject.toml b/pyproject.toml index 8c27031..7114063 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +[build-system] +requires = ["setuptools >= 65.0"] +build-backend = "setuptools.build_meta" + [project] name = "TorchFix" requires-python = ">=3.9" @@ -9,7 +13,22 @@ classifiers = [ "Programming Language :: Python" ] dynamic = ["version"] -dependencies = ["flake8>=3.8.2", "PyYAML", "libcst>=1.1.0,<1.2.0"] +dependencies = [ + "flake8>=3.8.2", + "PyYAML", + "libcst>=1.1.0,<1.2.0" +] + +[project.optional-dependencies] +dev = [ + "flake8==6.0.0", + "pytest==7.2.0", + "libcst==1.1.0", + "types-PyYAML==6.0.7", + "mypy==1.7.0", + "black==24.4.0", + "pre-commit==3.7.0", +] [project.urls] Repository = "https://github.com/pytorch-labs/torchfix" diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 7910c57..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,7 +0,0 @@ -flake8==6.0.0 -pytest==7.2.0 -libcst==1.1.0 -types-PyYAML==6.0.7 -mypy==1.7.0 -black==24.4.0 -pre-commit==3.7.0 diff --git a/torchfix/visitors/__init__.py b/torchfix/visitors/__init__.py new file mode 100644 index 0000000..e69de29