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

refactor: derive the _schema automatically #941

Merged
merged 5 commits into from
Dec 18, 2024

Conversation

project-defiant
Copy link
Contributor

@project-defiant project-defiant commented Dec 3, 2024

✨ Context

The aim of this PR is to allow for skipping the _schema parameter when creating a new Dataset derived class instance.

🛠 What does this PR implement

Make the _schema field optional in the Dataset abstract class.

The new behavior is following:

  1. When no _schema is passed to the Dataset derived class, the schema is derived from the static assets for this particular dataset.
  2. When _schema is passed, it is used instead as a dataframe schema.

🙈 Missing

🚦 Before submitting

  • Do these changes cover one single feature (one change at a time)?
  • Did you read the contributor guideline?
  • Did you make sure to update the documentation with your changes?
  • Did you make sure there is no commented out code in this PR?
  • Did you follow conventional commits standards in PR title and commit messages?
  • Did you make sure the branch is up-to-date with the dev branch?
  • Did you write any new necessary tests?
  • Did you make sure the changes pass local tests (make test)?
  • Did you make sure the changes pass pre-commit rules (e.g poetry run pre-commit run --all-files)?

@d0choa
Copy link
Collaborator

d0choa commented Dec 10, 2024

You might want look at this for inspiration. I remember I discussed with @DSuveges and we thought it was a good idea, but we didn't want to refactor too much at that point:
dev...do_experiment_dataset

@github-actions github-actions bot added size-S and removed size-XS labels Dec 17, 2024
@project-defiant project-defiant requested review from d0choa and DSuveges and removed request for d0choa December 17, 2024 12:23
@project-defiant project-defiant marked this pull request as ready for review December 17, 2024 12:42
Copy link
Contributor

@DSuveges DSuveges left a comment

Choose a reason for hiding this comment

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

Very good! I like the solution that remains compatible with the existing solution.

src/gentropy/dataset/dataset.py Show resolved Hide resolved
src/gentropy/dataset/dataset.py Show resolved Hide resolved
tests/gentropy/dataset/test_dataset.py Outdated Show resolved Hide resolved
@project-defiant project-defiant merged commit cb64cc5 into dev Dec 18, 2024
5 checks passed
@DSuveges DSuveges deleted the szsz-derive-schema-automatically branch December 18, 2024 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants