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

Use js-yaml for environment-name parsing #82

Merged
merged 8 commits into from
Jun 12, 2023
Merged

Use js-yaml for environment-name parsing #82

merged 8 commits into from
Jun 12, 2023

Conversation

pavelzw
Copy link
Member

@pavelzw pavelzw commented Jun 12, 2023

Fixes #81

Before, the environment-name was parsed using regex. Then, because of #78, we switched to a regex that also includes the line start, i.e., ^name:\s*(.*) instead of name:\s*(.*).
This apparently doesn't work because the newlines %0A are not recognized by string.match.

We now switch to yaml parsing with js-yaml. This now also reads environment files correctly that have inline comments

name: myenv # this is a comment that doesn't belong to the name
dependencies: 
  - python
  - ...

Conda environment files also support jinja2, see here. This is out of scope for this project since adding a whole new yaml-conda parser in JS is too much effort and technical debt for just letting setup-micromamba infer the name of the environment. For these use cases, provide a custom environment-name as indicated by the error message.

@pavelzw pavelzw added the bug Something isn't working label Jun 12, 2023
@github-actions github-actions bot added ci dependencies Pull requests that update a dependency file labels Jun 12, 2023
@pavelzw pavelzw added this pull request to the merge queue Jun 12, 2023
Merged via the queue into main with commit 875557d Jun 12, 2023
38 checks passed
@pavelzw pavelzw deleted the test-comment branch June 12, 2023 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ci dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Environment creation fails if environment.yml file has comments at top of file
1 participant