Skip to content

Commit

Permalink
Merge pull request #34 from gpongelli/pyproject
Browse files Browse the repository at this point in the history
Pyproject support
  • Loading branch information
mgedmin authored Feb 2, 2023
2 parents 1c9701d + 04c8988 commit 925b32c
Show file tree
Hide file tree
Showing 10 changed files with 1,644 additions and 7 deletions.
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
universal = 1

[metadata]
license_file = LICENSE
license_files = LICENSE

[zest.releaser]
python-file-with-version = src/check_python_versions/__init__.py
Expand All @@ -13,7 +13,7 @@ include_trailing_comma = true
lines_after_imports = 2
reverse_relative = true
known_first_party = check_python_versions
known_third_party = pytest, yaml
known_third_party = pytest, yaml, tomlkit
skip = check-python-versions

[mypy]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@
'check-python-versions = check_python_versions.cli:main',
],
},
install_requires=['pyyaml'],
install_requires=['pyyaml', 'tomlkit'],
zip_safe=False,
)
6 changes: 3 additions & 3 deletions src/check_python_versions/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ def is_package(where: str = '.') -> bool:
Does not emit any diagnostics.
"""
# TODO: support setup.py-less packages that use pyproject.toml instead
setup_py = os.path.join(where, 'setup.py')
return os.path.exists(setup_py)
pyproject_toml = os.path.join(where, 'pyproject.toml')
return os.path.exists(setup_py) or os.path.exists(pyproject_toml)


PrintFn = Callable[..., None]
Expand All @@ -126,7 +126,7 @@ def check_package(where: str = '.', *, print: PrintFn = print) -> bool:
return False

if not is_package(where):
print("no setup.py -- not a Python package?")
print("no setup.py or pyproject.toml -- not a Python package?")
return False

return True
Expand Down
3 changes: 3 additions & 0 deletions src/check_python_versions/sources/all.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .appveyor import Appveyor
from .github import GitHubActions
from .manylinux import Manylinux
from .pyproject import PyProject, PyProjectPythonRequires
from .setup_py import SetupClassifiers, SetupPythonRequires
from .tox import Tox
from .travis import Travis
Expand All @@ -12,6 +13,8 @@
ALL_SOURCES = [
SetupClassifiers,
SetupPythonRequires,
PyProject,
PyProjectPythonRequires,
Tox,
Travis,
GitHubActions,
Expand Down
Loading

0 comments on commit 925b32c

Please sign in to comment.