diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 82f72a5..825d5f5 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -16,10 +16,10 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Set up python 3.8 + - name: Set up python 3.11 uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: 3.11 - name: Run unit tests for minimum dependency generator run: | make installdeps diff --git a/Dockerfile b/Dockerfile index db6d3cc..20c5d20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8 +FROM python:3.11 ADD create_feedstock_meta_yaml create_feedstock_meta_yaml ADD requirements.txt requirements.txt diff --git a/create_feedstock_meta_yaml/create_feedstock_meta_yaml.py b/create_feedstock_meta_yaml/create_feedstock_meta_yaml.py index 2033cc5..de3e3a3 100644 --- a/create_feedstock_meta_yaml/create_feedstock_meta_yaml.py +++ b/create_feedstock_meta_yaml/create_feedstock_meta_yaml.py @@ -1,5 +1,6 @@ import configparser +import os.path import requests import tomli from conda_forge_tick.recipe_parser import CondaMetaYAML @@ -58,10 +59,25 @@ def create_feedstock_meta_yaml( with open(project_metadata_filepath, "rb") as f: toml_dict = tomli.load(f) - run_requirements = clean_reqs(toml_dict["project"]["dependencies"]) - test_requirements = clean_reqs( - toml_dict["project"]["optional-dependencies"]["test"], - ) + project = toml_dict["project"] + + if 'dynamic' in project: + dynamic = toml_dict["tool"]["setuptools"]["dynamic"] + + run_requirements_file = dynamic["dependencies"]["file"][0] + test_requirements_file = dynamic["optional-dependencies"]["test"]["file"][0] + + basedir = os.path.dirname(project_metadata_filepath) + + with open(os.path.join(basedir, run_requirements_file), "r") as f: + run_requirements = clean_reqs(f.readlines()) + with open(os.path.join(basedir, test_requirements_file), "r") as f: + test_requirements = clean_reqs(f.readlines()) + elif all(key in project for key in ('dependencies', 'dependencies')): + run_requirements = clean_reqs(toml_dict["project"]["dependencies"]) + test_requirements = clean_reqs( + toml_dict["project"]["optional-dependencies"]["test"] + ) else: raise ValueError( "Unsupported project metadata file type.", diff --git a/create_feedstock_meta_yaml/test_create_feedstock_meta_yaml.py b/create_feedstock_meta_yaml/test_create_feedstock_meta_yaml.py index d51d97d..f3b0ddf 100644 --- a/create_feedstock_meta_yaml/test_create_feedstock_meta_yaml.py +++ b/create_feedstock_meta_yaml/test_create_feedstock_meta_yaml.py @@ -51,6 +51,21 @@ def test_toml_input(self): ) verify_cmeta(cmeta, self.pypi_version) + def test_toml_dynamic_input(self): + + project_metadata_filepath = os.path.join(self.dir_path, "test_dynamic_pyproject.toml") + meta_yaml_filepath = os.path.join(self.dir_path, "test_meta_toml.yaml") + + cmeta = create_feedstock_meta_yaml( + self.project, + self.pypi_version, + project_metadata_filepath=project_metadata_filepath, + meta_yaml_filepath=meta_yaml_filepath, + add_to_run_requirements=self.add_to_run_requirements, + add_to_test_requirements=self.add_to_test_requirements, + ) + verify_cmeta(cmeta, self.pypi_version) + def verify_cmeta(cmeta, pypi_version): expected_run_reqs = [ diff --git a/create_feedstock_meta_yaml/test_dynamic_pyproject.toml b/create_feedstock_meta_yaml/test_dynamic_pyproject.toml new file mode 100644 index 0000000..aee8ebb --- /dev/null +++ b/create_feedstock_meta_yaml/test_dynamic_pyproject.toml @@ -0,0 +1,9 @@ +[project] +requires-python = ">=3.8,<4" +dynamic = ["dependencies", "optional-dependencies"] + +[tool.setuptools.dynamic.dependencies] +file = ["test_dynamic_requirements.txt"] + +[tool.setuptools.dynamic.optional-dependencies] +test = { file = ["test_dynamic_requirements_test.txt"] } diff --git a/create_feedstock_meta_yaml/test_dynamic_requirements.txt b/create_feedstock_meta_yaml/test_dynamic_requirements.txt new file mode 100644 index 0000000..2e9e422 --- /dev/null +++ b/create_feedstock_meta_yaml/test_dynamic_requirements.txt @@ -0,0 +1,11 @@ +click>=7.0.0 +cloudpickle>=1.5.0 +dask[dataframe]>=2021.10.0 +distributed>=2021.10.0 +holidays>=0.13 +numpy>=1.21.0 +pandas>=1.4.0,!= 1.4.2 +psutil>=5.6.6 +scipy>=1.3.3 +tqdm>=4.32.0 +woodwork>=0.16.2 diff --git a/create_feedstock_meta_yaml/test_dynamic_requirements_test.txt b/create_feedstock_meta_yaml/test_dynamic_requirements_test.txt new file mode 100644 index 0000000..e8ea50e --- /dev/null +++ b/create_feedstock_meta_yaml/test_dynamic_requirements_test.txt @@ -0,0 +1,12 @@ +boto3>=1.17.46 +composeml>=0.8.0 +graphviz>=0.8.4 +moto[all]>=3.0.7 +pip>=21.3.1 +pyarrow>=3.0.0 +pympler>=0.8 +pytest>=7.1.2 +pytest-cov>=3.0.0 +pytest-xdist>=2.5.0 +smart-open>=5.0.0 +urllib3>=1.26.5 diff --git a/requirements.txt b/requirements.txt index 4253b77..9f1996c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,6 @@ jinja2 ruamel.yaml ruamel.yaml.jinja2 packaging -git+https://github.com/regro/cf-scripts.git@master +git+https://github.com/regro/cf-scripts.git@2025.2.91 pre-commit tomli \ No newline at end of file