Skip to content

Change the directory structure to support the pypi packaging.#18

Merged
iamvamsikrishnad merged 5 commits intomasterfrom
pypi
Feb 25, 2020
Merged

Change the directory structure to support the pypi packaging.#18
iamvamsikrishnad merged 5 commits intomasterfrom
pypi

Conversation

@iamvamsikrishnad
Copy link
Contributor

No description provided.

Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

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

I've opened PR #19 to update Make and Docker commands for this change - please take a look.

Has the test pypi package been reconstructed using this version of the code? I'll retry the tests once that's complete. Thanks!

@95-martin-orion
Copy link
Collaborator

One additional note - after installing via the pypi package, I had issues with the following script:

import qsimcirq
test = qsimcirq.qsim_simulator.QSimSimulator()
# fails with "qsimcirq has no attribute 'qsim_simulator'"

Oddly, importing the submodule with from qsimcirq worked just fine:

from qsimcirq import qsim_simulator as qss
test = qss.QSimSimulator()
# no error

@iamvamsikrishnad
Copy link
Contributor Author

I've opened PR #19 to update Make and Docker commands for this change - please take a look.

Has the test pypi package been reconstructed using this version of the code? I'll retry the tests once that's complete. Thanks!

Yes, the test pypi lastest build is based on these chagnes.

@iamvamsikrishnad
Copy link
Contributor Author

One additional note - after installing via the pypi package, I had issues with the following script:

import qsimcirq
test = qsimcirq.qsim_simulator.QSimSimulator()
# fails with "qsimcirq has no attribute 'qsim_simulator'"

Oddly, importing the submodule with from qsimcirq worked just fine:

from qsimcirq import qsim_simulator as qss
test = qss.QSimSimulator()
# no error

You are correct. Some googling didn't lead me anywhere. The installed package would have both the .so file and .py files in side qsimcirq directory. Do you have any thoughts ?

Update make and docker for pypi
@95-martin-orion
Copy link
Collaborator

You are correct. Some googling didn't lead me anywhere. The installed package would have both the .so file and .py files in side qsimcirq directory. Do you have any thoughts ?

This SO question recommends e.g., putting import qsim_simulator in an __init__.py file in the qsim_cirq directory. The same solution should work for .so and .py files.

Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

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

The examples behave as expected with the pypi package. Once the from qsimcirq import ... issue is resolved, this PR will be ready to merge.

@95-martin-orion
Copy link
Collaborator

@iamvamsikrishnad: It seems like the package on test.pypi needs to be updated - when running qsimcirq_test.py from a Docker image, I'm seeing the following error:

qsim-install      | ______________________ ERROR collecting qsimcirq_test.py _______________________
qsim-install      | ImportError while importing test module '/qsim/interfaces/tests/qsimcirq_test.py'.
qsim-install      | Hint: make sure your test modules/packages have valid Python names.
qsim-install      | Traceback:
qsim-install      | qsimcirq_test.py:18: in <module>
qsim-install      |     import qsimcirq.qsim_simulator as qsimSimulator
qsim-install      | /usr/local/lib/python3.7/dist-packages/qsimcirq/qsim_simulator.py:19: in <module>
qsim-install      |     import qsim
qsim-install      | E   ModuleNotFoundError: No module named 'qsim'

(note that import qsim has been replaced with from qsimcirq import qsim in the current version of qsim_simulator.py)

The Dockerfile in question can be seen in PR #20. The tests in that PR pass when the package is built from HEAD.

@iamvamsikrishnad
Copy link
Contributor Author

@iamvamsikrishnad: It seems like the package on test.pypi needs to be updated - when running qsimcirq_test.py from a Docker image, I'm seeing the following error:

qsim-install      | ______________________ ERROR collecting qsimcirq_test.py _______________________
qsim-install      | ImportError while importing test module '/qsim/interfaces/tests/qsimcirq_test.py'.
qsim-install      | Hint: make sure your test modules/packages have valid Python names.
qsim-install      | Traceback:
qsim-install      | qsimcirq_test.py:18: in <module>
qsim-install      |     import qsimcirq.qsim_simulator as qsimSimulator
qsim-install      | /usr/local/lib/python3.7/dist-packages/qsimcirq/qsim_simulator.py:19: in <module>
qsim-install      |     import qsim
qsim-install      | E   ModuleNotFoundError: No module named 'qsim'

(note that import qsim has been replaced with from qsimcirq import qsim in the current version of qsim_simulator.py)

The Dockerfile in question can be seen in PR #20. The tests in that PR pass when the package is built from HEAD.

I added a new bug to track this.

@iamvamsikrishnad
Copy link
Contributor Author

The examples behave as expected with the pypi package. Once the from qsimcirq import ... issue is resolved, this PR will be ready to merge.

I created a issue for this and assigned to myself.

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