diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..8ed3bfa0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + target-branch: "main" + schedule: + interval: "cron" + cronjob: "30 9 * * *" + timezone: "Asia/Shanghai" + allow: + - dependency-name: "agentscope" + cooldown: + exclude: + - "agentscope" + open-pull-requests-limit: 1 + commit-message: + prefix: "chore" + include: "scope" diff --git a/.github/workflows/release-auto-fin.yml b/.github/workflows/release-auto-fin.yml index d45164b6..206a2b7a 100644 --- a/.github/workflows/release-auto-fin.yml +++ b/.github/workflows/release-auto-fin.yml @@ -77,8 +77,25 @@ jobs: raise SystemExit(f"Expected a base reme-ai dependency, found {requirements[0]!r}") if Version("0.4.1.8") in reme_requirement.specifier or Version("0.4.1.9") not in reme_requirement.specifier: raise SystemExit(f"Expected reme-ai>=0.4.1.9, found {requirements[0]!r}") + root_project = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"] + agentscope_requirements = [ + Requirement(value) for value in root_project["optional-dependencies"]["as"] + ] + if len(agentscope_requirements) != 1 or agentscope_requirements[0].name != "agentscope": + raise SystemExit(f"Expected one agentscope dependency, found {agentscope_requirements!r}") + agentscope_requirement = agentscope_requirements[0] + agentscope_specifiers = list(agentscope_requirement.specifier) + if ( + agentscope_requirement.extras != {"model-ollama"} + or agentscope_requirement.marker is not None + or len(agentscope_specifiers) != 1 + or agentscope_specifiers[0].operator != "==" + or Version(agentscope_specifiers[0].version).is_prerelease + ): + raise SystemExit(f"Expected a stable exact agentscope[model-ollama] pin, found {agentscope_requirement}") with Path(os.environ["GITHUB_OUTPUT"]).open("a", encoding="utf-8") as output: print(f"reme_requirement={reme_requirement}", file=output) + print(f"agentscope_requirement={agentscope_requirement}", file=output) print(f"Publishing {project['name']} {actual}") PY @@ -100,6 +117,8 @@ jobs: python -m twine check dist/auto-fin/* - name: Verify distributions and isolated installation + env: + AGENTSCOPE_REQUIREMENT: ${{ steps.package.outputs.agentscope_requirement }} run: | AUTO_FIN_WHEEL="$(pwd)/$(ls dist/auto-fin/reme_auto_fin-*.whl)" AUTO_FIN_SDIST="$(pwd)/$(ls dist/auto-fin/reme_auto_fin-*.tar.gz)" @@ -107,7 +126,7 @@ jobs: python -m tarfile -l "${AUTO_FIN_SDIST}" | grep '/LICENSE' python -m venv "${RUNNER_TEMP}/reme-auto-fin-smoke" "${RUNNER_TEMP}/reme-auto-fin-smoke/bin/python" -m pip install \ - "agentscope[model-ollama]==2.0.7" "${AUTO_FIN_WHEEL}" + "${AGENTSCOPE_REQUIREMENT}" "${AUTO_FIN_WHEEL}" cd "${RUNNER_TEMP}" "${RUNNER_TEMP}/reme-auto-fin-smoke/bin/python" - <<'PY' from importlib.metadata import distribution diff --git a/.github/workflows/release-daily-paper.yml b/.github/workflows/release-daily-paper.yml index 12b06767..e24a61df 100644 --- a/.github/workflows/release-daily-paper.yml +++ b/.github/workflows/release-daily-paper.yml @@ -76,8 +76,25 @@ jobs: raise SystemExit(f"Expected reme-ai>=0.4.1.9, found {reme_requirements!r}") if sum(requirement.name == "pypdf" for requirement in requirements) != 1: raise SystemExit("Expected exactly one pypdf dependency") + root_project = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"] + agentscope_requirements = [ + Requirement(value) for value in root_project["optional-dependencies"]["as"] + ] + if len(agentscope_requirements) != 1 or agentscope_requirements[0].name != "agentscope": + raise SystemExit(f"Expected one agentscope dependency, found {agentscope_requirements!r}") + agentscope_requirement = agentscope_requirements[0] + agentscope_specifiers = list(agentscope_requirement.specifier) + if ( + agentscope_requirement.extras != {"model-ollama"} + or agentscope_requirement.marker is not None + or len(agentscope_specifiers) != 1 + or agentscope_specifiers[0].operator != "==" + or Version(agentscope_specifiers[0].version).is_prerelease + ): + raise SystemExit(f"Expected a stable exact agentscope[model-ollama] pin, found {agentscope_requirement}") with Path(os.environ["GITHUB_OUTPUT"]).open("a", encoding="utf-8") as output: print(f"reme_requirement={reme_requirements[0]}", file=output) + print(f"agentscope_requirement={agentscope_requirement}", file=output) print(f"Publishing {project['name']} {actual}") PY @@ -99,6 +116,8 @@ jobs: python -m twine check dist/daily-paper/* - name: Verify distributions and isolated installation + env: + AGENTSCOPE_REQUIREMENT: ${{ steps.package.outputs.agentscope_requirement }} run: | DAILY_PAPER_WHEEL="$(pwd)/$(ls dist/daily-paper/reme_daily_paper-*.whl)" DAILY_PAPER_SDIST="$(pwd)/$(ls dist/daily-paper/reme_daily_paper-*.tar.gz)" @@ -108,7 +127,7 @@ jobs: python -m tarfile -l "${DAILY_PAPER_SDIST}" | grep '/LICENSE' python -m venv "${RUNNER_TEMP}/reme-daily-paper-smoke" "${RUNNER_TEMP}/reme-daily-paper-smoke/bin/python" -m pip install \ - "agentscope[model-ollama]==2.0.7" "${DAILY_PAPER_WHEEL}" + "${AGENTSCOPE_REQUIREMENT}" "${DAILY_PAPER_WHEEL}" cd "${RUNNER_TEMP}" "${RUNNER_TEMP}/reme-daily-paper-smoke/bin/python" - <<'PY' from importlib.metadata import distribution diff --git a/pyproject.toml b/pyproject.toml index e1affe28..087fc7b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ dependencies = [ [project.optional-dependencies] as = [ - "agentscope[model-ollama]==2.0.7", + "agentscope[model-ollama]==2.0.7.post1", ] web = [ "reme_studio", diff --git a/tests/unit/test_package_versions.py b/tests/unit/test_package_versions.py index 8d68f65e..5cd8a26e 100644 --- a/tests/unit/test_package_versions.py +++ b/tests/unit/test_package_versions.py @@ -42,7 +42,16 @@ def test_studio_packages_have_independent_identity() -> None: assert studio_config["project"]["name"] == "reme_studio" assert npm_config["name"] == "@agentscope-ai/reme_studio" assert studio_config["project"]["version"] == npm_config["version"] - assert main_config["project"]["optional-dependencies"]["as"] == ["agentscope[model-ollama]==2.0.7"] + agentscope_requirements = [Requirement(value) for value in main_config["project"]["optional-dependencies"]["as"]] + assert len(agentscope_requirements) == 1 + agentscope_requirement = agentscope_requirements[0] + assert agentscope_requirement.name == "agentscope" + assert agentscope_requirement.extras == {"model-ollama"} + assert agentscope_requirement.marker is None + agentscope_specifiers = list(agentscope_requirement.specifier) + assert len(agentscope_specifiers) == 1 + assert agentscope_specifiers[0].operator == "==" + assert not Version(agentscope_specifiers[0].version).is_prerelease assert main_config["project"]["optional-dependencies"]["web"] == ["reme_studio"] assert main_config["project"]["optional-dependencies"]["core"].count("reme-ai[as]") == 1 assert main_config["project"]["optional-dependencies"]["core"].count("reme_studio") == 1