diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 4b89ef8..aa5ab10 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.2.0 +current_version = 1.2.1 commit = True tag = True diff --git a/.github/workflows/conda_ci.yml b/.github/workflows/conda_ci.yml index 4b61ee6..caa38d5 100644 --- a/.github/workflows/conda_ci.yml +++ b/.github/workflows/conda_ci.yml @@ -57,7 +57,7 @@ jobs: - name: "Install package" run: | - $CONDA/bin/conda install -c file://$(pwd)/conda-bld formate=1.2.0=py_1 -y || exit 1 + $CONDA/bin/conda install -c file://$(pwd)/conda-bld formate=1.2.1=py_1 -y || exit 1 - name: "Run Tests" run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2d1ab3d..04cfd5b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: - id: end-of-file-fixer - repo: https://github.com/domdfcoding/pre-commit-hooks - rev: v0.5.0 + rev: v0.6.0 hooks: - id: requirements-txt-sorter args: @@ -80,12 +80,15 @@ repos: - id: snippet-fmt - repo: https://github.com/python-formate/formate - rev: v1.1.2 + rev: v1.2.0 hooks: - id: formate exclude: ^(doc-source/conf|__pkginfo__|setup)\.(_)?py$ additional_dependencies: - formate-trailing-commas>=0.1.1 + types_or: + - python + - pyi - repo: https://github.com/python-coincidence/dep_checker rev: v0.9.0 diff --git a/README.rst b/README.rst index 1c707e5..85424d8 100644 --- a/README.rst +++ b/README.rst @@ -111,7 +111,7 @@ See `the documentation`_ for more information. .. |language| image:: https://img.shields.io/github/languages/top/python-formate/formate :alt: GitHub top language -.. |commits-since| image:: https://img.shields.io/github/commits-since/python-formate/formate/v1.2.0 +.. |commits-since| image:: https://img.shields.io/github/commits-since/python-formate/formate/v1.2.1 :target: https://github.com/python-formate/formate/pulse :alt: GitHub commits since tagged version diff --git a/doc-source/index.rst b/doc-source/index.rst index 7b12567..498d5bf 100644 --- a/doc-source/index.rst +++ b/doc-source/index.rst @@ -112,7 +112,7 @@ formate :alt: GitHub top language .. |commits-since| github-shield:: - :commits-since: v1.2.0 + :commits-since: v1.2.1 :alt: GitHub commits since tagged version .. |commits-latest| github-shield:: diff --git a/doc-source/requirements.txt b/doc-source/requirements.txt index ee4fdc4..86109e5 100644 --- a/doc-source/requirements.txt +++ b/doc-source/requirements.txt @@ -7,6 +7,7 @@ furo==2021.06.18b36 html-section>=0.3.0 roman>=4.0 seed-intersphinx-mapping>=1.2.2 +setuptools<81 sphinx>=3.0.3 sphinx-copybutton>=0.5.2 sphinx-debuginfo>=0.2.2 diff --git a/doc-source/usage.rst b/doc-source/usage.rst index 3ac46ab..e837a68 100644 --- a/doc-source/usage.rst +++ b/doc-source/usage.rst @@ -26,7 +26,7 @@ To do so, add the following to your `.pre-commit-config.yaml `_ file: .. pre-commit:: - :rev: 1.2.0 + :rev: 1.2.1 :hooks: formate :args: --verbose diff --git a/formate/__init__.py b/formate/__init__.py index 3402b38..e9bdc77 100644 --- a/formate/__init__.py +++ b/formate/__init__.py @@ -50,7 +50,7 @@ __author__: str = "Dominic Davis-Foster" __copyright__: str = "2020-2021 Dominic Davis-Foster" __license__: str = "MIT License" -__version__: str = "1.2.0" +__version__: str = "1.2.1" __email__: str = "dominic@davis-foster.co.uk" __all__ = ("call_hooks", "reformat_file", "Reformatter", "isort_hook", "yapf_hook") @@ -255,18 +255,22 @@ class Reformatter: .. autosummary-widths:: 5/16 """ - #: The filename being reformatted. + #: The filename being reformatted, as a POSIX-style path. filename: str - #: The filename being reformatted, as a POSIX-style path. + #: The filename being reformatted, as a :class:`~.PathPlus` object. file_to_format: PathPlus + #: The file extension of the file being reformatted. + filetype: str + #: The ``formate`` configuration, parsed from a TOML file (or similar). config: FormateConfigDict def __init__(self, filename: PathLike, config: FormateConfigDict): self.file_to_format = PathPlus(filename) self.filename = self.file_to_format.as_posix() + self.filetype = self.file_to_format.suffix self.config = config self._unformatted_source = self.file_to_format.read_text() self._reformatted_source: Optional[str] = None @@ -279,7 +283,7 @@ def run(self) -> bool: """ hooks = parse_hooks(self.config) - hooks = get_hooks_for_filetype(self.file_to_format.suffix, hooks) + hooks = get_hooks_for_filetype(self.filetype, hooks) reformatted_source = StringList(call_hooks(hooks, self._unformatted_source, self.filename)) reformatted_source.blankline(ensure_single=True) diff --git a/pyproject.toml b/pyproject.toml index 6871ad0..da6f484 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "whey" [project] name = "formate" -version = "1.2.0" +version = "1.2.1" description = "Python formatting mate." readme = "README.rst" keywords = [ "formatting", "linting",] diff --git a/repo_helper.yml b/repo_helper.yml index 204f048..95477b0 100644 --- a/repo_helper.yml +++ b/repo_helper.yml @@ -6,7 +6,7 @@ author: 'Dominic Davis-Foster' email: 'dominic@davis-foster.co.uk' username: 'python-formate' assignee: 'domdfcoding' -version: '1.2.0' +version: '1.2.1' license: 'MIT' short_desc: 'Python formatting mate.' primary_conda_channel: "domdfcoding" diff --git a/tox.ini b/tox.ini index 855c26c..172facf 100644 --- a/tox.ini +++ b/tox.ini @@ -41,7 +41,7 @@ requires = pip>=21,!=22.2 tox-envlist>=0.2.1 tox~=3.0 - virtualenv!=20.16.0 + virtualenv!=20.16.0,<20.39 [envlists] test =