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

Group "utility" operations into same file. #2962

Closed
albi3ro opened this issue Aug 16, 2022 · 9 comments
Closed

Group "utility" operations into same file. #2962

albi3ro opened this issue Aug 16, 2022 · 9 comments
Assignees
Labels
code quality 🎓 Discussion and improvements to code quality good first issue Good for newcomers

Comments

@albi3ro
Copy link
Contributor

albi3ro commented Aug 16, 2022

Right now, Barrier and WireCut are located in pennylane/ops/qubit/non_parametric_ops.py, even though they are not unique to qubit ops. Snapshot is located in its own file in pennylane/ops/snapshot.py.

I propose grouping all three ops:

  • Barrier
  • WireCut
  • Snapshot

into a new file pennylane/ops/utility_ops.py. The tests should then be moved as well.

I am open to a different name than "utility". Whatever term bests describes "things we mostly treat as operations but aren't really."

Update: Let's place these in pennylane/ops/meta.py.

@albi3ro albi3ro added good first issue Good for newcomers code quality 🎓 Discussion and improvements to code quality labels Aug 16, 2022
@josh146
Copy link
Member

josh146 commented Aug 16, 2022

Maybe a module name that indicates that these are 'meta' operations? That is, they use the Operation abstraction but aren't actually operations in the theoretical sense

@albi3ro albi3ro added the Hacktoberfest Participating in Hacktoberfest event label Sep 20, 2022
@tgag17
Copy link
Contributor

tgag17 commented Oct 16, 2022

Hi! Can I work on this issue?

@albi3ro
Copy link
Contributor Author

albi3ro commented Oct 17, 2022

Hi @tgag17 ,
Go ahead! I've tagged you on the issue.

@tgag17
Copy link
Contributor

tgag17 commented Oct 17, 2022

Thanks @albi3ro!

@trbromley trbromley removed the Hacktoberfest Participating in Hacktoberfest event label Sep 29, 2023
@AnuravModak
Copy link
Contributor

AnuravModak commented Nov 1, 2023

Heyy, is this issue still available? Please let me know!! As the related/attached PR is closed due to inactivity

@albi3ro
Copy link
Contributor Author

albi3ro commented Nov 1, 2023

This issue is still good to go. Feel free to take this on @AnuravModak !

@AnuravModak
Copy link
Contributor

AnuravModak commented Nov 3, 2023

Hello @albi3ro, I've begun working on this issue, and I have a few questions. But before that, let me update you on my progress. I've relocated the Barrier and WireCut operations from pennylane/ops/qubit/non_parametric_ops.py, moved the Snapshot operation from pennylane/ops/snapshot.py, and deleted the snapshot.py file. Additionally, I've updated the import statements in pennylane/ops/qubit/__init__.py.

Now, I'd like to know your plan regarding the movement of the corresponding test code. Should I transfer the test code from tests/ops/qubit/test_non_parametric_ops.py to meta.py , or do you have a different directory or file in mind where I should relocate these test codes?

Also kindly provide the command to reformat the files according to black formatting style or any other mandatory formatting styles so that there is no issue with formatting.

@albi3ro
Copy link
Contributor Author

albi3ro commented Nov 3, 2023

Thanks for reaching out @AnuravModak :)

Moving tests from tests/ops/qubit/test_non_parametric_opy.py and tests/ops/test_snapshot.py to a new file tests/ops/test_meta.py would be recommended.

Formatting with black can be done with:

black -l 100 pennylane
black -l 100 tests

and pylint can be run with

pylint relevant_file.py

These commands can also be found in our page on Submitting a pull request

albi3ro added a commit that referenced this issue Nov 7, 2023
Towards  #2962 .

So, this is the draft for this issue.

Changes made:
grouping all three ops:

- Barrier
- WireCut
- Snapshot

into a new file  `pennylane/ops/meta.py`.

Also, moved tests from `tests/ops/qubit/test_non_parametric_opy.py` and
`tests/ops/test_snapshot.py` to a new file `tests/ops/test_meta.py`.

Please let me know if i need to do anything else.

---------

Signed-off-by: Anurav Modak <anurav.modak@oracle.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>
@albi3ro albi3ro closed this as completed Nov 7, 2023
@albi3ro
Copy link
Contributor Author

albi3ro commented Nov 7, 2023

Closed by #4789

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality 🎓 Discussion and improvements to code quality good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants