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

[ENH] Remove attrs dependency #5296

Merged
merged 5 commits into from
Oct 1, 2023
Merged

Conversation

Alex-JG3
Copy link
Contributor

Reference Issues/PRs

Closes #5290.

What does this implement/fix? Explain your changes.

  • Replaces attrs with dataclasses in the igts and ggs modules of the annotation module.

Does your contribution introduce a new dependency? If yes, which one?

No, but it removes attrs as a dependency for the annotation module.

What should a reviewer concentrate their feedback on?

I would like feedback on the get_params methods for the InformationGainSegmentation and GreedyGaussianSegmentation classes. Using attrs, one can easily filter attributes where init is False. That is not so easy with dataclasses so I filtered the unwanted attributes manually. We could have tags in the GSS and IGTS classes called something like __attributes_to_ignore__ which would be a list of attributes to ignore in the get_params methods. But, since the pattern used for GGS and IGTS is likely going to change soon, I didn't think it necessary to use the tags approach.

Did you add any tests for the change?

No, but I changed the test_ggs.py and test_igts.py files to reflect the refactoring in ggs.py and igts.py respectively.

Any other comments?

Can attrs be removed from the all_extras and all_extras_pandas2 lists of dependencies in pyproject.toml?

PR checklist

For all contributions
  • I've added myself to the list of contributors with any new badges I've earned :-)
    How to: add yourself to the all-contributors file in the sktime root directory (not the CONTRIBUTORS.md). Common badges: code - fixing a bug, or adding code logic. doc - writing or improving documentation or docstrings. bug - reporting or diagnosing a bug (get this plus code if you also fixed the bug in the PR).maintenance - CI, test framework, release.
    See here for full badge reference
  • Optionally, I've added myself and possibly others to the CODEOWNERS file - do this if you want to become the owner or maintainer of an estimator you added.
    See here for further details on the algorithm maintainer role.
  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.
For new estimators
  • I've added the estimator to the API reference - in docs/source/api_reference/taskname.rst, follow the pattern.
  • I've added one or more illustrative usage examples to the docstring, in a pydocstyle compliant Examples section.
  • If the estimator relies on a soft dependency, I've set the python_dependencies tag and ensured
    dependency isolation, see the estimator dependencies guide.

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

Thanks! This seems to remove the unnecessary dependency completely.

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

We should also remove it from the all_extras dependency set.

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

there's one more, in all_extras_pandas2 ... just do a repo search for attrs, and let's check if it is entirely gone.

@fkiraly fkiraly added the maintenance Continuous integration, unit testing & package distribution label Sep 23, 2023
Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

Looks good now!

@fkiraly
Copy link
Collaborator

fkiraly commented Oct 1, 2023

I would like feedback on the get_params methods for the
InformationGainSegmentation and GreedyGaussianSegmentation classes.

Looking at this, I think the methods are not conformant with the usual expectation that they return only and exactly the __init__ parameters. Naively, I would simply delete get_params and set_params to use the default from BaseObject.

Fitted parameters, if any, should get exposed via get_fitted_params.

@fkiraly fkiraly merged commit 807a9ef into sktime:main Oct 1, 2023
24 checks passed
yarnabrina added a commit to yarnabrina/sktime-fork that referenced this pull request Oct 2, 2023
* origin/split-ci: (21 commits)
  fixed typo
  add back checkout
  change names
  switch to path filters
  edit format
  update action version
  run all tests manually and on schedule
  akipped workflows on main
  added missing installation of test dependencies
  added new extra for testing
  run base tests
  skip unnecessary checkout step
  renamed workflow file
  run component tests
  test component specific functionalities
  test base functionalities
  [ENH] Remove attrs dependency (sktime#5296)
  [ENH] add proper `inverse_transform` to `STLTransformer` (sktime#5300)
  [DOC] add `blog` badge for `fkiraly`, for ODSC blog post (sktime#5291)
  [BUG] in `Imputer`, fix `y` not being passed in `method="forecaster"` (sktime#5287)
  ...
yarnabrina added a commit to yarnabrina/sktime-fork that referenced this pull request Oct 2, 2023
…recasting

* origin/split-ci: (21 commits)
  fixed typo
  add back checkout
  change names
  switch to path filters
  edit format
  update action version
  run all tests manually and on schedule
  akipped workflows on main
  added missing installation of test dependencies
  added new extra for testing
  run base tests
  skip unnecessary checkout step
  renamed workflow file
  run component tests
  test component specific functionalities
  test base functionalities
  [ENH] Remove attrs dependency (sktime#5296)
  [ENH] add proper `inverse_transform` to `STLTransformer` (sktime#5300)
  [DOC] add `blog` badge for `fkiraly`, for ODSC blog post (sktime#5291)
  [BUG] in `Imputer`, fix `y` not being passed in `method="forecaster"` (sktime#5287)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Continuous integration, unit testing & package distribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH] Replace Attrs with Dataclasses
2 participants