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
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:
@@ -17,7 +17,7 @@ classifiers = [
|
|||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3 :: Only",
|
"Programming Language :: Python :: 3 :: Only",
|
||||||
"Topic :: Software Development :: Refactoring"
|
"Topic :: Software Development :: Quality Assurance"
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
|
||||||
import pathlib
|
import pathlib
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
@@ -85,8 +84,16 @@ def main(argv: list[str] | None = None) -> int:
|
|||||||
prog="p2pkg",
|
prog="p2pkg",
|
||||||
description="Migrate foo.py -> foo/__main__.py and generate foo/__init__.py that re-exports public API.",
|
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(
|
||||||
parser.add_argument("--no-git", action="store_true", help="Do not use `git mv` even if inside a git repo.")
|
"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(
|
parser.add_argument(
|
||||||
"--repo-root",
|
"--repo-root",
|
||||||
default=".",
|
default=".",
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import importlib.util
|
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import textwrap
|
import textwrap
|
||||||
@@ -16,7 +14,8 @@ class TestMigration(unittest.TestCase):
|
|||||||
with tempfile.TemporaryDirectory() as td:
|
with tempfile.TemporaryDirectory() as td:
|
||||||
root = Path(td)
|
root = Path(td)
|
||||||
mod = root / "roles_list.py"
|
mod = root / "roles_list.py"
|
||||||
mod.write_text(textwrap.dedent("""\
|
mod.write_text(
|
||||||
|
textwrap.dedent("""\
|
||||||
__all__ = ["add", "PUBLIC_CONST"]
|
__all__ = ["add", "PUBLIC_CONST"]
|
||||||
PUBLIC_CONST = 123
|
PUBLIC_CONST = 123
|
||||||
_PRIVATE_CONST = 999
|
_PRIVATE_CONST = 999
|
||||||
@@ -29,7 +28,8 @@ class TestMigration(unittest.TestCase):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("running as script")
|
print("running as script")
|
||||||
"""),encoding="utf-8",
|
"""),
|
||||||
|
encoding="utf-8",
|
||||||
)
|
)
|
||||||
|
|
||||||
migrate_one(mod, use_git=False, repo_root=root)
|
migrate_one(mod, use_git=False, repo_root=root)
|
||||||
@@ -61,7 +61,8 @@ class TestMigration(unittest.TestCase):
|
|||||||
with tempfile.TemporaryDirectory() as td:
|
with tempfile.TemporaryDirectory() as td:
|
||||||
root = Path(td)
|
root = Path(td)
|
||||||
mod = root / "foo.py"
|
mod = root / "foo.py"
|
||||||
mod.write_text(textwrap.dedent("""\
|
mod.write_text(
|
||||||
|
textwrap.dedent("""\
|
||||||
VALUE = "ok"
|
VALUE = "ok"
|
||||||
|
|
||||||
def hello() -> str:
|
def hello() -> str:
|
||||||
@@ -69,7 +70,9 @@ class TestMigration(unittest.TestCase):
|
|||||||
|
|
||||||
def _private() -> str:
|
def _private() -> str:
|
||||||
return "no"
|
return "no"
|
||||||
"""), encoding="utf-8")
|
"""),
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
migrate_one(mod, use_git=False, repo_root=root)
|
migrate_one(mod, use_git=False, repo_root=root)
|
||||||
|
|
||||||
sys.path.insert(0, str(root))
|
sys.path.insert(0, str(root))
|
||||||
|
|||||||
Reference in New Issue
Block a user