From b9e23ad041993098c7b272b826e142c735f75997 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Fri, 11 Oct 2024 00:56:10 -0400 Subject: [PATCH] feat: Remove scrapyd-deploy --list-projects, closes #97 --- CHANGES.rst | 3 ++- pyproject.toml | 2 +- scrapyd_client/deploy.py | 13 ------------- scrapyd_client/utils.py | 2 +- tests/test_scrapyd_deploy.py | 7 +++---- 5 files changed, 7 insertions(+), 20 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 06f12d1..34dc302 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ History ------- -1.3.0 (Unreleased) +2.0.0 (Unreleased) ~~~~~~~~~~~~~~~~~~ Added @@ -25,6 +25,7 @@ Fixed Removed ^^^^^^^ +- **BREAKING CHANGE:** Removed ``scrapyd-deploy --list-projects``, in favor of ``scrapyd-client projects``. - Remove ``urllib3`` and ``w3lib`` requirements. - Drop support for Python 3.7, 3.8. diff --git a/pyproject.toml b/pyproject.toml index 7ade097..8a29969 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "scrapyd-client" -version = "1.2.3" +version = "2.0.0" authors = [{name = "Scrapy developers", email = "info@scrapy.org"}] description = "A client for Scrapyd" readme = "README.rst" diff --git a/scrapyd_client/deploy.py b/scrapyd_client/deploy.py index 596e530..267d200 100644 --- a/scrapyd_client/deploy.py +++ b/scrapyd_client/deploy.py @@ -43,12 +43,6 @@ def parse_args(): action="store_true", help="debug mode (do not remove build dir)", ) - parser.add_argument( - "-L", - "--list-projects", - metavar="TARGET", - help="list available projects in the TARGET", - ) parser.add_argument("--egg", metavar="FILE", help="use the given egg, instead of building it") parser.add_argument("--build-egg", metavar="FILE", help="only build the egg, don't deploy it") parser.add_argument( @@ -71,13 +65,6 @@ def main(): print("%-20s %s" % (name, target["url"])) return - if opts.list_projects: - target = _get_target(opts.list_projects) - - projects = requests.get(_url(target, "listprojects.json"), **_requests_auth(target)).json()["projects"] - print(os.linesep.join(projects)) - return - tmpdir = None if opts.build_egg: # build egg only diff --git a/scrapyd_client/utils.py b/scrapyd_client/utils.py index d1c0b61..932e757 100644 --- a/scrapyd_client/utils.py +++ b/scrapyd_client/utils.py @@ -9,7 +9,7 @@ from scrapy.utils import conf HEADERS = requests.utils.default_headers().copy() -HEADERS["User-Agent"] = "Scrapyd-client/1.2.3" +HEADERS["User-Agent"] = "Scrapyd-client/2.0.0" DEFAULT_TARGET_URL = "http://localhost:6800" diff --git a/tests/test_scrapyd_deploy.py b/tests/test_scrapyd_deploy.py index 75fb26c..f1f5f74 100644 --- a/tests/test_scrapyd_deploy.py +++ b/tests/test_scrapyd_deploy.py @@ -146,7 +146,7 @@ def assert_lines(actual, expected): assert re.search(f"^{expected[i]}$", line), f"{line} does not match {expected[i]}" -@pytest.mark.parametrize("args", [[], ["-l"], ["-L", "default"]]) +@pytest.mark.parametrize("args", [[], ["-l"], ["default"]]) def test_not_in_project(args, script_runner): ret = script_runner.run(["scrapyd-deploy", *args]) @@ -155,7 +155,7 @@ def test_not_in_project(args, script_runner): assert not ret.success -@pytest.mark.parametrize("args", [[], ["-l"], ["-L", "default"]]) +@pytest.mark.parametrize("args", [[], ["-l"], ["default"]]) def test_too_many_arguments(args, script_runner, project): ret = script_runner.run(["scrapyd-deploy", "mytarget", "extra"]) @@ -165,8 +165,7 @@ def test_too_many_arguments(args, script_runner, project): dedent( """\ usage: scrapyd-deploy [-h] [-p PROJECT] [-v VERSION] [-l] [-a] [-d] - [-L TARGET] [--egg FILE] [--build-egg FILE] - [--include-dependencies] + [--egg FILE] [--build-egg FILE] [--include-dependencies] [TARGET] scrapyd-deploy: error: unrecognized arguments: extra """