Skip to content

Commit a4d0b6d

Browse files
authored
Why a deprecation error, when I can make a Pyroma rating? (#110)
1 parent d96c44a commit a4d0b6d

File tree

15 files changed

+114
-86
lines changed

15 files changed

+114
-86
lines changed

CHANGES.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Changelog
44
5.0 (unreleased)
55
----------------
66

7-
- Nothing changed yet.
7+
- Deprecation warnings? For the packaging configuration? What was I thinking?
8+
I'm instead adding a rating telling people that they should add a
9+
pyproject.toml. Much nicer.
810

911

1012
4.3 (2025-07-01)

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ help: ## display this message
1515
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
1616

1717
generate: ## generate environment for tests
18-
cd pyroma/testdata/complete
19-
python setup.py sdist --formats=bztar,gztar,tar,zip
18+
cd pyroma/testdata/complete;python setup.py sdist --formats=bztar,gztar,tar,zip
2019
cp pyroma/testdata/complete/dist/complete-1.0.dev1.* pyroma/testdata/distributions/
2120

2221
tests: generate ## run tests

pyroma/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ def zester(data):
1616
if not config_files & main_files:
1717
return
1818

19-
if "setup.py" in config_files & main_files:
20-
import warnings
21-
22-
warnings.showwarning(
23-
message="Using setup.py is deprecated, and Pyroma support for setup.py will be dropped in version 5.0",
24-
category=DeprecationWarning,
25-
filename=__name__ + ".py",
26-
lineno=19,
27-
)
28-
2919
from zest.releaser.utils import ask
3020

3121
if ask("Run pyroma on the package before tagging?"):

pyroma/projectdata.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ def map_metadata_keys(metadata):
5959

6060

6161
def get_build_data(path, isolated=None):
62-
metadata = build_metadata(path, isolated=isolated)
63-
return map_metadata_keys(metadata)
62+
metadata = map_metadata_keys(build_metadata(path, isolated=isolated))
63+
# Check if there is a pyproject_toml
64+
if "pyproject.toml" not in os.listdir(path):
65+
metadata["_missing_pyproject_toml"] = True
66+
return metadata
6467

6568

6669
def get_setupcfg_data(path):
@@ -240,15 +243,6 @@ def get_setuppy_data(path):
240243
with FakeContext(path):
241244
with SetupMonkey() as sm:
242245
if os.path.isfile("setup.py"):
243-
import warnings
244-
245-
warnings.showwarning(
246-
message="Using setup.py is deprecated, and Pyroma support for setup.py "
247-
"will be dropped in version 5.0",
248-
category=DeprecationWarning,
249-
filename=__name__ + ".py",
250-
lineno=242,
251-
)
252246

253247
try:
254248
distro = run_setup("setup.py", stop_after="config")

pyroma/ratings.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
# False for fail and None for not applicable (meaning it will
1616
# not be counted).
1717
import io
18-
import os
1918
import re
2019
from collections import defaultdict
2120

@@ -463,7 +462,24 @@ def message(self):
463462
" [build-system]\n"
464463
' requires = ["setuptools>=42"]\n'
465464
' build-backend = "setuptools.build_meta"\n\n'
466-
'In the future this will become a hard failure and your package will be rated as "not cheese".'
465+
'In the future this may become a hard failure and your package may be rated as "not cheese".'
466+
)
467+
468+
469+
class MissingPyProjectToml(BaseTest):
470+
def test(self, data):
471+
if "_missing_pyproject_toml" in data:
472+
# These sort of "negative only/deprecation" ratings only give you negative weight
473+
self.weight = 100
474+
return False
475+
476+
def message(self):
477+
return (
478+
"Your project does not have a pyproject.toml file, which is highly recommended.\n"
479+
"You probably want to create one with the following configuration:\n\n"
480+
" [build-system]\n"
481+
' requires = ["setuptools>=42"]\n'
482+
' build-backend = "setuptools.build_meta"\n\n'
467483
)
468484

469485

@@ -505,6 +521,7 @@ def message(self):
505521
DevStatusClassifier(),
506522
MissingBuildSystem(),
507523
StoneAgeSetupPy(),
524+
MissingPyProjectToml(),
508525
]
509526

510527
try:
@@ -517,10 +534,6 @@ def test(self, data):
517534
if "_path" not in data:
518535
return None
519536

520-
if not os.path.exists(data["_path"]):
521-
import pdb
522-
523-
pdb.set_trace()
524537
self.weight = 200
525538
try:
526539
return check_manifest.check_manifest(data["_path"])
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tool.black]
2+
line-length = 120
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tool.black]
2+
line-length = 120
0 Bytes
Binary file not shown.
91 Bytes
Binary file not shown.
97 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)