Skip to content

Commit

Permalink
style(poetry): add PEP 600 support
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoliwa committed Jan 27, 2022
1 parent fe821aa commit 35f1b69
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.rst
Expand Up @@ -242,6 +242,8 @@ python
- `isort <https://github.com/PyCQA/isort>`_
* - ``py://nitpick/resources/python/mypy`` (`link <src/nitpick/resources/python/mypy.toml>`_)
- `Mypy <https://github.com/python/mypy>`_
* - ``py://nitpick/resources/python/poetry-editable`` (`link <src/nitpick/resources/python/poetry-editable.toml>`_)
- `Poetry (editable projects; PEP 600 support) <https://github.com/python-poetry/poetry>`_
* - ``py://nitpick/resources/python/poetry`` (`link <src/nitpick/resources/python/poetry.toml>`_)
- `Poetry <https://github.com/python-poetry/poetry>`_
* - ``py://nitpick/resources/python/pre-commit-hooks`` (`link <src/nitpick/resources/python/pre-commit-hooks.toml>`_)
Expand Down
2 changes: 2 additions & 0 deletions docs/library.rst
Expand Up @@ -83,6 +83,8 @@ python
- `isort <https://github.com/PyCQA/isort>`_
* - ``py://nitpick/resources/python/mypy`` (`link <https://github.com/andreoliwa/nitpick/blob/v0.31.0/src/nitpick/resources/python/mypy.toml>`_)
- `Mypy <https://github.com/python/mypy>`_
* - ``py://nitpick/resources/python/poetry-editable`` (`link <https://github.com/andreoliwa/nitpick/blob/v0.31.0/src/nitpick/resources/python/poetry-editable.toml>`_)
- `Poetry (editable projects; PEP 600 support) <https://github.com/python-poetry/poetry>`_
* - ``py://nitpick/resources/python/poetry`` (`link <https://github.com/andreoliwa/nitpick/blob/v0.31.0/src/nitpick/resources/python/poetry.toml>`_)
- `Poetry <https://github.com/python-poetry/poetry>`_
* - ``py://nitpick/resources/python/pre-commit-hooks`` (`link <https://github.com/andreoliwa/nitpick/blob/v0.31.0/src/nitpick/resources/python/pre-commit-hooks.toml>`_)
Expand Down
9 changes: 9 additions & 0 deletions src/nitpick/resources/python/poetry-editable.toml
@@ -0,0 +1,9 @@
[nitpick.meta]
name = "Poetry (editable projects; PEP 600 support)"
url = "https://github.com/python-poetry/poetry"

["pyproject.toml".build-system]
# Support PEP 660 hooks
# https://github.com/python-poetry/poetry-core/pull/182#issuecomment-1005195851
requires = ["poetry-core@https://github.com/python-poetry/poetry-core/archive/325312c016d69189ac93c945ba0c1b69296c5e54.zip"]
build-backend = "poetry.core.masonry.api"
6 changes: 4 additions & 2 deletions src/nitpick/resources/python/poetry.toml
Expand Up @@ -2,5 +2,7 @@
name = "Poetry"
url = "https://github.com/python-poetry/poetry"

[nitpick.files.present]
"pyproject.toml" = "Install poetry and run 'poetry init' to create it"
["pyproject.toml".build-system]
# https://github.com/python-poetry/poetry/issues/1993
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
6 changes: 3 additions & 3 deletions tests/test_resources.py
Expand Up @@ -41,9 +41,6 @@
"",
)
],
"python/poetry": [
Fuss(False, PYPROJECT_TOML, 103, " should exist: Install poetry and run 'poetry init' to create it", "")
],
}


Expand All @@ -67,7 +64,10 @@ def test_each_builtin_style(tmp_path, datadir, builtin_style_path):
name_contents = []
for filename in style.files:
expected_path = datadir / style.path_from_resources_root / filename

if not expected_path.exists():
# Creates empty files on datadir, to help with the task of adding new built-in styles
# You just need to fill in the expected contents of each file
fixture_path = Path(__file__).parent / "test_resources" / style.path_from_resources_root / filename
fixture_path.parent.mkdir(parents=True, exist_ok=True)
fixture_path.touch(exist_ok=True)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_resources/python/poetry-editable/pyproject.toml
@@ -0,0 +1,3 @@
[build-system]
requires = [ "poetry-core@https://github.com/python-poetry/poetry-core/archive/325312c016d69189ac93c945ba0c1b69296c5e54.zip",]
build-backend = "poetry.core.masonry.api"
3 changes: 3 additions & 0 deletions tests/test_resources/python/poetry/pyproject.toml
@@ -0,0 +1,3 @@
[build-system]
requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

0 comments on commit 35f1b69

Please sign in to comment.