Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre commit #83

Merged
merged 5 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/regression-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install numpy scipy numpy_groupies pytest-cov coverage coveralls \
sphinx_rtd_theme isort black pylint mypy
pip install .
python -m pip install coverage coveralls sphinx_rtd_theme
pip install ".[dev]"
- name: Check auto-formatters
run: |
isort --check .
Expand Down
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.11.5
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
language_version: python
13 changes: 7 additions & 6 deletions CONTRIBUTOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ current or filing a new [issue](https://github.com/sandialabs/pyttb/issues).
## Working on PYTTB locally
1. clone your fork and enter the directory
```
git clone [email protected]:<your username>/pyttb.git
cd pyttb
$ git clone [email protected]:<your username>/pyttb.git
$ cd pyttb
```
1. setup your desired python environment as appropriate

1. install dependencies
```
We use a mix of pyproject.toml, and setup.py currently. We are
still iterating on simplifying the setup procedure.
$ pip install -e ".[dev]"
$ make install_dev # shorthand for above
```

1. Checkout a branch and make your changes
Expand All @@ -25,9 +25,10 @@ current or filing a new [issue](https://github.com/sandialabs/pyttb/issues).
1. Formatters and linting
1. Run autoformatters from root of project (they will change your code)
```commandline
isort .
black .
$ isort .
$ black .
```
1. [We](./.pre-commit-config.yaml) optionally support [pre-commit hooks](https://pre-commit.com/) for this
1. Pylint and mypy coverage is work in progress (these only raise errors)
```commandline
mypy pyttb/
Expand Down
19 changes: 17 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,24 @@ BUILDDIR = ./docs/build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@echo "install: Install release build"
@echo "install_dev: Install dev build"
@echo "install_docs: Install docs build"
@echo "docs_help: Show additional docs commands"

.PHONY: help install install_dev install_docs Makefile

install:
python -m pip install -e .

.PHONY: help Makefile
install_dev:
python -m pip install -e ".[dev]"

install_docs:
python -m pip install -e ".[doc]"

docs_help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Expand Down
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ homepage = "https://github.com/sandialabs/pyttb"
coverage = "https://coveralls.io/github/sandialabs/pyttb"
documentation = "https://pyttb.readthedocs.io"

[project.optional-dependencies]
dev = [
"black",
"isort",
"pylint",
"mypy",
"pytest",
"pytest-cov",
]
doc = [
"sphinx_rtd_theme",
]

[tool.setuptools]
packages=["pyttb"]

[build-system]
requires = ["setuptools>=61.0", "numpy", "numpy_groupies", "scipy", "wheel"]
build-backend = "setuptools.build_meta"
Expand Down
19 changes: 0 additions & 19 deletions setup.py

This file was deleted.