Repository: ansible-community/ansible-pygments (language: python)

Issue:
Use src-layout for the project
It's basically `mkdir -pv src/ && git mv sphinx_ansible_highlighter src/` + adjust something in the poetry setup.

The reason is that otherwise pytest probably imports the in-tree code while it should be testing the thing "as installed in site-packages" instead.


Discussion / hints:
If necessary, move tests under the package dir.

Fix patch:
diff --git a/.github/workflows/pythonlinters.yml b/.github/workflows/pythonlinters.yml
index 6002360..ff22408 100644
--- a/.github/workflows/pythonlinters.yml
+++ b/.github/workflows/pythonlinters.yml
@@ -37,18 +37,7 @@ jobs:
         run: |
           ./lint-flake8.sh
 
-      - name: Lint with pyre
-        run: |
-          ./lint-pyre.sh
-        if: always()
-
       - name: Lint with pylint
         run: |
           ./lint-pylint.sh
         if: always()
-
-      # note: mypy is run informationally, never to fail the build
-      - name: Lint with mypy
-        run: |
-          ./lint-mypy.sh || :
-        if: always()
diff --git a/.gitignore b/.gitignore
index c18b035..c0c0496 100644
--- a/.gitignore
+++ b/.gitignore
@@ -120,14 +120,6 @@ venv.bak/
 # mkdocs documentation
 /site
 
-# mypy
-.mypy_cache/
-.dmypy.json
-dmypy.json
-
-# Pyre type checker
-.pyre/
-
 # poetry
 poetry.lock
 
diff --git a/lint-flake8.sh b/lint-flake8.sh
index bec5bfb..4abacde 100755
--- a/lint-flake8.sh
+++ b/lint-flake8.sh
@@ -1,3 +1,3 @@
 #!/bin/bash
 set -e
-poetry run flake8 sphinx_ansible_highlighter --count --max-complexity=10 --max-line-length=100 --statistics "$@"
+poetry run flake8 src/ --count --max-complexity=10 --max-line-length=100 --statistics "$@"
diff --git a/lint-mypy.sh b/lint-mypy.sh
deleted file mode 100755
index 063dd2d..0000000
--- a/lint-mypy.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-set -e
-MYPYPATH=stubs/ poetry run mypy sphinx_ansible_highlighter "$@"
diff --git a/lint-pylint.sh b/lint-pylint.sh
index a8cc7d7..419436e 100755
--- a/lint-pylint.sh
+++ b/lint-pylint.sh
@@ -1,3 +1,3 @@
 #!/bin/bash
 set -e
-poetry run pylint --rcfile .pylintrc.automated sphinx_ansible_highlighter "$@"
+poetry run pylint --rcfile .pylintrc.automated src/ "$@"
diff --git a/lint-pyre.sh b/lint-pyre.sh
deleted file mode 100755
index 511320f..0000000
--- a/lint-pyre.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-set -e
-poetry run pyre --source-directory sphinx_ansible_highlighter --search-path $(poetry run python -c 'from distutils.sysconfig import get_python_lib;print(get_python_lib())') --search-path stubs/ --search-path . "$@"
diff --git a/pyproject.toml b/pyproject.toml
index baa91b7..896c92c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -11,7 +11,7 @@ license = "GPL-3.0-or-later"
 readme = "README.md"
 repository = "https://github.com/ansible-community/antsibull"
 packages = [
-    { include = "sphinx_ansible_highlighter" },
+    { include = "sphinx_ansible_highlighter", from = "src" },
     { include = "tests", format = "sdist" }
 ]
 
@@ -30,9 +30,6 @@ sphinx = ["sphinx"]
 [tool.poetry.dev-dependencies]
 codecov = "*"
 flake8 = ">= 3.8.0"
-mypy = "*"
-# https://github.com/facebook/pyre-check/issues/398
-pyre-check = "^0.0.46"
 pylint = "*"
 pytest = "*"
 pytest-cov = "*"
diff --git a/sphinx_ansible_highlighter/__init__.py b/src/sphinx_ansible_highlighter/__init__.py
similarity index 100%
rename from sphinx_ansible_highlighter/__init__.py
rename to src/sphinx_ansible_highlighter/__init__.py
diff --git a/sphinx_ansible_highlighter/pygments_lexer.py b/src/sphinx_ansible_highlighter/pygments_lexer.py
similarity index 98%
rename from sphinx_ansible_highlighter/pygments_lexer.py
rename to src/sphinx_ansible_highlighter/pygments_lexer.py
index 78382c0..a85ed5a 100644
--- a/sphinx_ansible_highlighter/pygments_lexer.py
+++ b/src/sphinx_ansible_highlighter/pygments_lexer.py
@@ -48,7 +48,7 @@ class AnsibleOutputPrimaryLexer(RegexLexer):
     Primary lexer for Ansible output.
     '''
 
-    name = 'Ansible-output-primary'  # pyre-ignore[15]
+    name = 'Ansible-output-primary'
 
     # The following definitions are borrowed from Pygment's JSON lexer.
     # It has been originally authored by Norman Richards.
@@ -168,7 +168,7 @@ class AnsibleOutputLexer(DelegatingLexer):
     The Ansible output Pygments lexer.
     '''
 
-    name = 'Ansible-output'  # pyre-ignore[15]
+    name = 'Ansible-output'
     aliases = ('ansible-output', )
 
     def __init__(self, **options):
diff --git a/stubs/.gitempty b/stubs/.gitempty
deleted file mode 100644
index e69de29..0000000


Test patch:
diff --git a/test-pytest.sh b/test-pytest.sh
index 1fd5c65..0204a83 100755
--- a/test-pytest.sh
+++ b/test-pytest.sh
@@ -1,3 +1,3 @@
 #!/bin/sh
 set -e
-poetry run python -m pytest --cov-branch --cov=sphinx_ansible_highlighter --cov-report term-missing -vv tests "$@"
+poetry run python -m pytest --cov-branch --cov=src/ --cov-report term-missing -vv tests "$@"