Skip to content

Commit

Permalink
Install autoformatting tools and add formatting checks to CI (Transfo…
Browse files Browse the repository at this point in the history
…rmerLensOrg#270)

* Install formatting tools

* Add linting to CI

* Autoformat all files
  • Loading branch information
rusheb authored May 10, 2023
1 parent e14c7b2 commit 9e034ee
Show file tree
Hide file tree
Showing 39 changed files with 2,458 additions and 1,561 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ jobs:
run: |
poetry lock --check
poetry install --with dev
- name: Check format
run: make check-format
- name: Unit test
run: make unit-test
- name: Acceptance test
Expand Down
23 changes: 12 additions & 11 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,33 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'TransformerLens'
copyright = '2023, Neel Nanda'
author = 'Neel Nanda'
release = '0.0.0'
project = "TransformerLens"
copyright = "2023, Neel Nanda"
author = "Neel Nanda"
release = "0.0.0"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ['sphinx.ext.autodoc',
'sphinxcontrib.napoleon',
'myst_parser',
"sphinx.ext.githubpages"]
extensions = [
"sphinx.ext.autodoc",
"sphinxcontrib.napoleon",
"myst_parser",
"sphinx.ext.githubpages",
]

source_suffix = {
".rst": "restructuredtext",
".md": "markdown",
}

templates_path = ['_templates']
templates_path = ["_templates"]
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "furo"
html_title = "TransformerLens Documentation"
html_static_path = ['_static']
html_static_path = ["_static"]
3 changes: 2 additions & 1 deletion easy_transformer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging

logging.warning("DEPRECATED: Library has been renamed, import transformer_lens instead")
from transformer_lens import *
from transformer_lens import *
10 changes: 10 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
format:
poetry run python -m pycln --all . --exclude "__init__.py"
poetry run python -m isort format .
poetry run python -m black .

check-format:
poetry run python -m pycln --check --all . --exclude "__init__.py"
poetry run python -m isort --check-only .
poetry run python -m black --check .

test:
make unit-test
make acceptance-test
Expand Down
1,411 changes: 824 additions & 587 deletions poetry.lock

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ mypy = ">=0.991"
jupyter = ">=1.0.0"
circuitsvis = ">=1.38.1"
plotly = ">=5.12.0"
isort = "5.8.0"
black = "^23.3.0"
pycln = "^2.1.3"

[tool.poetry.group.jupyter.dependencies]
jupyterlab = ">=3.5.0"
Expand All @@ -52,4 +55,8 @@ filterwarnings = [
# Ignore numpy.distutils deprecation warning caused by pandas
# More info: https://numpy.org/doc/stable/reference/distutils.html#module-numpy.distutils
"ignore:distutils Version classes are deprecated:DeprecationWarning"
]
]

[tool.isort]
profile = "black"
extend_skip = ["__init__.py"]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"fancy_einsum",
"rich",
"accelerate",
"typing-extensions"
"typing-extensions",
],
extras_require={"dev": ["pytest", "mypy", "pytest-cov"]},
)
Loading

0 comments on commit 9e034ee

Please sign in to comment.