Skip to content

Commit 7279a07

Browse files
authored
Support Private :: trove classifiers (#7271)
1 parent 2d54ec9 commit 7279a07

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

src/poetry/console/commands/check.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def validate_classifiers(
3131
unrecognized = sorted(
3232
project_classifiers - set(classifiers) - set(deprecated_classifiers)
3333
)
34+
# Allow "Private ::" classifiers as recommended on PyPI and the packaging guide
35+
# to allow users to avoid accidentally publishing private packages to PyPI.
36+
# https://pypi.org/classifiers/
37+
unrecognized = [u for u in unrecognized if not u.startswith("Private ::")]
3438
if unrecognized:
3539
errors.append(f"Unrecognized classifiers: {unrecognized!r}.")
3640

tests/console/commands/test_check.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,21 @@ def test_check_invalid(mocker: MockerFixture, tester: CommandTester):
5959
"""
6060

6161
assert tester.io.fetch_error() == expected
62+
63+
64+
def test_check_private(mocker: MockerFixture, tester: CommandTester):
65+
mocker.patch(
66+
"poetry.factory.Factory.locate",
67+
return_value=Path(__file__).parent.parent.parent
68+
/ "fixtures"
69+
/ "private_pyproject"
70+
/ "pyproject.toml",
71+
)
72+
73+
tester.execute()
74+
75+
expected = """\
76+
All set!
77+
"""
78+
79+
assert tester.io.fetch_output() == expected
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[tool.poetry]
2+
name = "private"
3+
version = "0.1.0"
4+
description = ""
5+
authors = ["Your Name <[email protected]>"]
6+
readme = "README.md"
7+
classifiers = [
8+
"Private :: Do Not Upload",
9+
]
10+
11+
12+
[tool.poetry.dependencies]
13+
python = "^3.7"
14+
15+
[build-system]
16+
requires = ["poetry-core"]
17+
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)