Skip to content

Conversation

@rajibchakravorty
Copy link
Contributor

Major changes

  • QCtrlObject removed from package
  • repr is carried out by method create_repr_from_attributes(..) in base.utils module
  • __all__ introduced in package and sub-package
  • public methods for creating specific DDS and Driven Control are changed to private methods; only new_predefined_dds or new_predefined_driven_control are public
  • qiskit package method renamed to covert_dd_to_qiskit_quantum_circuit

'name': self.name
}

class_name = '{0.__class__.__name__!s}'.format(self)
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than requiring each class do this manually, could we change create_repr_from_attributes to take the object itself and do this formatting internally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like that too; in that case we can also supply a list of attributes instead of dicts; we then collect both the name and the attribute values from the object (and using the list)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated for review

new_corpse_in_scrofulous_control)
from .predefined import new_predefined_driven_control

__all__ = ['UPPER_BOUND_RABI_RATE', 'UPPER_BOUND_DETUNING_RATE',
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO it'd be best to have one item per line, in alphabetical order. Makes scanning the code a little easier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated; Made the list with one liberty [ALL CONSTANTS, AllClasses, all_methods] within each, alphabetical order in maintained.

new_corpse_in_scrofulous_control)
from .predefined import new_predefined_driven_control

__all__ = ['UPPER_BOUND_RABI_RATE', 'UPPER_BOUND_DETUNING_RATE',
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't remember what we decided for all in subpackages -- did we decide it was necessary, or just that the API of qctrlopencontrols is just the contents of the top-level all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I cannot remember either; However, though it might be useful to declare all for sub-packages; Can decide otherwise too;

from .cirq import (convert_dds_to_cirq_circuit,
convert_dds_to_cirq_schedule)
from . import dynamic_decoupling_sequences
from .dynamic_decoupling_sequences import *
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this -- it means the user has to look into the sub-packages to see the API. Although I suppose they have to do that anyway, to look at the method documentation...

How verbose will it be if we list out all the imports explicitly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is related to the other 2 comments [above and below this one]; if we decide all goes only in the top level, this should take care of this problem; Otherwise, I was following numpy case e.g. https://github.com/numpy/numpy/blob/master/numpy/__init__.py; again happy to go with either decision.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, happy to be consistent with numpy. If we find it awkward going forwards we can always change it.

from . import cirq
from .cirq import *

__all__ = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, this would be more explicit if we could just list out all the appropriate methods/constants/classes.

rajibchakravorty pushed a commit that referenced this pull request Jun 12, 2019
# This is the 1st commit message:

starting pyquil support

# This is the commit message #1:

pyquil support added

# This is the commit message #2:

first version of pyquil notebook added

# This is the commit message #3:

pyquil dependency added to setup

# This is the commit message #4:

trying gcc install for pyquil

# This is the commit message #5:

replacing gcc install with build-essential

# This is the commit message #6:

forcing yes to install anything

# This is the commit message #7:

ignoring blocks in pyquil notebook for tests

# This is the commit message #8:

linted; unnecessary import removed from notebook

# This is the commit message #9:

removed all references of circuits and replaced those with programs; pyquil removed from method names

# This is the commit message #10:

notebook rerun after changes

# This is the commit message #11:

pyquil program conversion removes unnecessary method
rajibchakravorty pushed a commit that referenced this pull request Jun 12, 2019
# This is the 1st commit message:

starting pyquil support

# This is the commit message #1:

pyquil support added

# This is the commit message #2:

first version of pyquil notebook added

# This is the commit message #3:

pyquil dependency added to setup

# This is the commit message #4:

trying gcc install for pyquil

# This is the commit message #5:

replacing gcc install with build-essential

# This is the commit message #6:

forcing yes to install anything

# This is the commit message #7:

ignoring blocks in pyquil notebook for tests

# This is the commit message #8:

linted; unnecessary import removed from notebook

# This is the commit message #9:

removed all references of circuits and replaced those with programs; pyquil removed from method names

# This is the commit message #10:

notebook rerun after changes

# This is the commit message #11:

pyquil program conversion removes unnecessary method

# This is the commit message #12:

Public methods are bundled as __all__; changed ported over to notebooks; base object removed; repr method created

# This is the commit message #13:

additional error handling for new repr method

# This is the commit message #14:

repr method updated with class instance as input
@michaelhush michaelhush changed the title Improvement Defining the public API Jun 12, 2019
@rajibchakravorty
Copy link
Contributor Author

  1. Made the public API (methods and classes) explicit in top-level init
  2. Constants in sub-packages are transferred to sub-packages' own init

@charmasaur
Copy link
Contributor

charmasaur commented Jun 13, 2019

Nice, looks good. The explicit relative paths used internally feel good to me -- nice and clear, and also mean that "qctrlopencontrols.foo" should only appear when foo is part of the public API, and that's true both inside and outside the package.

@michaelhush michaelhush merged commit 36d17d8 into master Jun 14, 2019
@michaelhush michaelhush deleted the tech-improvement branch June 14, 2019 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants