Skip to content

Commit

Permalink
feat: Remove scrapyd-deploy --list-projects, closes #97
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Oct 11, 2024
1 parent 171f9af commit b9e23ad
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 20 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
History
-------

1.3.0 (Unreleased)
2.0.0 (Unreleased)
~~~~~~~~~~~~~~~~~~

Added
Expand All @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]"}]
description = "A client for Scrapyd"
readme = "README.rst"
Expand Down
13 changes: 0 additions & 13 deletions scrapyd_client/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scrapyd_client/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
7 changes: 3 additions & 4 deletions tests/test_scrapyd_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand All @@ -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"])

Expand All @@ -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
"""
Expand Down

0 comments on commit b9e23ad

Please sign in to comment.