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

[CLEANUP] Remove deprecated field 'group' and deprecated import 'from sdk' #132

Merged
merged 5 commits into from
Sep 3, 2024

Conversation

Mildophin
Copy link
Collaborator

@Mildophin Mildophin commented Aug 2, 2024

Description

Simple cleanup PR that removed the deprecated field 'group', making compulsory the use of 'project' instead.

Also it removes the old way of importing this sdk with 'from sdk', it's been deprecated for more than year now and it is removed in this PR. We have to use 'from pasqal_cloud' from now.

Checklist

  • The title of the PR follows the right format: [{Label}] {Short Message}. Label examples: IMPROVEMENT, FIX, REFACTORING... Short message is about what your PR changes.

Versioning (PASQAL developers only)

  • Update the version of pasqal-cloud in _version.py following the changes in your PR and by using semantic versioning.

Documentation

  • Update CHANGELOG.md with a description explaining briefly the changes to the users.

Tests

  • Unit tests have been added or adjusted.
  • Tests were run locally.

Internal tests pipeline (PASQAL developers only)

  • Update and run the internal tests while targeting the branch of this PR.
    If your PR hasn't changed any functionality, it still needs to be validated against internal tests.

After updating the version (PASQAL developers only)

  • Open a PR on the internal tests that updates the version used for the pasqal-cloud backward compatibility tests.

@Mildophin Mildophin self-assigned this Aug 2, 2024
@Mildophin Mildophin changed the title [CLEANUP] Remove deprecated field 'group' and use 'project' instead [CLEANUP] Remove deprecated field 'group' Aug 2, 2024
Copy link
Collaborator

@Augustinio Augustinio left a comment

Choose a reason for hiding this comment

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

LGTM

@Mildophin Mildophin changed the title [CLEANUP] Remove deprecated field 'group' [CLEANUP] Remove deprecated field 'group' and deprecated import 'from sdk' Aug 6, 2024
Comment on lines 60 to 69
def __init__(
self,
project_id: str,
username: Optional[str] = None,
password: Optional[str] = None,
token_provider: Optional[TokenProvider] = None,
endpoints: Optional[Endpoints] = None,
auth0: Optional[Auth0Conf] = None,
webhook: Optional[str] = None,
Copy link
Member

Choose a reason for hiding this comment

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

mention this in the changelog since a common way before of instantiating the sdk would have been

sdk = SDK("awennersteen", "super-secret", project_id="my-project_id")

And this won't work anymore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, bad python practices do not help haha, I will update the changelog for this potential breaking change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I understand why you decided to move the project_id to the first argument

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

-> non-default parameter follows default parameter

Python things if I correctly understood how it works

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's probably not worth the risk of breaking scripts of user to make it non-optional

Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is going to cause significant breaks, we could accommodate by still defaulting to None and keep on raising an exception in the scenario it's missing.

We have optional input for several fields that are very obviously not optional fields. Can't authenticate without a password.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Then I will put it back as optional and add a warning if not given. Thx for the feedback.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You should raise an exception not only a warning!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I meant, an exception for sure, but also a warning saying that project_id will be the first argument later, like a deprecation warning.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd avoid the warning, we should avoid preemptive statements because nothings designed or planned.

What if we simply change our mind on something?

CHANGELOG.md Outdated
### Breaking change

- 'from pasqal_cloud' import has completely replaced the deprecated import 'from sdk'
- 'project' field has completely replaced the deprecated field 'group'
Copy link
Collaborator

Choose a reason for hiding this comment

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

field is project_id and this MR is simply removing group_id, We introduced project_id a while ago

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should I write "'group' field is now removed, use 'project' field instead" ? Not sure how to make the message clear when we read the sentence.

CHANGELOG.md Outdated

- 'from pasqal_cloud' import has completely replaced the deprecated import 'from sdk'
- 'project' field has completely replaced the deprecated field 'group'
- Now you need to declare the 'project_id' as the first argument when instantiating an SDK class
Copy link
Collaborator

Choose a reason for hiding this comment

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

outdated

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good spot

Copy link
Collaborator

@MatthieuMoreau0 MatthieuMoreau0 left a comment

Choose a reason for hiding this comment

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

No additional comments

@Mildophin Mildophin merged commit 1ee3c87 into dev Sep 3, 2024
5 checks passed
@Mildophin Mildophin deleted the mv/remove-group branch September 3, 2024 15:27
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.

6 participants