Skip to content

Conversation

@jlapeyre
Copy link
Contributor

For example, with
pip install .
or
pip install -e .

For example, with
pip install .
or
pip install -e .
@NnktYoshioka NnktYoshioka merged commit d1fe881 into quantum-programming:main Aug 13, 2025
@HirokiHamaguchi
Copy link
Member

@jlapeyre

Hello, I am Hiroki Hamaguchi, one of the maintainers of the pygridsynth project.
Thank you very much for your kind pull requests and issues — they help us a lot.

Regarding this PR, may I ask you a question?
I noticed that you added

from .__main__ import main

in init.py, but when I run python3 -m pygridsynth 1.00 0.01, it caused a warning saying:

<frozen runpy>:128: RuntimeWarning: 'pygridsynth.__main__' found in sys.modules after import of package 'pygridsynth', but prior to execution of 'pygridsynth.__main__'; this may result in unpredictable behaviour

I think this approach may not be the best, and I would like to improve it.
However, I am not entirely sure what feature you intended to add, which makes it difficult for me to proceed. Could you clarify your intention?

We plan to release a new PyPI version in a few days, so I would like to address this issue before the next deployment.

Thank you very much for your time and consideration.

@jlapeyre
Copy link
Contributor Author

@HirokiHamaguchi

Thank you for pointing this out.
The current commit on main (404389b)

Allows

python -m pygridsynth ...

But the script now fails

pygridsynth ...

with

  File "/home/joeuser/github/quantum-programming/pygridsynth/.venvs/py313/bin/pygridsynth", line 3, in <module>
    from pygridsynth import main
ImportError: cannot import name 'main' from 'pygridsynth' (/home/joeuser/github/quantum-programming/pygridsynth/pygridsynth/__init__.py)

I have opened a PR #10 which allows both methods of running the program without errors or warnings.

@jlapeyre
Copy link
Contributor Author

Ah.. And to clarify the intention. The desired feature is to be able to run pygridsynth like this:

pygridsynth ...

Rather than this

python -m pygridsynth ...

Hower, my first PR, which was merged, broke the second method. The new PR #10, should support both of them.

@HirokiHamaguchi
Copy link
Member

Thank you very much for your prompt response and also for creating a new pull request. We truly appreciate your efforts.
I fully understand your intentions as well. After reviewing the pull request on our side, we plan to proceed with merging it.

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.

3 participants