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

Imports missing from "nmigen.cli" compatibility wrapper: rtlil, verilog #670

cestrauss opened this issue Dec 22, 2021 · 2 comments


Copy link

$ python 
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from amaranth.cli import rtlil, verilog
>>> from nmigen.cli import rtlil
__main__:1: DeprecationWarning: instead of nmigen, use amaranth
__main__:1: DeprecationWarning: instead of nmigen.cli, use amaranth.cli
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'rtlil' from 'nmigen.cli' (/home/cstrauss/src/nmigen/nmigen/
>>> from nmigen.cli import verilog
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'verilog' from 'nmigen.cli' (/home/cstrauss/src/nmigen/nmigen/

Amaranth version: commit b1f5664 (main)

Copy link

whitequark commented Dec 22, 2021

So these are just nmigen.back.verilog/nmigen.back.rtlil; they were never intentionally exported from nmgien.cli, and so aren't present in the wrapper.

There are probably hundreds of other names like that. I consider this a substantial weakness of the Python import system; the module interface and the module implementation are conflated, which makes it quite hard to maintain backwards compatibility as people end up depending on unintentionally exported names.

Copy link

Got it, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

No branches or pull requests

2 participants