boa icon indicating copy to clipboard operation
boa copied to clipboard

boa convert doesn't work with outputs (multiple packages in one build)

Open raybellwaves opened this issue 2 years ago • 2 comments

I'm guess outputs may be the issues and i'm not sure what the desired recipe.yaml would look like if someone converts it by hand.

Take the rich meta.yaml (https://github.com/conda-forge/rich-feedstock/blob/main/recipe/meta.yaml)

if you run boa convert meta.yaml -> recipe.yaml it outputs

OrderedDict([('package', {'name': 'rich'}), ('build', {}), ('requirements', {'host': ['pip', 'poetry-core >=1.0.0', 'python {{ min_python }}'], 'run': ['markdown-it-py >=2.2.0', 'pygments >=2.13.0,<3.0.0', 'python {{ min_python }}', 'typing_extensions >=4.0.0,<5.0.0']}), ('test', {'imports': ['rich'], 'commands': ['pip check'], 'requires': ['pip']})])
OrderedDict([('package', {'name': 'rich-with-jupyter'}), ('build', {}), ('requirements', {'host': ['python {{ min_python }}'], 'run': ['{{ pin_subpackage("rich", max_pin="x.x.x") }}', 'ipywidgets >=7.5.1,<9.0.0', 'python {{ min_python }}']}), ('test', {'imports': ['rich'], 'commands': ['pip check'], 'requires': ['pip']})])
OrderedDict([('package', {'name': '_rich-with-tests'}), ('build', {}), ('requirements', {'host': ['python {{ min_python }}'], 'run': ['{{ pin_subpackage("rich", max_pin="x.x.x") }}', '{{ pin_subpackage("rich-with-jupyter", max_pin="x.x.x") }}', 'python {{ min_python }}']}), ('test', {'source_files': ['src/tests'], 'imports': ['rich'], 'commands': ['pip check', 'pytest src/tests -vv --cov=rich --cov-branch --cov-report=term-missing:skip-covered --no-cov-on-fail --cov-fail-under=91'], 'requires': ['attrs', 'pip', 'pytest >=7.0.0,<8.0.0', 'pytest-cov >=3.0.0,<4.0.0']})])
context:
  min_python: '>=3.7.0'
  version: 13.4.2

package:
  name: rich-split
  version: '{{ version }}'

source:
  - folder: dist
    url: https://pypi.io/packages/source/r/rich/rich-{{ version }}.tar.gz
    sha256: d653d6bccede5844304c605d5aac802c7cf9621efd700b46c7ec2b51ea914898
  - folder: src
    url: https://github.com/Textualize/rich/archive/refs/tags/v{{ version }}.tar.gz
    sha256: 12840a1eb0400792d2d12a57c7ede779b6eacf8f27718618127adbc1749c1a91

build:
  noarch: python
  number: 0

requirements:
  host:
    - python {{ min_python }}
  run:
    - python {{ min_python }}

outputs:
  - package:
      name: rich
    build: {}
    requirements:
      host:
        - pip
        - poetry-core >=1.0.0
        - python {{ min_python }}
      run:
        # sync with normalized deps from poetry-generated setup.py
        - markdown-it-py >=2.2.0
        - pygments >=2.13.0,<3.0.0
        - python {{ min_python }}
        - typing_extensions >=4.0.0,<5.0.0
    test:
      imports:
        - rich
      commands:
        - pip check
      requires:
        - pip

  - package:
      name: rich-with-jupyter
    build: {}
    requirements:
      host:
        - python {{ min_python }}
      run:
        - '{{ pin_subpackage("rich", max_pin="x.x.x") }}'
        - ipywidgets >=7.5.1,<9.0.0
        - python {{ min_python }}
    test:
      imports:
        - rich
      commands:
        - pip check
      requires:
        - pip

  - package:
      name: _rich-with-tests
    build: {}
    requirements:
      host:
        - python {{ min_python }}
      run:
        - '{{ pin_subpackage("rich", max_pin="x.x.x") }}'
        - '{{ pin_subpackage("rich-with-jupyter", max_pin="x.x.x") }}'
        - python {{ min_python }}
    test:
      source_files:
        - src/tests
      imports:
        - rich
      commands:
        - pip check
        - pytest src/tests -vv --cov=rich --cov-branch --cov-report=term-missing:skip-covered --no-cov-on-fail --cov-fail-under=91
      requires:
        - attrs
        - pip
        - pytest >=7.0.0,<8.0.0
        - pytest-cov >=3.0.0,<4.0.0

about:
  home: https://github.com/Textualize/rich
  license: MIT
  license_family: MIT
  license_file: dist/LICENSE
  summary: Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal

  description: |
    Rich is a Python library for rich text and beautiful formatting in the terminal.

    The Rich API makes it easy to add color and style to terminal output. Rich
    can also render pretty tables, progress bars, markdown, syntax highlighted
    source code, tracebacks, and more — out of the box.

  doc_url: https://rich.readthedocs.io
  dev_url: https://github.com/Textualize/rich

extra:
  feedstock-name: rich
  recipe-maintainers:
    - jan-janssen
    - willmcgugan
    - bollwyvl

I don't think the OrderedDict at the top is valid yaml?

If I try and use this recipe I get

boa build test --output-folder /tmp/boa:

❯ boa build test --output-folder /tmp/boa

           _
          | |__   ___   __ _
          | '_ \ / _ \ / _` |
          | |_) | (_) | (_| |
          |_.__/ \___/ \__,_|


Loading config files:

Updating build index: /tmp/boa

Traceback (most recent call last):
  File "/Users/ray/miniforge3/envs/main/bin/boa", line 10, in <module>
    sys.exit(main())
  File "/Users/ray/miniforge3/envs/main/lib/python3.10/site-packages/boa/cli/boa.py", line 244, in main
    run_build(args)
  File "/Users/ray/miniforge3/envs/main/lib/python3.10/site-packages/boa/core/run_build.py", line 502, in run_build
    all_recipes = find_all_recipes(args.target, config, is_pyproject_recipe)  # [noqa]
  File "/Users/ray/miniforge3/envs/main/lib/python3.10/site-packages/boa/core/run_build.py", line 53, in find_all_recipes
    yml = render(fn, config=config, is_pyproject_recipe=is_pyproject_recipe)
  File "/Users/ray/miniforge3/envs/main/lib/python3.10/site-packages/boa/core/render.py", line 184, in render
    ydoc = loader.load(fi)
  File "/Users/ray/miniforge3/envs/main/lib/python3.10/site-packages/ruamel/yaml/main.py", line 426, in load
    return constructor.get_single_data()
  File "/Users/ray/miniforge3/envs/main/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 111, in get_single_data
    node = self.composer.get_single_node()
  File "_ruamel_yaml.pyx", line 706, in _ruamel_yaml.CParser.get_single_node
  File "_ruamel_yaml.pyx", line 724, in _ruamel_yaml.CParser._compose_document
  File "_ruamel_yaml.pyx", line 775, in _ruamel_yaml.CParser._compose_node
  File "_ruamel_yaml.pyx", line 891, in _ruamel_yaml.CParser._compose_mapping_node
  File "_ruamel_yaml.pyx", line 904, in _ruamel_yaml.CParser._parse_next_event
ruamel.yaml.parser.ParserError: while parsing a block mapping
  in "test/recipe.yaml", line 1, column 1
did not find expected key
  in "test/recipe.yaml", line 1, column 41

raybellwaves avatar Jul 06 '23 20:07 raybellwaves

Hi @raybellwaves,

indeed, the convert command only works for really simple cases.

There are some differences with outputs (there is no notion of a "top-level" recipe in boa).

Maybe you can convert your recipe manually? I am also happy to help

wolfv avatar Jul 07 '23 08:07 wolfv

Thanks for the offer. I kept it simple and just did boa-base-recipe and boa-recipe. One is no deps and the other is full deps and I didn't do pinning of subpackages

raybellwaves avatar Jul 07 '23 15:07 raybellwaves