fix: use valid trove classifier and clean up unused imports
Some checks failed
CI (tests + ruff) and stable tag / unittest (py3.10) (push) Has been cancelled
CI (tests + ruff) and stable tag / unittest (py3.11) (push) Has been cancelled
CI (tests + ruff) and stable tag / unittest (py3.12) (push) Has been cancelled
CI (tests + ruff) and stable tag / unittest (py3.13) (push) Has been cancelled
CI (tests + ruff) and stable tag / ruff (py3.12) (push) Has been cancelled
CI (tests + ruff) and stable tag / Tag stable (if version commit) (push) Has been cancelled

https://chatgpt.com/share/69468609-0584-800f-a3e0-9d58210fb0e8
This commit is contained in:
2025-12-20 14:45:07 +01:00
parent d8e5fdff26
commit 8ae9e9f08a
3 changed files with 20 additions and 10 deletions

View File

@@ -17,7 +17,7 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Refactoring"
"Topic :: Software Development :: Quality Assurance"
]
[project.scripts]

View File

@@ -1,7 +1,6 @@
from __future__ import annotations
import argparse
import os
import pathlib
import subprocess
@@ -85,8 +84,16 @@ def main(argv: list[str] | None = None) -> int:
prog="p2pkg",
description="Migrate foo.py -> foo/__main__.py and generate foo/__init__.py that re-exports public API.",
)
parser.add_argument("files", nargs="+", help="Python module files to migrate (e.g. roles_list.py other.py).")
parser.add_argument("--no-git", action="store_true", help="Do not use `git mv` even if inside a git repo.")
parser.add_argument(
"files",
nargs="+",
help="Python module files to migrate (e.g. roles_list.py other.py).",
)
parser.add_argument(
"--no-git",
action="store_true",
help="Do not use `git mv` even if inside a git repo.",
)
parser.add_argument(
"--repo-root",
default=".",

View File

@@ -1,7 +1,5 @@
from __future__ import annotations
import importlib.util
import os
import sys
import tempfile
import textwrap
@@ -16,7 +14,8 @@ class TestMigration(unittest.TestCase):
with tempfile.TemporaryDirectory() as td:
root = Path(td)
mod = root / "roles_list.py"
mod.write_text(textwrap.dedent("""\
mod.write_text(
textwrap.dedent("""\
__all__ = ["add", "PUBLIC_CONST"]
PUBLIC_CONST = 123
_PRIVATE_CONST = 999
@@ -29,7 +28,8 @@ class TestMigration(unittest.TestCase):
if __name__ == "__main__":
print("running as script")
"""),encoding="utf-8",
"""),
encoding="utf-8",
)
migrate_one(mod, use_git=False, repo_root=root)
@@ -61,7 +61,8 @@ class TestMigration(unittest.TestCase):
with tempfile.TemporaryDirectory() as td:
root = Path(td)
mod = root / "foo.py"
mod.write_text(textwrap.dedent("""\
mod.write_text(
textwrap.dedent("""\
VALUE = "ok"
def hello() -> str:
@@ -69,7 +70,9 @@ class TestMigration(unittest.TestCase):
def _private() -> str:
return "no"
"""), encoding="utf-8")
"""),
encoding="utf-8",
)
migrate_one(mod, use_git=False, repo_root=root)
sys.path.insert(0, str(root))