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

Update cirq_rigetti to conform to the new mypy standard #6661

Open
NoureldinYosri opened this issue Jul 9, 2024 · 0 comments
Open

Update cirq_rigetti to conform to the new mypy standard #6661

NoureldinYosri opened this issue Jul 9, 2024 · 0 comments
Assignees
Labels
kind/health For CI/testing/release process/refactoring/technical debt items triage/accepted there is consensus amongst maintainers that this is a real bug or a reasonable feature to add

Comments

@NoureldinYosri
Copy link
Collaborator

NoureldinYosri commented Jul 9, 2024

Description of the issue
recently mypy released a new version which broke the CI for cirq_regetti ... as a temperary solution we turned off type checks for cirq_regetti #6662

the CI failure is

cirq-rigetti/cirq_rigetti/quil_input.py:18: error: Cannot find implementation or library stub for module named "pyquil.parser"  [import]
cirq-rigetti/cirq_rigetti/quil_input.py:18: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
cirq-rigetti/cirq_rigetti/quil_input.py:258: error: Item "int" of "Union[Qubit, QubitPlaceholder, FormalArgument, int]" has no attribute "index"  [union-attr]
cirq-rigetti/cirq_rigetti/quil_input.py:269: error: Item "int" of "Union[Qubit, QubitPlaceholder, FormalArgument, int]" has no attribute "index"  [union-attr]
cirq-rigetti/cirq_rigetti/conftest.py:44: error: Missing return statement  [empty-body]
cirq-rigetti/cirq_rigetti/conftest.py:44: note: If the method is meant to be abstract, use @abc.abstractmethod
cirq-rigetti/cirq_rigetti/conftest.py:44: error: Signature of "execute" incompatible with supertype "QAM"  [override]
cirq-rigetti/cirq_rigetti/conftest.py:44: note:      Superclass:
cirq-rigetti/cirq_rigetti/conftest.py:44: note:          def execute(self, executable: Union[EncryptedProgram, Program], memory_map: Optional[Mapping[str, Union[Sequence[int], Sequence[float]]]] = ..., **kwargs: Any) -> Any
cirq-rigetti/cirq_rigetti/conftest.py:44: note:      Subclass:
cirq-rigetti/cirq_rigetti/conftest.py:44: note:          def execute(self, executable: Union[EncryptedProgram, Program]) -> T
cirq-rigetti/cirq_rigetti/conftest.py:47: error: Signature of "run" incompatible with supertype "QAM"  [override]
cirq-rigetti/cirq_rigetti/conftest.py:47: note:      Superclass:
cirq-rigetti/cirq_rigetti/conftest.py:47: note:          def run(self, executable: Union[EncryptedProgram, Program], memory_map: Optional[Mapping[str, Union[Sequence[int], Sequence[float]]]] = ..., **kwargs: Any) -> QAMExecutionResult
cirq-rigetti/cirq_rigetti/conftest.py:47: note:      Subclass:
cirq-rigetti/cirq_rigetti/conftest.py:47: note:          def run(self, program: Union[EncryptedProgram, Program]) -> QAMExecutionResult
cirq-rigetti/cirq_rigetti/conftest.py:58: error: Signature of "native_quil_to_executable" incompatible with supertype "AbstractCompiler"  [override]
cirq-rigetti/cirq_rigetti/conftest.py:58: note:      Superclass:
cirq-rigetti/cirq_rigetti/conftest.py:58: note:          def native_quil_to_executable(self, nq_program: Program, **kwargs: Any) -> Union[EncryptedProgram, Program]
cirq-rigetti/cirq_rigetti/conftest.py:58: note:      Subclass:
cirq-rigetti/cirq_rigetti/conftest.py:58: note:          def native_quil_to_executable(self, nq_program: Program) -> Union[EncryptedProgram, Program]
cirq-rigetti/cirq_rigetti/conftest.py:64: error: Cannot instantiate abstract class "MockQAM" with abstract attribute "execute_with_memory_map_batch"  [abstract]
cirq-rigetti/cirq_rigetti/conftest.py:82: error: Cannot instantiate abstract class "MockCompiler" with abstract attribute "reset"  [abstract]
cirq-rigetti/cirq_rigetti/aspen_device.py:74: error: Argument "isa" to "QCSQuantumProcessor" has incompatible type "qcs_api_client.models.instruction_set_architecture.InstructionSetArchitecture"; expected "qcs_sdk.qpu.isa.InstructionSetArchitecture"  [arg-type]
cirq-rigetti/cirq_rigetti/circuit_sweep_executors.py:65: error: Item "EncryptedProgram" of "Union[EncryptedProgram, Program]" has no attribute "write_memory"  [union-attr]
cirq-rigetti/cirq_rigetti/circuit_sweep_executors.py:65: error: Item "Program" of "Union[EncryptedProgram, Program]" has no attribute "write_memory"  [union-attr]
cirq-rigetti/cirq_rigetti/circuit_sweep_executors.py:125: error: "Program" has no attribute "_instructions"; maybe "instructions", "_add_instruction", or "filter_instructions"?  [attr-defined]
cirq-rigetti/cirq_rigetti/circuit_sweep_executors.py:126: error: "Program" has no attribute "_synthesized_instructions"  [attr-defined]
Found 14 errors in 4 files (checked 1163 source files)
@NoureldinYosri NoureldinYosri added the kind/health For CI/testing/release process/refactoring/technical debt items label Jul 9, 2024
@NoureldinYosri NoureldinYosri changed the title Update cirq_regetti to conform to the new mypy standard Update cirq_rigetti to conform to the new mypy standard Jul 9, 2024
NoureldinYosri added a commit that referenced this issue Jul 10, 2024
this changes updates code to conform to the new mypy standard. 

Note that cirq-rigetti needs a lot of work so I temporarily turned off mypy checks for it and filed #6661 to track that work.
@dstrain115 dstrain115 added the triage/accepted there is consensus amongst maintainers that this is a real bug or a reasonable feature to add label Jul 24, 2024
pavoljuhas added a commit to pavoljuhas/Cirq that referenced this issue Jul 31, 2024
pavoljuhas added a commit that referenced this issue Jul 31, 2024
setup.py files define distributions of cirq and cirq subpackages.
There is no much value to enforce type annotations in their code.

Also clean up ineffective exclusion pattern for cirq-rigetti (related to #6661).

Fixes #6687
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/health For CI/testing/release process/refactoring/technical debt items triage/accepted there is consensus amongst maintainers that this is a real bug or a reasonable feature to add
Projects
None yet
Development

No branches or pull requests

5 participants