Skip to content

Commit

Permalink
Move development dependencies to pyproject.toml (#64)
Browse files Browse the repository at this point in the history
Minor PR to kick-off contributing to `torchfix`. I'm developing new
functionality, which I plan to contribute in follow-up PRs.

Changes:
- Move `requirements-dev.txt` to `optional-dependencies`
- Explicitly set the setuptools build system
- Omit `pip install pre-commit` in CONTRIBUTING.md, already included in
dev dependencies
  • Loading branch information
sbrugman authored Aug 30, 2024
1 parent 8aef63b commit 555bb8d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 18 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test-torchfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
21 changes: 20 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
requires = ["setuptools >= 65.0"]
build-backend = "setuptools.build_meta"

[project]
name = "TorchFix"
requires-python = ">=3.9"
Expand All @@ -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"
Expand Down
7 changes: 0 additions & 7 deletions requirements-dev.txt

This file was deleted.

Empty file added torchfix/visitors/__init__.py
Empty file.

0 comments on commit 555bb8d

Please sign in to comment.