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

Do not wrap YAML lines #524

Merged
merged 15 commits into from
Jul 10, 2024
Merged

Conversation

maddenp-noaa
Copy link
Contributor

@maddenp-noaa maddenp-noaa commented Jul 9, 2024

Synopsis

  1. Set the width of YAML output lines to infinity to avoid them wrapping. See example below.
  2. Factor yaml.dump() calls out to a support function for consistency across call sites.
  3. Improve __repr__ dunder methods on Config subclasses.
  4. Add format components to Config-subclass test names (e.g. test_something() -> test_yaml_something() for easier targeting with pytest -k

Previously, given config.yaml

foo: bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar

we would get

$ uw config realize --input-file config.yaml --output-format yaml
foo: bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar
  bar

The new behavior is

$ uw config realize --input-file config.yaml --output-format yaml
foo: bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar

Type

  • Code maintenance (refactoring, etc. without behavior change)
  • Enhancement (adds new functionality)

Impact

  • This is a breaking change (changes existing functionality)

Technically this is a breaking change because it changes (and improves) the output of repr() and str() on Config objects, though it's unlikely anyone was relying on these.

Checklist

  • I have added myself and any co-authors to the PR's Assignees list.
  • I have reviewed the documentation and have made any updates necessitated by this change.

@maddenp-noaa maddenp-noaa self-assigned this Jul 9, 2024
Copy link
Contributor

@christinaholtNOAA christinaholtNOAA left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@NaureenBharwaniNOAA NaureenBharwaniNOAA left a comment

Choose a reason for hiding this comment

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

Looks great!

@maddenp-noaa maddenp-noaa merged commit 51f1929 into ufs-community:main Jul 10, 2024
2 checks passed
@maddenp-noaa maddenp-noaa deleted the yaml-dump-width branch July 10, 2024 14:45
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.

4 participants