Closed schuylermartin45 closed 10 months ago
@schuylermartin45 you can only add reviewers if they are in the "contributor" group if I'm not mistaken.
looks really good! awesome work :)
If you wire it up with a CLI I'd be excited to try it on a few real-world recipes.
looks really good! awesome work :)
If you wire it up with a CLI I'd be excited to try it on a few real-world recipes.
percy
has some click
CLIs in the project. I suppose I can bump that ask up in the priority list :)
@wolfv I have added a basic CLI. Assuming you have the percy
conda environment installed and activated (make dev
is probably the easiest way to create the environment), the command is:
percy convert [-o OUTPUT] FILE
By default, the recipe is dumped to STDOUT
. Warnings/Errors always dump to STDERR
. I don't have any exception handling so if you throw it at a complicated recipe, the parser might blow up on construction.
Here's the output on a simple recipe
schema_version: 1
context:
name: types-PyYAML
version: 6.0.12.12
package:
name: ${{ name|lower }}
version: ${{ version }}
source:
url: https://pypi.io/packages/source/${{ name[0] }}/${{ name }}/types-PyYAML-${{ version }}.tar.gz
sha256: 334373d392fde0fdf95af5c3f1661885fa10c52167b14593eb856289e1855062
build:
number: 0
script: ${{ PYTHON }} -m pip install . --no-deps --no-build-isolation --ignore-installed --no-cache-dir -vv
skip: ${{ true if py<36 }}
requirements:
host:
- pip
- python
- wheel
- setuptools
run:
- python
test:
imports:
- types
requires:
- pip
commands:
- pip check
- if: unix
then: test -f $SP_DIR/yaml-stubs/__init__.pyi
about:
home: https://github.com/python/typeshed
summary: Typing stubs for PyYAML
license: Apache-2.0 AND MIT
license_file: LICENSE
license_family: OTHER
description: |
This is a PEP 561 type stub package for the PyYaml package.
It can be used by type-checking tools like mypy, pyright, pytype,
PyCharm, etc. to check code that uses PyYaml.
dev_url: https://github.com/python/typeshed
doc_url: https://pyyaml.org/wiki/PyYAMLDocumentation
extra:
recipe-maintainers:
- fhoehle
- conda-forge/mypy
Awesome! I got it to run with the following pixi.toml
:
[project]
name = "percy"
channels = ["conda-forge"]
platforms = ["linux-64", "osx-arm64"]
[tasks]
install = "pip install -e ."
[dependencies]
black = "*"
isort = "*"
make = "*"
mypy = "*"
python = ">=3.11"
pytest = "*"
pytest-cov = "*"
pytest-xdist = "*"
pylint = "*"
pip = "*"
click = ">=8.1.7"
conda = "*"
jinja2 = "*"
pyyaml = "*"
types-pyyaml = "*"
requests = "*"
types-requests = "*"
"ruamel.yaml" = "*"
conda-build = "*"
jsonschema = "*"
types-jsonschema = "*"
pre-commit = "*"
You could add more tasks (like lint) and also depenedencies between the tasks can be done (with a depends_on = ["build"]
...
I'll play around with it! Looks good so far :)
I forgot to return POSIX error codes in the CLI. I aim to get that done today and then I think I'm at the point where I'd like to merge this first iteration in.
Looks great to me! Let me know if you want to go over any additional transformations (of course this can go in a future PR).
For example, the new tests
section is a bit different (but could be easily adjusted from the previous one, essentially tests need to be split into multiple list elements) :)
@beeankha and I walked through this yesterday offline. Given the general positive conversation in this thread, I'm going to say that this POC is in a good spot to merge.
This is very much an early POC. There are many
TODO
s and it is far from perfect. There are known bugs and gaps, documented in theTODO
sThe primary goal of this PR is to implement most of the features discussed in CEP-13 and see how feasible it is to build a conversion utility in percy.
So far, so very good. As noted in the function, I am trying to use as many features of the current parser as possible to:
For less than a day's worth of work, I think this is a pretty solid POC and shows how the parser can make this work less painful.
Annoyingly I can't seem to add @wolfv to the PR despite this being an open project. I will ping him separately, but maybe that's a limitation we need to investigate @jezdez if we want community feedback. I imagine it's tied to some IT permissions group control.