Skip to content

Commit

Permalink
Revamp pre-commit config
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh-cpp committed Sep 3, 2023
1 parent c90c623 commit 9e63959
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 102 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ jobs:
- uses: pre-commit/[email protected]

build:
name:
Build and test with Python ${{ matrix.python-version }} on ${{
name: Build and test with Python ${{ matrix.python-version }} on ${{
matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
strategy:
Expand Down
105 changes: 35 additions & 70 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"

default_language_version:
python: python3.10

repos:
- repo: https://github.com/psf/black
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.7.0
hooks:
- id: black-jupyter
Expand All @@ -21,91 +18,59 @@ repos:
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
exclude: ^docs
- id: mixed-line-ending
- id: name-tests-test
args: ["--pytest-test-first"]
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.286"
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-eval
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: ruff
args: ["--fix", "--show-fixes"]

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.1.0"
hooks:
- id: pyproject-fmt

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
hooks:
- id: mypy
files: src
args: []
additional_dependencies:
- numpy
- packaging

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.2"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]
exclude: assets/js/webapp\.js

- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
args: ["-E"]
additional_dependencies: [black==22.8.0]
additional_dependencies: [black==23.1.0]

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: isort
args: ["-a", "from __future__ import annotations"]
- id: python-check-blanket-type-ignore
exclude: ^src/vector/backends/_numba_object.py$
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: pyupgrade
- id: nbqa-pyupgrade
args: ["--py37-plus"]

- repo: https://github.com/hadialqattan/pycln
rev: v2.2.2
hooks:
- id: pycln
additional_dependencies: [click<8.1]
args: [--all]
stages: [manual]

- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa
exclude: docs/conf.py
additional_dependencies: &flake8_dependencies
- flake8-bugbear
- flake8-print

- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: *flake8_dependencies

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
hooks:
- id: mypy
files: riemapp
args: [--show-error-codes]
additional_dependencies:
- numpy==1.22.0
- packaging

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.5
hooks:
- id: shellcheck

- repo: local
hooks:
- id: disallow-caps
name: Disallow improper capitalization
language: pygrep
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
exclude: .pre-commit-config.yaml
- id: nbqa-isort
args: ["--float-to-top"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Users and learners may use riemapp to:
- Right now, `riemapp` aliases the geometries provided by `manim` under
`riemapp.geometry`. Users can either use these alias classes or directly use
the `MObject`s provided by `manim`.
- `riemapp` programatically generates `manim` animations, and the code for this
- `riemapp` programmatically generates `manim` animations, and the code for this
is available under `riemapp.core`. All of the information added by a user is
passed into a placeholder class which inherits `manim.Scene`. This class'
object is then used to render the animation.
Expand Down
47 changes: 21 additions & 26 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
[build-system]
build-backend = "hatchling.build"
requires = [
"hatch-vcs",
"hatchling"
"hatchling",
]
build-backend = "hatchling.build"


[project]
name = "riemapp"
description = "Manim powered complex mappings."
readme = "README.md"
authors = [
{ name = "Saransh Chopra", email = "[email protected]" },
{ name = "Agriya Khetarpal", email = "[email protected]" },
{ name = "Naman Priyadarshi", email = "[email protected]" },
{ name = "Onkar Mahapatra", email = "[email protected]" },
{ name = "Parth Tripathi", email = "[email protected]" },
]
description = "Manim powered complex mappings."
readme = "README.md"
requires-python = ">=3.7"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
Expand All @@ -35,42 +33,44 @@ classifiers = [
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]
dynamic = ["version"]
dynamic = [
"version",
]
dependencies = [
"manim >=0.16.0",
"manim>=0.16",
]

[project.optional-dependencies]
test = [
"pytest >=6",
"pytest-cov >=3",
]
dev = [
"pytest >=6",
"pytest-cov >=3",
"pytest>=6",
"pytest-cov>=3",
]
docs = [
"markdown-callouts>=0.2.0",
"markdown-callouts>=0.2",
"mkdocs>=1.3.1",
"mkdocs-include-exclude-files>=0.0.1",
"mkdocs-jupyter>=0.21.0",
"mkdocs-jupyter>=0.21",
"mkdocs-material>=8.3.9",
"mkdocstrings-python>=0.7.1",
"mkdocstrings-python-legacy>=0.2.3",
"pymdown-extensions>=9.5",
]

test = [
"pytest>=6",
"pytest-cov>=3",
]
[project.urls]
Homepage = "https://github.com/Saransh-cpp/riemapp"
"Bug Tracker" = "https://github.com/Saransh-cpp/riemapp/issues"
Discussions = "https://github.com/Saransh-cpp/riemapp/discussions"
Changelog = "https://riemapp.readthedocs.io/en/latest/changelog/"
Discussions = "https://github.com/Saransh-cpp/riemapp/discussions"
Documentation = "https://riemapp.readthedocs.io/"
Homepage = "https://github.com/Saransh-cpp/riemapp"

[tool.hatch]
version.source = "vcs"
build.hooks.vcs.version-file = "riemapp/version.py"

[tool.isort]
profile = "black"

[tool.pytest.ini_options]
minversion = "6.0"
Expand All @@ -86,7 +86,6 @@ testpaths = [
"tests",
]


[tool.mypy]
files = "riemapp"
python_version = "3.8"
Expand All @@ -103,7 +102,3 @@ disallow_untyped_defs = false
disallow_untyped_calls = false
disallow_subclassing_any = false
ignore_missing_imports = true


[tool.isort]
profile = "black"
4 changes: 2 additions & 2 deletions riemapp/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Animate(Scene):
"""
A placeholder class for manim Scene.
This class is used to construct and generate manim animations programatically.
This class is used to construct and generate manim animations programmatically.
Args:
f:
Expand Down Expand Up @@ -118,7 +118,7 @@ def __repr__(self) -> str:

def construct(self) -> None:
"""
The default manim constructer
The default manim constructor
"""
self.add_numberplane and self.add(NumberPlane())
self.play(Create(self.f, run_time=self.run_time))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_polygon():
polygon = rp.geometry.Polygon([2, 4, 8], [1, 0, 0], [4, 4, 8])
assert (
polygon.__repr__()
== f"Polygon(vertices={[v for v in polygon.vertices]}) (alias for manim.Polygon)"
== f"Polygon(vertices={[v for v in polygon.vertices]}) (alias for manim.Polygon)" # noqa: E501
)
assert isinstance(polygon, (rp.geometry.Polygon, manim.Polygon))
assert polygon.vertices == ([2, 4, 8], [1, 0, 0], [4, 4, 8])
Expand Down

0 comments on commit 9e63959

Please sign in to comment.