From b771c43dee624b48b8790060c9c258d7ca05c801 Mon Sep 17 00:00:00 2001 From: Marcelo Trevisani Date: Wed, 13 Nov 2024 14:44:47 +0000 Subject: [PATCH 1/4] Add pixi-pycharm --- pixi.lock | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- pyproject.toml | 3 +++ 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/pixi.lock b/pixi.lock index 73182aa4..22e8afce 100644 --- a/pixi.lock +++ b/pixi.lock @@ -23,6 +23,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-he02047a_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.4.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pixi-pycharm-0.0.8-unix_1234567_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.13.0-h9ebbce0_100_cp313.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/python_abi-3.13-5_cp313.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8228510_1.conda @@ -63,6 +64,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libzlib-1.3.1-h8359307_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.5-h7bae524_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/openssl-3.4.0-h39f12f2_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pixi-pycharm-0.0.8-unix_1234567_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-3.13.0-h75c3a9f_100_cp313.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python_abi-3.13-5_cp313.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.2-h92ec313_1.conda @@ -102,6 +104,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.47.0-h2466b09_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.1-h2466b09_2.conda - conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.4.0-h2466b09_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pixi-pycharm-0.0.8-win_1234567_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/python-3.13.0-hf5aa216_100_cp313.conda - conda: https://conda.anaconda.org/conda-forge/win-64/python_abi-3.13-5_cp313.conda - conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h5226925_1.conda @@ -158,6 +161,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-he02047a_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.4.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pixi-pycharm-0.0.8-unix_1234567_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.13.0-h9ebbce0_100_cp313.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/python_abi-3.13-5_cp313.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8228510_1.conda @@ -221,6 +225,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libzlib-1.3.1-h8359307_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.5-h7bae524_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/openssl-3.4.0-h39f12f2_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pixi-pycharm-0.0.8-unix_1234567_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-3.13.0-h75c3a9f_100_cp313.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python_abi-3.13-5_cp313.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.2-h92ec313_1.conda @@ -283,6 +288,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.47.0-h2466b09_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.1-h2466b09_2.conda - conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.4.0-h2466b09_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pixi-pycharm-0.0.8-win_1234567_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/python-3.13.0-hf5aa216_100_cp313.conda - conda: https://conda.anaconda.org/conda-forge/win-64/python_abi-3.13-5_cp313.conda - conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h5226925_1.conda @@ -362,6 +368,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-he02047a_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.4.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pixi-pycharm-0.0.8-unix_1234567_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.13.0-h9ebbce0_100_cp313.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/python_abi-3.13-5_cp313.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8228510_1.conda @@ -411,6 +418,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libzlib-1.3.1-h8359307_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.5-h7bae524_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/openssl-3.4.0-h39f12f2_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pixi-pycharm-0.0.8-unix_1234567_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-3.13.0-h75c3a9f_100_cp313.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python_abi-3.13-5_cp313.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.2-h92ec313_1.conda @@ -459,6 +467,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.47.0-h2466b09_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.1-h2466b09_2.conda - conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.4.0-h2466b09_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pixi-pycharm-0.0.8-win_1234567_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/python-3.13.0-hf5aa216_100_cp313.conda - conda: https://conda.anaconda.org/conda-forge/win-64/python_abi-3.13-5_cp313.conda - conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h5226925_1.conda @@ -735,9 +744,9 @@ packages: requires_python: '>=3.8' - kind: pypi name: grayskull - version: 2.7.4.dev8+g9e40b4a.d20241113 + version: 2.7.4.dev12+g5b29307.d20241113 path: . - sha256: 453c67ac1ec22bb7fa5fd37d6f410a468ba5acd7e6aff951d78001ab4552edf4 + sha256: ef331d8c19ff5b0f31f3bba9b130567121bd19122b05b5ed8628fbe6b19d4e65 requires_dist: - beautifulsoup4 - colorama @@ -753,8 +762,8 @@ packages: - setuptools>=30.3.0 - semver==3.0.*,>=3.0.0 - stdlib-list - - tomli - tomli-w + - tomli ; python_full_version < '3.11' - furo ; extra == 'docs' - sphinx ; extra == 'docs' - sphinx-argparse ; extra == 'docs' @@ -1356,6 +1365,40 @@ packages: url: https://files.pythonhosted.org/packages/ef/7d/500c9ad20238fcfcb4cb9243eede163594d7020ce87bd9610c9e02771876/pip-24.3.1-py3-none-any.whl sha256: 3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed requires_python: '>=3.8' +- kind: conda + name: pixi-pycharm + version: 0.0.8 + build: unix_1234567_0 + subdir: noarch + noarch: generic + url: https://conda.anaconda.org/conda-forge/noarch/pixi-pycharm-0.0.8-unix_1234567_0.conda + sha256: 1d59b9dc7d922846f594fc17d9ea034f569d7e6946eaa06a98474bee2f413b66 + md5: 94373edcca5bd8582588c658859b8f70 + depends: + - __unix + - python >=3.8 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 8861 + timestamp: 1728816803073 +- kind: conda + name: pixi-pycharm + version: 0.0.8 + build: win_1234567_0 + subdir: noarch + noarch: generic + url: https://conda.anaconda.org/conda-forge/noarch/pixi-pycharm-0.0.8-win_1234567_0.conda + sha256: 6ee9dbad2c363faefea73e21370301e16290a2a88230787267e4f34b67ca40e8 + md5: 352a583506f7ac90d984e9a501e500f7 + depends: + - __win + - python >=3.8 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 8671 + timestamp: 1728816803806 - kind: pypi name: pkginfo version: 1.11.2 diff --git a/pyproject.toml b/pyproject.toml index 4dec4d68..5b186e9f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,3 +87,6 @@ grayskull = { path = ".", editable = true } default = { solve-group = "default" } docs = { features = ["docs"], solve-group = "default" } testing = { features = ["testing"], solve-group = "default" } + +[tool.pixi.dependencies] +pixi-pycharm = ">=0.0.8,<0.0.9" From b594304dd937c861f28ab0ef49baf8097da7fbf9 Mon Sep 17 00:00:00 2001 From: Marcelo Trevisani Date: Wed, 13 Nov 2024 16:41:26 +0000 Subject: [PATCH 2/4] Adjusted the test requirements to ensure 'python' is included and added a new function to enforce minimum Python version dependencies. Signed-off-by: Marcelo Trevisani --- grayskull/config.py | 4 +- grayskull/strategy/pypi.py | 35 +++++++++++--- pixi.lock | 56 ++++++++++++++++++++++- pyproject.toml | 2 + tests/data/poetry/langchain-expected.yaml | 1 + tests/test_pypi.py | 54 ++++++++++++++-------- 6 files changed, 122 insertions(+), 30 deletions(-) diff --git a/grayskull/config.py b/grayskull/config.py index 31915da5..ac779e45 100644 --- a/grayskull/config.py +++ b/grayskull/config.py @@ -23,16 +23,16 @@ class Configuration: PyVer(3, 10), PyVer(3, 11), PyVer(3, 12), + PyVer(3, 13), ] ) py_cf_supported: list[PyVer] = field( default_factory=lambda: [ - PyVer(3, 7), - PyVer(3, 8), PyVer(3, 9), PyVer(3, 10), PyVer(3, 11), PyVer(3, 12), + PyVer(3, 13), ] ) is_strict_cf: bool = False diff --git a/grayskull/strategy/pypi.py b/grayskull/strategy/pypi.py index c1cddcc6..f74d2328 100644 --- a/grayskull/strategy/pypi.py +++ b/grayskull/strategy/pypi.py @@ -429,6 +429,9 @@ def get_metadata(recipe, config) -> dict: test_requirements = optional_requirements.pop(config.extras_require_test, []) test_section = compose_test_section(metadata, test_requirements) + if config.is_strict_cf and not config.is_arch: + test_section["requires"] = set_python_min(test_section["requires"], "test") + about_section = { "home": metadata["url"] if metadata.get("url") else metadata.get("project_url"), "summary": metadata.get("summary"), @@ -582,6 +585,21 @@ def check_noarch_python_for_new_deps( config.is_arch = False +def set_python_min(req_list: list, section: str) -> list: + if not req_list: + return req_list + python_min = "<{ python_min }}" + map_section = { + "test": f"={python_min}", + "host": f"{python_min}.*", + "run": f">={python_min}", + } + return [ + f"python {map_section[section]}" if dep.lower().strip() == "python" else dep + for dep in req_list + ] + + def extract_requirements(metadata: dict, config, recipe) -> dict[str, list[str]]: """Extract the requirements for `build`, `host` and `run`""" name = metadata["name"] @@ -592,13 +610,13 @@ def extract_requirements(metadata: dict, config, recipe) -> dict[str, list[str]] build_req = format_dependencies(build_requires or [], config.name) if not requires_dist and not host_req and not metadata.get("requires_python"): if config.is_strict_cf: - py_constrain = ( - f" >={config.py_cf_supported[0].major}" - f".{config.py_cf_supported[0].minor}" - ) + requirements = { + "host": ["python", "pip"], + "run": ["python"], + } return { - "host": [f"python {py_constrain}", "pip"], - "run": [f"python {py_constrain}"], + "host": set_python_min(requirements["host"], "host"), + "run": set_python_min(requirements["run"], "run"), } else: return {"host": ["python", "pip"], "run": ["python"]} @@ -648,6 +666,9 @@ def extract_requirements(metadata: dict, config, recipe) -> dict[str, list[str]] if metadata.get("requirements_run_constrained", None): result.update({"run_constrained": metadata["requirements_run_constrained"]}) update_requirements_with_pin(result) + if config.is_strict_cf and not config.is_arch: + result["host"] = set_python_min(result["host"], "host") + result["run"] = set_python_min(result["run"], "run") return result @@ -715,6 +736,8 @@ def normalize_requirements_list(requirements: list[str], config) -> list[str]: def compose_test_section(metadata: dict, test_requirements: list[str]) -> dict: test_imports = get_test_imports(metadata, metadata["name"]) test_requirements = ["pip"] + test_requirements + if "python" not in test_requirements: + test_requirements.append("python") test_commands = ["pip check"] if any("pytest" in req for req in test_requirements): test_commands.extend(f"pytest --pyargs {module}" for module in test_imports) diff --git a/pixi.lock b/pixi.lock index 22e8afce..69551d8c 100644 --- a/pixi.lock +++ b/pixi.lock @@ -381,9 +381,11 @@ environments: - pypi: https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/36/6b/03647c71ea8db50d90d5e404ac9a647733d8d01d1887fc79507ace973743/conda_souschef-2.2.3-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/7f/f8/4436a643631a2fbab4b44d54f515028f6099bfb1cd95b13cfbf701e7f2f2/coverage-7.6.4-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl + - pypi: https://files.pythonhosted.org/packages/43/09/2aea36ff60d16dd8879bdb2f5b3ee0ba8d08cbbdcdfe870e695ce3784385/execnet-2.1.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/6b/20/471f41173930550f279ccb65596a5ac19b9ac974a8d93679bcd3e0c31498/mock-5.1.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/70/50/73f9a5aa0810cdccda9c1d20be3cbe4a4d6ea6bfd6931464a44c95eef731/numpy-2.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl - pypi: https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/ef/7d/500c9ad20238fcfcb4cb9243eede163594d7020ce87bd9610c9e02771876/pip-24.3.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/17/b7/71f9fbebc37ecf55233407f348b9acc974482e6ee37d057a1e8e3baba081/pkginfo-1.11.2-py3-none-any.whl @@ -393,6 +395,7 @@ environments: - pypi: https://files.pythonhosted.org/packages/32/12/149a568c244b58912350c7fd3b997ed6b57889a22098564cc43c3e511b76/pytest_console_scripts-1.4.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/36/3b/48e79f2cd6a61dbbd4807b4ed46cb564b4fd50a76166b1c4ea5c1d9e2371/pytest_cov-6.0.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/f2/3b/b26f90f74e2986a82df6e7ac7e319b8ea7ccece1caec9f8ab6104dc70603/pytest_mock-3.14.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/6d/82/1d96bf03ee4c0fdc3c0cbe61470070e659ca78dc0086fb88b66c185e2449/pytest_xdist-3.6.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/17/e7/200045de1f41ad74915a334f7c2aac54d2d6f4b89643a53e1062cde4895b/python_utils-3.9.0-py2.py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/bd/72/417ca8b5dde3c040c1cab1d5500fd24ffdf1a397cb86e36e958acb07cd65/rapidfuzz-3.10.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl - pypi: https://files.pythonhosted.org/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl @@ -431,9 +434,11 @@ environments: - pypi: https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/36/6b/03647c71ea8db50d90d5e404ac9a647733d8d01d1887fc79507ace973743/conda_souschef-2.2.3-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/3f/f9/d86368ae8c79e28f1fb458ebc76ae9ff3e8bd8069adc24e8f2fed03c58b7/coverage-7.6.4-cp313-cp313-macosx_11_0_arm64.whl + - pypi: https://files.pythonhosted.org/packages/43/09/2aea36ff60d16dd8879bdb2f5b3ee0ba8d08cbbdcdfe870e695ce3784385/execnet-2.1.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/6b/20/471f41173930550f279ccb65596a5ac19b9ac974a8d93679bcd3e0c31498/mock-5.1.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/45/e1/210b2d8b31ce9119145433e6ea78046e30771de3fe353f313b2778142f34/numpy-2.1.3-cp313-cp313-macosx_11_0_arm64.whl - pypi: https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/ef/7d/500c9ad20238fcfcb4cb9243eede163594d7020ce87bd9610c9e02771876/pip-24.3.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/17/b7/71f9fbebc37ecf55233407f348b9acc974482e6ee37d057a1e8e3baba081/pkginfo-1.11.2-py3-none-any.whl @@ -443,6 +448,7 @@ environments: - pypi: https://files.pythonhosted.org/packages/32/12/149a568c244b58912350c7fd3b997ed6b57889a22098564cc43c3e511b76/pytest_console_scripts-1.4.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/36/3b/48e79f2cd6a61dbbd4807b4ed46cb564b4fd50a76166b1c4ea5c1d9e2371/pytest_cov-6.0.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/f2/3b/b26f90f74e2986a82df6e7ac7e319b8ea7ccece1caec9f8ab6104dc70603/pytest_mock-3.14.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/6d/82/1d96bf03ee4c0fdc3c0cbe61470070e659ca78dc0086fb88b66c185e2449/pytest_xdist-3.6.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/17/e7/200045de1f41ad74915a334f7c2aac54d2d6f4b89643a53e1062cde4895b/python_utils-3.9.0-py2.py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/6f/6a/7e34ddc3d6d751c4dba0d58b681c99f161225730e9a2fa71969d2fa1d281/rapidfuzz-3.10.1-cp313-cp313-macosx_11_0_arm64.whl - pypi: https://files.pythonhosted.org/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl @@ -483,9 +489,11 @@ environments: - pypi: https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/36/6b/03647c71ea8db50d90d5e404ac9a647733d8d01d1887fc79507ace973743/conda_souschef-2.2.3-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/5c/60/ce5a9e942e9543783b3db5d942e0578b391c25cdd5e7f342d854ea83d6b7/coverage-7.6.4-cp313-cp313-win_amd64.whl + - pypi: https://files.pythonhosted.org/packages/43/09/2aea36ff60d16dd8879bdb2f5b3ee0ba8d08cbbdcdfe870e695ce3784385/execnet-2.1.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/6b/20/471f41173930550f279ccb65596a5ac19b9ac974a8d93679bcd3e0c31498/mock-5.1.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/bb/f9/12297ed8d8301a401e7d8eb6b418d32547f1d700ed3c038d325a605421a4/numpy-2.1.3-cp313-cp313-win_amd64.whl - pypi: https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/ef/7d/500c9ad20238fcfcb4cb9243eede163594d7020ce87bd9610c9e02771876/pip-24.3.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/17/b7/71f9fbebc37ecf55233407f348b9acc974482e6ee37d057a1e8e3baba081/pkginfo-1.11.2-py3-none-any.whl @@ -495,6 +503,7 @@ environments: - pypi: https://files.pythonhosted.org/packages/32/12/149a568c244b58912350c7fd3b997ed6b57889a22098564cc43c3e511b76/pytest_console_scripts-1.4.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/36/3b/48e79f2cd6a61dbbd4807b4ed46cb564b4fd50a76166b1c4ea5c1d9e2371/pytest_cov-6.0.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/f2/3b/b26f90f74e2986a82df6e7ac7e319b8ea7ccece1caec9f8ab6104dc70603/pytest_mock-3.14.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/6d/82/1d96bf03ee4c0fdc3c0cbe61470070e659ca78dc0086fb88b66c185e2449/pytest_xdist-3.6.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/17/e7/200045de1f41ad74915a334f7c2aac54d2d6f4b89643a53e1062cde4895b/python_utils-3.9.0-py2.py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/9d/9d/a69358047742dbc94516c71c07cfab4409d490578815c875949011e3f482/rapidfuzz-3.10.1-cp313-cp313-win_amd64.whl - pypi: https://files.pythonhosted.org/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl @@ -731,6 +740,17 @@ packages: url: https://files.pythonhosted.org/packages/8f/d7/9322c609343d929e75e7e5e6255e614fcc67572cfd083959cdef3b7aad79/docutils-0.21.2-py3-none-any.whl sha256: dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2 requires_python: '>=3.9' +- kind: pypi + name: execnet + version: 2.1.1 + url: https://files.pythonhosted.org/packages/43/09/2aea36ff60d16dd8879bdb2f5b3ee0ba8d08cbbdcdfe870e695ce3784385/execnet-2.1.1-py3-none-any.whl + sha256: 26dee51f1b80cebd6d0ca8e74dd8745419761d3bef34163928cbebbdc4749fdc + requires_dist: + - hatch ; extra == 'testing' + - pre-commit ; extra == 'testing' + - pytest ; extra == 'testing' + - tox ; extra == 'testing' + requires_python: '>=3.8' - kind: pypi name: furo version: 2024.8.6 @@ -744,9 +764,9 @@ packages: requires_python: '>=3.8' - kind: pypi name: grayskull - version: 2.7.4.dev12+g5b29307.d20241113 + version: 2.7.4.dev13+gb771c43.d20241113 path: . - sha256: ef331d8c19ff5b0f31f3bba9b130567121bd19122b05b5ed8628fbe6b19d4e65 + sha256: dccf6cdee4b6c0f03dc68cf1a567dac3ee4059d66ce3263b6bba5b1e5c70f73d requires_dist: - beautifulsoup4 - colorama @@ -773,8 +793,10 @@ packages: - pytest ; extra == 'testing' - pytest-console-scripts ; extra == 'testing' - pytest-cov ; extra == 'testing' + - pytest-xdist ; extra == 'testing' - pytest-mock ; extra == 'testing' - setuptools-scm ; extra == 'testing' + - numpy ; extra == 'testing' requires_python: '>=3.10' editable: true - kind: pypi @@ -1302,6 +1324,24 @@ packages: purls: [] size: 889086 timestamp: 1724658547447 +- kind: pypi + name: numpy + version: 2.1.3 + url: https://files.pythonhosted.org/packages/45/e1/210b2d8b31ce9119145433e6ea78046e30771de3fe353f313b2778142f34/numpy-2.1.3-cp313-cp313-macosx_11_0_arm64.whl + sha256: f653490b33e9c3a4c1c01d41bc2aef08f9475af51146e4a7710c450cf9761598 + requires_python: '>=3.10' +- kind: pypi + name: numpy + version: 2.1.3 + url: https://files.pythonhosted.org/packages/70/50/73f9a5aa0810cdccda9c1d20be3cbe4a4d6ea6bfd6931464a44c95eef731/numpy-2.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl + sha256: 5641516794ca9e5f8a4d17bb45446998c6554704d888f86df9b200e66bdcce56 + requires_python: '>=3.10' +- kind: pypi + name: numpy + version: 2.1.3 + url: https://files.pythonhosted.org/packages/bb/f9/12297ed8d8301a401e7d8eb6b418d32547f1d700ed3c038d325a605421a4/numpy-2.1.3-cp313-cp313-win_amd64.whl + sha256: 747641635d3d44bcb380d950679462fae44f54b131be347d5ec2bce47d3df9ed + requires_python: '>=3.10' - kind: conda name: openssl version: 3.4.0 @@ -1501,6 +1541,18 @@ packages: - pytest-asyncio ; extra == 'dev' - tox ; extra == 'dev' requires_python: '>=3.8' +- kind: pypi + name: pytest-xdist + version: 3.6.1 + url: https://files.pythonhosted.org/packages/6d/82/1d96bf03ee4c0fdc3c0cbe61470070e659ca78dc0086fb88b66c185e2449/pytest_xdist-3.6.1-py3-none-any.whl + sha256: 9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7 + requires_dist: + - execnet>=2.1 + - pytest>=7.0.0 + - psutil>=3.0 ; extra == 'psutil' + - setproctitle ; extra == 'setproctitle' + - filelock ; extra == 'testing' + requires_python: '>=3.8' - kind: conda name: python version: 3.13.0 diff --git a/pyproject.toml b/pyproject.toml index 5b186e9f..1d652029 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,8 +38,10 @@ testing = [ "pytest", "pytest-console-scripts", "pytest-cov", + "pytest-xdist", "pytest-mock", "setuptools-scm", + "numpy" ] docs = [ diff --git a/tests/data/poetry/langchain-expected.yaml b/tests/data/poetry/langchain-expected.yaml index d2dceafe..2492bc29 100644 --- a/tests/data/poetry/langchain-expected.yaml +++ b/tests/data/poetry/langchain-expected.yaml @@ -74,6 +74,7 @@ test: - langchain-server --help requires: - pip + - python about: home: https://www.github.com/hwchase17/langchain diff --git a/tests/test_pypi.py b/tests/test_pypi.py index b802e34d..a5b68f6a 100644 --- a/tests/test_pypi.py +++ b/tests/test_pypi.py @@ -292,7 +292,7 @@ def test_compose_test_section_with_console_scripts(): expected = { "imports": {"pytest"}, "commands": {"pip check", "py.test --help", "pytest --help"}, - "requires": {"pip"}, + "requires": {"pip", "python"}, } assert test_section == expected @@ -312,6 +312,7 @@ def test_compose_test_section_with_requirements(dask_sdist_metadata): "pytest-xdist", "pytest-rerunfailures", "pre-commit", + "python", }, } assert test_section == expected @@ -353,7 +354,7 @@ def set_of_strings(sequence): assert set(recipe["outputs"]) == set() assert set(recipe["requirements"]["host"]) == set(host_requirements) assert set(recipe["requirements"]["run"]) == set(base_requirements) - assert set(recipe["test"]["requires"]) == {"pip"} + assert set(recipe["test"]["requires"]) == {"pip", "python"} # all extras are included in the requirements config = Configuration(name="dask", version="2022.6.1", extras_require_all=True) @@ -368,7 +369,7 @@ def set_of_strings(sequence): expected.extend(req_lst) assert set(recipe["requirements"]["host"]) == set(host_requirements) assert set_of_strings(recipe["requirements"]["run"]) == set(expected) - assert set_of_strings(recipe["test"]["requires"]) == {"pip"} + assert set_of_strings(recipe["test"]["requires"]) == {"pip", "python"} # all extras are included in the requirements except for the # test requirements which are in the test section @@ -389,7 +390,11 @@ def set_of_strings(sequence): expected.extend(req_lst) assert set(recipe["requirements"]["host"]) == set(host_requirements) assert set_of_strings(recipe["requirements"]["run"]) == set(expected) - assert set_of_strings(recipe["test"]["requires"]) == {"pip", *extras["test"]} + assert set_of_strings(recipe["test"]["requires"]) == { + "pip", + *extras["test"], + "python", + } # only "array" is included in the requirements config = Configuration( @@ -404,7 +409,7 @@ def set_of_strings(sequence): "Extra: array", *extras["array"], } - assert set_of_strings(recipe["test"]["requires"]) == {"pip"} + assert set_of_strings(recipe["test"]["requires"]) == {"pip", "python"} # only "test" is included but in the test section config = Configuration( @@ -419,7 +424,11 @@ def set_of_strings(sequence): assert set(recipe["outputs"]) == set() assert set(recipe["requirements"]["host"]) == set(host_requirements) assert set_of_strings(recipe["requirements"]["run"]) == set(base_requirements) - assert set_of_strings(recipe["test"]["requires"]) == {"pip", *extras["test"]} + assert set_of_strings(recipe["test"]["requires"]) == { + "pip", + *extras["test"], + "python", + } # only "test" is included in the test section config = Configuration( @@ -435,7 +444,11 @@ def set_of_strings(sequence): assert set(recipe["outputs"]) == set() assert set(recipe["requirements"]["host"]) == set(host_requirements) assert set_of_strings(recipe["requirements"]["run"]) == set(base_requirements) - assert set_of_strings(recipe["test"]["requires"]) == {"pip", *extras["test"]} + assert set_of_strings(recipe["test"]["requires"]) == { + "pip", + *extras["test"], + "python", + } # all extras have their own output except for the # test requirements which are in the test section @@ -469,7 +482,7 @@ def set_of_strings(sequence): found[output["name"]] = set_of_strings(output["requirements"]["run"]) assert found == expected - expected = {"pip", *extras["test"]} + expected = {"pip", *extras["test"], "python"} assert set_of_strings(recipe["test"]["requires"]) == expected for output in recipe["outputs"]: if output["name"] == "dask": @@ -838,7 +851,7 @@ def test_ciso_recipe(): ["<{ pin_compatible('numpy') }}", "oldest-supported-numpy", "python >=3.9"] ) assert recipe["test"]["commands"] == ["pip check"] - assert recipe["test"]["requires"] == ["pip"] + assert recipe["test"]["requires"] == ["pip", "python"] assert recipe["test"]["imports"] == ["ciso"] @@ -1024,23 +1037,24 @@ def test_normalize_pkg_name(): assert normalize_pkg_name("pytest") == "pytest" -def test_mypy_deps_normalization_and_entry_points(): +def test_mypy_deps_normalization(): config = Configuration(name="mypy", version="0.770") recipe = GrayskullFactory.create_recipe("pypi", config) - assert "mypy_extensions >=0.4.3,<0.5.0" in recipe["requirements"]["run"] + assert ( + "mypy_extensions >=0.4.3,<0.5.0" in recipe["requirements"]["run"] + or "mypy_extensions <0.5.0,>=0.4.3" in recipe["requirements"]["run"] + ) assert "mypy-extensions >=0.4.3,<0.5.0" not in recipe["requirements"]["run"] - assert "typed-ast >=1.4.0,<1.5.0" in recipe["requirements"]["run"] + assert "mypy-extensions <0.5.0,>=0.4.3" not in recipe["requirements"]["run"] + assert ( + "typed-ast >=1.4.0,<1.5.0" in recipe["requirements"]["run"] + or "typed-ast <1.5.0,>=1.4.0" in recipe["requirements"]["run"] + ) assert "typed_ast <1.5.0,>=1.4.0" not in recipe["requirements"]["run"] + assert "typed_ast >=1.4.0,<1.5.0" not in recipe["requirements"]["run"] assert "typing-extensions >=3.7.4" not in recipe["requirements"]["run"] assert "typing_extensions >=3.7.4" in recipe["requirements"]["run"] - assert recipe["build"]["entry_points"] == [ - "mypy=mypy.__main__:console_entry", - "stubgen=mypy.stubgen:main", - "stubtest=mypy.stubtest:main", - "dmypy=mypy.dmypy.client:console_entry", - ] - @pytest.mark.skipif( condition=sys.platform.startswith("win"), reason="Skipping test for win" @@ -1376,7 +1390,7 @@ def test_noarch_python_min_constrain(freeze_py_cf_supported): version="0.1.1", py_cf_supported=freeze_py_cf_supported, ) - assert recipe["requirements"]["run"] == ["python >=3.6"] + assert recipe["requirements"]["run"] == ["python >=<{python_min}}"] def test_cpp_language_extra(): From 735d83fac0b829f5844d6f2a1b7bb085283d9086 Mon Sep 17 00:00:00 2001 From: Marcelo Trevisani Date: Wed, 13 Nov 2024 16:49:04 +0000 Subject: [PATCH 3/4] Add more test to cover set_python_min --- grayskull/strategy/pypi.py | 2 +- tests/test_pypi.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/grayskull/strategy/pypi.py b/grayskull/strategy/pypi.py index f74d2328..532362d4 100644 --- a/grayskull/strategy/pypi.py +++ b/grayskull/strategy/pypi.py @@ -590,9 +590,9 @@ def set_python_min(req_list: list, section: str) -> list: return req_list python_min = "<{ python_min }}" map_section = { - "test": f"={python_min}", "host": f"{python_min}.*", "run": f">={python_min}", + "test": f"={python_min}", } return [ f"python {map_section[section]}" if dep.lower().strip() == "python" else dep diff --git a/tests/test_pypi.py b/tests/test_pypi.py index a5b68f6a..b3b4b799 100644 --- a/tests/test_pypi.py +++ b/tests/test_pypi.py @@ -45,6 +45,7 @@ normalize_requirements_list, remove_all_inner_nones, remove_selectors_pkgs_if_needed, + set_python_min, sort_reqs, update_recipe, ) @@ -1453,3 +1454,16 @@ def test_check_noarch_python_for_new_deps(): config, ) assert config.is_arch is False + + +@pytest.mark.parametrize( + "section, expected", + [ + ("host", "python <{ python_min }}.*"), + ("run", "python >=<{ python_min }}"), + ("test", "python =<{ python_min }}"), + ], +) +def test_set_python_min(section, expected): + req = ["pip", "python"] + assert set_python_min(req, section) == ["pip", expected] From f72f665a3ec2802d629645086474e364f500ace8 Mon Sep 17 00:00:00 2001 From: Marcelo Duarte Trevisani Date: Wed, 13 Nov 2024 16:55:33 +0000 Subject: [PATCH 4/4] update python_min format Co-authored-by: Filipe --- grayskull/strategy/pypi.py | 4 ++-- tests/test_pypi.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grayskull/strategy/pypi.py b/grayskull/strategy/pypi.py index 532362d4..04240d25 100644 --- a/grayskull/strategy/pypi.py +++ b/grayskull/strategy/pypi.py @@ -590,9 +590,9 @@ def set_python_min(req_list: list, section: str) -> list: return req_list python_min = "<{ python_min }}" map_section = { - "host": f"{python_min}.*", + "host": f"{python_min}", "run": f">={python_min}", - "test": f"={python_min}", + "test": f"{python_min}", } return [ f"python {map_section[section]}" if dep.lower().strip() == "python" else dep diff --git a/tests/test_pypi.py b/tests/test_pypi.py index b3b4b799..3818d79e 100644 --- a/tests/test_pypi.py +++ b/tests/test_pypi.py @@ -1459,9 +1459,9 @@ def test_check_noarch_python_for_new_deps(): @pytest.mark.parametrize( "section, expected", [ - ("host", "python <{ python_min }}.*"), + ("host", "python <{ python_min }}"), ("run", "python >=<{ python_min }}"), - ("test", "python =<{ python_min }}"), + ("test", "python <{ python_min }}"), ], ) def test_set_python_min(section, expected):