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 pygsti.baseobjs #105

Merged
merged 29 commits into from
Dec 17, 2019
Merged

Refactor pygsti.baseobjs #105

merged 29 commits into from
Dec 17, 2019

Conversation

robpkelly
Copy link
Contributor

Since we're dropping Python 2.7 support with #90, it's easier to avoid circular imports, meaning we can refactor the names under the baseobjs package to other existing packages that make more sense.

  • Refactored under objects:
    • baseobjs.smartcache
    • baseobjs.verbosityprinter
    • baseobjs.profiler
    • baseobjs.basis
    • baseobjs.protectedarray
    • baseobjs.label
    • baseobjs.objectivefns
  • Refactored under tools:
    • baseobjs.opttools
    • baseobjs.basisconstructors
  • Refactored under io:
    • baseobjs.circuitparser
    • baseobjs.fastcircuitparser
  • Removed:
    • baseobjs.parameterized
    • baseobjs.deprecated_dim
    • baseobjs.exceptions

Since names under baseobjs were deliberately exposed in other modules, this should not constitute a major API change. One possible exception is that basistools no longer exposes the basisconstructors namespace via wildcard import. If this actually is a non-trivial API change, I'd want to either re-expose those names with a deprecation warning, or simply merge basisconstructors into basistools entirely (I'm a little confused on the semantics of separating them in the first place)

Additionally cleaned up some import indirection. A few small useful
constants (sqrt2, id2x2, sigmax/y/z) defined in
`tools.basisconstructors` are referenced elsewhere. `basis_matrices`,
`basis_longname`, and `basis_element_labels` have been refactored from
`objects.basis` to `tools.basistools`. `tools.basistools` does not
wildcard-import from `tools.basisconstructors`; if this is a more
significant API change than I anticipate (i.e. if anyone might
notice), please add deprecation warnings where appropriate.
We now have `tools.opttools` in addition to `tools.optools`. Should
consider an API change to one of these for usability's sake.
@enielse
Copy link
Collaborator

enielse commented Dec 16, 2019

Let's restore the exceptions module into the tools or objects sub-package. The exceptions are objects, but they're not primary ingredients in pyGSTi and are used more like utility functions, so I think I lean toward putting them in tools. Unless Rob strongly disagrees, let's do that.

@enielse enielse merged commit a3ebe63 into develop Dec 17, 2019
@enielse enielse deleted the refactor-baseobjs branch December 17, 2019 14:18
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.

2 participants