Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds --debug flag to conversion script #41

Merged
merged 4 commits into from
May 1, 2024

Conversation

schuylermartin45
Copy link
Collaborator

@schuylermartin45 schuylermartin45 commented May 1, 2024

Adds a --debug (and -d) flag to the conversion script. This flag prints debugging output to STDERR. For now it prints the initial parse-tree and the post-conversion parse-tree.

I've been using this strategy informally for months to determine if a bug is caused by an incorrect parse tree or a failure of the rendering function.

This PR also raises the unit testing coverage minimum to 80%. This should have been raised when the project was ported to conda-incubator.

Here's a sample debug output of a parser instance:

--------------------
RecipeParser Instance
- Variables Table:
{
  "name": "boto",
  "version": "2.49.0"
}
- Selectors Table:
  [py2k]
    - asadmin -h -> /test/commands/0
    - taskadmin -h -> /test/commands/2
- is_modified?: False
- Tree:
/
  |- package
    |- name
      |- {{ name|lower }}
    |- version
      |- {{ version }}
  |- source
    |- fn
      |- {{ name }}-{{ version }}.tar.gz
    |- url
      |- https://pypi.org/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
    |- sha256
      |- ea0d3b40a2d852767be77ca343b58a9e3a4b00d9db440efb8da74b4e58025e5a
  |- requirements
    |- host
      |- python
    |- run
      |- python
  |- build
    |- number
      |- 0
    |- script
      |- python setup.py install
  |- test
    |- commands
      |- asadmin -h
      |- s3put -h
      |- taskadmin -h
    |- imports
      |- boto
  |- about
    |- home
      |- https://github.com/boto/boto/
    |- license
      |- MIT
    |- summary
      |- Amazon Web Services Library
    |- description
      |- ['Boto aims to support the full breadth and depth of Amazon Web Services.', 'NOTE: Boto3, the next version of Boto, is stable and recommended for', 'general use.']
    |- doc_url
      |- http://docs.pythonboto.org/en/latest/
    |- doc_source_url
      |- https://github.com/boto/boto/blob/develop/docs/source/index.rst
    |- dev_url
      |- https://github.com/boto/boto/
--------------------


@schuylermartin45 schuylermartin45 requested a review from a team as a code owner May 1, 2024 14:48
@@ -276,7 +291,9 @@ def convert(
# Process recipes in parallel
thread_pool_size: Final[int] = mp.cpu_count()
with mp.Pool(thread_pool_size) as pool:
results = dict(pool.starmap(process_recipe, [(file, path, output) for file in files])) # type: ignore[misc]
results = dict(
pool.starmap(process_recipe, [(file, path, output, debug) for file in files]) # type: ignore[misc]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about starmap()! 🤩

@schuylermartin45 schuylermartin45 merged commit e323fd7 into main May 1, 2024
11 checks passed
@schuylermartin45 schuylermartin45 deleted the smartin_boto_list_fix branch May 1, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants