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

Rejig #265

Merged
merged 12 commits into from
Nov 8, 2023
Merged

Rejig #265

merged 12 commits into from
Nov 8, 2023

Conversation

oliver-sanders
Copy link
Member

@oliver-sanders oliver-sanders commented Nov 1, 2023

Bit of TLC in preparation for the addition of a new rose-stem interface which needs to be bodged into the middle of an existing function.

Main changes:

  • refactor: move utilities out of the entry_points module
    • Move utils out of the entry points module and move the rose-stem entry
      point in.
    • Move fileinstall into its own module.
    • Sort imports.
  • entry_points: remove type uncertainty
    • Entry points accept missing or None values for arguments, however,
      this can never happen in practice.
    • Set the appropriate type hints and remove code paths which could not
      get executed.
    • Cascade this to simplify code further down the call chain

Minor changes:

  • entry_points: remove unused results return value
  • utils: split the loading and processing of the config
    • A future rose stem interface will need to inject itself
      between config loading and processing.
    • So colocate the plugin processing logic into one function.
  • fileinstall: remove unused "srcdir" argument
  • utils: remove unused "opts" arg in "rose_config_exists"
  • utils: make environ arg optional
  • tests: fix accidentally skipped tests
    • ['a'].sort() returns None not ['a']
    • So assert a.sort() == b.sort() will always be True.
  • tests: fix os.environ test interaction
  • tests: amend docstrings
    • Amend false docstrings.
    • Rename a couple of modules.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • CHANGES.md entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

* Move utils out of the entry points module and move the rose-stem entry
  point in.
* Move fileinstall into its own module.
* Sort imports.
* `['a'].sort()` returns `None` not `['a']`
* So `assert a.sort() == b.sort()` will always be `True`.
* Avoid having to handle None values for srcdir/rundir throughout
  the codebase by catching them earlier.
* A future rose stem interface will need to inject itself
  between config loading and processing.
* So colocate the plugin processing logic into one function.
@oliver-sanders oliver-sanders added this to the 1.4.0 milestone Nov 1, 2023
@oliver-sanders oliver-sanders self-assigned this Nov 1, 2023
@oliver-sanders oliver-sanders removed the request for review from MetRonnie November 1, 2023 12:17
* Entry points accept missing or None values for arguments, however,
  this can never happen in practice.
* Set the appropriate type hints and remove code paths which could not
  get executed.
* Amend false docstrings.
* Rename a couple of modules.
cylc/rose/entry_points.py Outdated Show resolved Hide resolved
cylc/rose/fileinstall.py Outdated Show resolved Hide resolved
cylc/rose/entry_points.py Outdated Show resolved Hide resolved
Comment on lines +485 to +487
opt_conf_keys: list = []
defines: list = []
rose_template_vars: list = []
Copy link
Member

Choose a reason for hiding this comment

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

Can it be more specific? List[str]?

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't know the types, added the list placeholder purely to allow the function to by type checked in the first place.

@wxtim wxtim merged commit 4862c06 into cylc:master Nov 8, 2023
7 checks passed
@oliver-sanders oliver-sanders deleted the rejig branch November 8, 2023 11:40
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.

3 participants