bavovanachte / sphinx-wavedrom

A sphinx extension that allows including wavedrom diagrams by using its text-based representation
MIT License
34 stars 18 forks source link

Render from file and generate images if needed #8

Closed wallento closed 5 years ago

wallento commented 5 years ago

Hi,

This adds the feature to read the json code from a file (fixes #7), and it also adds the capability to generate files instead of inline javascript (fixes #6). It has one minor caveat, that latexpdf image rendering only works with Python 3. See the respective commit for the reasoning.

I also did some travis housekeeping and setuptools housekeeping. Most importantly, the versioning is not done implicitly via tags in git. So, I propose to tag after this merge as 2.0 and publish that via twine (the legacy way of automatically deploying via travis seems broken).

I hope you like it!

Cheers, Stefan

wallento commented 5 years ago

Also see: https://travis-ci.org/wallento/sphinx-wavedrom/builds/457923593

bavovanachte commented 5 years ago

Thanks a lot for the help! Looks good at first sight. I'll try it out in the coming days.

wallento commented 5 years ago

You are welcome, thanks for running this extension!

I forgot to mention, that the python json parser is much more strict, see: https://github.com/BreizhGeek/wavedrompy#important-notice

oharboe commented 5 years ago

I've tried it locally. Some obervations:

  1. "python3 setup.py install" => did not work. I had to copy "sphinxcontrib" built by "setup.py build" into my document project folder or Sphinx would not find "sphinxcontrib.wavedrom"
  2. Using the example on the sphinx-wavdrom project page, I got an error:

` Sphinx error: Cannot render the following json code: { signal: [ { name: "clk", wave: "P......" }, { name: "bus", wave: "x.==.=x", data: ["head", "body", "tail", "data"] }, { name: "wire", wave: "0.1..0." } ]}

Error: Expecting property name enclosed in double quotes: line 1 column 3 (char 2) `

If I add the missing quotes, it works and I see the wavetrace in my pdf:

` .. wavedrom::

    { "signal": [
            { "name": "clk",  "wave": "P......" },
            { "name": "bus",  "wave": "x.==.=x", "data": ["head", "body", "tail", "data"] },
            { "name": "wire", "wave": "0.1..0." }
    ]}

`

wallento commented 5 years ago

Hi,

thanks for your feedback.

About 2: This will be updated with the merge and deploy. You can see it in the README.rst.

About 1: What does not work in particular? Here are the steps I tried now and it works like a charm:

python3 -mvenv venv
source venv/bin/activate
python setup.py install
cd example/
pip install sphinx_rtd_theme
make clean html

Thanks again for your help.

oharboe commented 5 years ago

About 1: To try to install it, I ran "sudo python3 setup.py install" from within the source folder I cloned & checked out the pull request in. About 2: If the syntax has changed for the "..wavedrom" section in rst, that's a change in the interface to sphinxcontrib.wavedrom Python module. Doesn't this, strictly speaking, require that the name of the module changes? E.g. from sphinxcontrib.wavedrom to sphinxcontrib.wavedrom2 so as not to break the interface?

wallento commented 5 years ago

Hi,

no, the syntax only needs to be changed if you want to use the new modes (render to image). The patch is fully backwards compatible, existing code is not broken.

Can you please provide a more detailed error description including logs? Thanks.

Best, Stefan

oharboe commented 5 years ago

I wanted to give you a quick feedback while I'm on the road, so this is from memory. Let me know if you need more details and I can run the test again when I'm back in the office Monday.

Good to hear about the compatibility. Though I don't understand how it's backwards compatible, because I added sphinxcontrib.wavedrom and copied and pasted the example from the webpage of and that's how I got the error message. Where's the switch/option to "render to image", I didn't run into it.

There was no error message when I installed, but when I tried to run:

python3 import sphinxcontrib.wavedrom => the module didn't exist.

wallento commented 5 years ago

Thanks, I will try to understand the issues. For the installation, can you please verify on Monday that it worked before and is broken by the patch? The syntax issue should not exist, I will look into it.

wallento commented 5 years ago

@oharboe I found the issue about the "compatibility". It processed okay, but the javascript was missing and thus it didn't render it on the html page. Unfortunately hard to test in Travis I assume. Thanks for reporting.

(Some weird github/travis hickups made me force pushing repeatedly..)

bavovanachte commented 5 years ago

@wallento do you know by any chance which version of the official wavedrom releases this wavedrompy corresponds to? I'm asking to see if we should update the embedded js files for the browser-rendered mode.

wallento commented 5 years ago

I think it is 1.6.2, because wavedrom did not get another update after that until recently. But good idea to keep them in sync. I will have a look how to best handle that at wavedrompy.

bavovanachte commented 5 years ago

Getting the following warning so far when building with make clean html:

Warning, treated as error:
/home/bvn/Projects/git/wallento/example/source/index.rst:258:Exception occured in ifconfig expression: 
NameError: name 'wavedrom_html_jsinline' is not defined

I'll try to find out why. Don't know the ifconfig plugin very well

wallento commented 5 years ago

That's odd. The variable is defined here: https://github.com/bavovanachte/sphinx-wavedrom/pull/8/commits/d6067bef6a34b853e08149e82c552e0f55aa9076#diff-52e7ef85d543c383104195745362d290R268

Can you uncomment the line in conf.py and see if it changes anything? (https://github.com/bavovanachte/sphinx-wavedrom/pull/8/commits/d6067bef6a34b853e08149e82c552e0f55aa9076#diff-dd7cb9403f07a75b346761d97f6d1799R29)

bavovanachte commented 5 years ago

That's odd. The variable is defined here: d6067be#diff-52e7ef85d543c383104195745362d290R268

Can you uncomment the line in conf.py and see if it changes anything? (d6067be#diff-dd7cb9403f07a75b346761d97f6d1799R29)

My bad. Had conflict with existing installation. That seems to work now without any changes needed.

bavovanachte commented 5 years ago

Tested a couple of configurations in pdf and html. Looking good!

@oharboe Can you confirm the fixes made by @wallento work for you?

I added an issue in the wavedrompy repo wrt to the versioning: see https://github.com/BreizhGeek/wavedrompy/issues/4. I'll add an issue here as well to follow up.

@wallento since you've effectively written half of the code of the plugin now, I added you as a collaborator as well. Thanks again!

wallento commented 5 years ago

Great to hear, awesome! Yeah, I stopped using my global python installation for a while already, but regularly mess up the venv I am currently in :)

oharboe commented 5 years ago

Thanks, I will try to understand the issues. For the installation, can you please verify on Monday that it worked before and is broken by the patch? The syntax issue should not exist, I will look into it.

How do I install this pull request to test it?

I thought one way to do it was:


$ sudo python3 setup.py install
$ python3
# to test, I run the below
$ import sphinxcontrib.wavedrom
# silent success expected here
$
wallento commented 5 years ago

Yes, that is how it should work. I just performed the following steps successfully:

git clone https://github.com/wallento/sphinx-wavedrom
cd sphinx-wavedrom/
python3 -m venv venv
source venv/bin/activate
python3 setup.py install
python3 

Then:

Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sphinxcontrib.wavedrom
>>>
wallento commented 5 years ago

Can you run the same steps with venv?

oharboe commented 5 years ago

Yes, that is how it should work. I just performed the following steps successfully:

git clone https://github.com/wallento/sphinx-wavedrom
cd sphinx-wavedrom/
python3 -m venv venv
source venv/bin/activate
python3 setup.py install
python3 

Then:

Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sphinxcontrib.wavedrom
>>>

The above worked fine.

wallento commented 5 years ago

So there is something messed up with your environment. Can you please provide the logs when you run the about but without the venv and the extra sudo?

oharboe commented 5 years ago

I tried on a different machine (Ubuntu 18):

oyvind@davos:~$ git clone https://github.com/wallento/sphinx-wavedrom
Cloning into 'sphinx-wavedrom'...
remote: Enumerating objects: 49, done.
remote: Counting objects: 100% (49/49), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 209 (delta 19), reused 37 (delta 14), pack-reused 160
Receiving objects: 100% (209/209), 70.68 KiB | 769.00 KiB/s, done.
Resolving deltas: 100% (95/95), done.
oyvind@davos:~$ cd sphinx-wavedrom/
oyvind@davos:~/sphinx-wavedrom$ sudo python3 setup.py install
[sudo] password for oyvind: 
running install
running bdist_egg
running egg_info
creating sphinxcontrib_wavedrom.egg-info
writing sphinxcontrib_wavedrom.egg-info/PKG-INFO
writing dependency_links to sphinxcontrib_wavedrom.egg-info/dependency_links.txt
writing namespace_packages to sphinxcontrib_wavedrom.egg-info/namespace_packages.txt
writing requirements to sphinxcontrib_wavedrom.egg-info/requires.txt
writing top-level names to sphinxcontrib_wavedrom.egg-info/top_level.txt
writing manifest file 'sphinxcontrib_wavedrom.egg-info/SOURCES.txt'
writing manifest file 'sphinxcontrib_wavedrom.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/sphinxcontrib
copying sphinxcontrib/wavedrom.py -> build/lib/sphinxcontrib
copying sphinxcontrib/__init__.py -> build/lib/sphinxcontrib
copying sphinxcontrib/version.py -> build/lib/sphinxcontrib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/sphinxcontrib
copying build/lib/sphinxcontrib/wavedrom.py -> build/bdist.linux-x86_64/egg/sphinxcontrib
copying build/lib/sphinxcontrib/__init__.py -> build/bdist.linux-x86_64/egg/sphinxcontrib
copying build/lib/sphinxcontrib/version.py -> build/bdist.linux-x86_64/egg/sphinxcontrib
byte-compiling build/bdist.linux-x86_64/egg/sphinxcontrib/wavedrom.py to wavedrom.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/sphinxcontrib/__init__.py to __init__.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/sphinxcontrib/version.py to version.cpython-36.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying sphinxcontrib_wavedrom.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying sphinxcontrib_wavedrom.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying sphinxcontrib_wavedrom.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying sphinxcontrib_wavedrom.egg-info/namespace_packages.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying sphinxcontrib_wavedrom.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying sphinxcontrib_wavedrom.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying sphinxcontrib_wavedrom.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating dist
creating 'dist/sphinxcontrib_wavedrom-1.3.2.dev9+g1f8bd40-py3.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing sphinxcontrib_wavedrom-1.3.2.dev9+g1f8bd40-py3.6.egg
creating /usr/local/lib/python3.6/dist-packages/sphinxcontrib_wavedrom-1.3.2.dev9+g1f8bd40-py3.6.egg
Extracting sphinxcontrib_wavedrom-1.3.2.dev9+g1f8bd40-py3.6.egg to /usr/local/lib/python3.6/dist-packages
Adding sphinxcontrib-wavedrom 1.3.2.dev9+g1f8bd40 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/sphinxcontrib_wavedrom-1.3.2.dev9+g1f8bd40-py3.6.egg
Processing dependencies for sphinxcontrib-wavedrom==1.3.2.dev9+g1f8bd40
Searching for xcffib
Reading https://pypi.org/simple/xcffib/
Downloading https://files.pythonhosted.org/packages/e0/36/e35d6fc422486aa9aae679b7427d3a9d453d7646d43d534cdbfb48402797/xcffib-0.6.0.tar.gz#sha256=36142cb72535933e8e1ed39ff2c45559fa7038823bd6be6961ef8ee5bb0f6912
Best match: xcffib 0.6.0
Processing xcffib-0.6.0.tar.gz
Writing /tmp/easy_install-jpj8al4a/xcffib-0.6.0/setup.cfg
Running xcffib-0.6.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-jpj8al4a/xcffib-0.6.0/egg-dist-tmp-71u8xz44
warning: no previously-included files found matching 'setup.pyc'
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
zip_safe flag not set; analyzing archive contents...
pycparser.ply.__pycache__.lex.cpython-36: module references __file__
pycparser.ply.__pycache__.lex.cpython-36: module MAY be using inspect.getsourcefile
pycparser.ply.__pycache__.yacc.cpython-36: module references __file__
pycparser.ply.__pycache__.yacc.cpython-36: module MAY be using inspect.getsourcefile
pycparser.ply.__pycache__.yacc.cpython-36: module MAY be using inspect.stack
pycparser.ply.__pycache__.ygen.cpython-36: module references __file__

Installed /tmp/easy_install-jpj8al4a/xcffib-0.6.0/.eggs/pycparser-2.19-py3.6.egg
file xcffib/_ffi.py (for module xcffib._ffi) not found
warning: no previously-included files found matching 'xcffib/_ffi.py'
file xcffib/_ffi.py (for module xcffib._ffi) not found
file xcffib/_ffi.py (for module xcffib._ffi) not found
creating /usr/local/lib/python3.6/dist-packages/xcffib-0.6.0-py3.6.egg
Extracting xcffib-0.6.0-py3.6.egg to /usr/local/lib/python3.6/dist-packages
Adding xcffib 0.6.0 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/xcffib-0.6.0-py3.6.egg
Searching for cairosvg>=2
Reading https://pypi.org/simple/cairosvg/
Downloading https://files.pythonhosted.org/packages/5c/57/dadc80948bcb83ea9c0968ccfd5a1a25ace6be0884484526f70dad3c10b9/CairoSVG-2.2.1-py3-none-any.whl#sha256=f331e6024ee4c7f3eca3b0caa909dd893fa4d7414f50a6b206acbe2df20d95a9
Best match: CairoSVG 2.2.1
Processing CairoSVG-2.2.1-py3-none-any.whl
Installing CairoSVG-2.2.1-py3-none-any.whl to /usr/local/lib/python3.6/dist-packages
writing requirements to /usr/local/lib/python3.6/dist-packages/CairoSVG-2.2.1-py3.6.egg/EGG-INFO/requires.txt
Adding CairoSVG 2.2.1 to easy-install.pth file
Installing cairosvg script to /usr/local/bin

Installed /usr/local/lib/python3.6/dist-packages/CairoSVG-2.2.1-py3.6.egg
Searching for wavedrom>=0.1
Reading https://pypi.org/simple/wavedrom/
Downloading https://files.pythonhosted.org/packages/ad/57/7fc000ee7fd964b11c013aa39b16efa3d89dca422f96cb7244606ec4cdea/wavedrom-1.8.0rc3.tar.gz#sha256=16549c532c9265fd96b7b3bef733d91972f9fd4de89326536ab0cb035bc582ed
Best match: wavedrom 1.8.0rc3
Processing wavedrom-1.8.0rc3.tar.gz
Writing /tmp/easy_install-mdgjxtw2/wavedrom-1.8.0rc3/setup.cfg
Running wavedrom-1.8.0rc3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-mdgjxtw2/wavedrom-1.8.0rc3/egg-dist-tmp-x0ffn_6p
zip_safe flag not set; analyzing archive contents...
Moving wavedrom-1.8.0rc3-py3.6.egg to /usr/local/lib/python3.6/dist-packages
Adding wavedrom 1.8.0rc3 to easy-install.pth file
Installing wavedrompy script to /usr/local/bin

Installed /usr/local/lib/python3.6/dist-packages/wavedrom-1.8.0rc3-py3.6.egg
Searching for Sphinx>=1.8
Reading https://pypi.org/simple/Sphinx/
Downloading https://files.pythonhosted.org/packages/ff/d5/3a8727d6f890b1ae45da72a55bf8449e9f2c535a444923b338c3f509f203/Sphinx-1.8.2-py2.py3-none-any.whl#sha256=b348790776490894e0424101af9c8413f2a86831524bd55c5f379d3e3e12ca64
Best match: Sphinx 1.8.2
Processing Sphinx-1.8.2-py2.py3-none-any.whl
Installing Sphinx-1.8.2-py2.py3-none-any.whl to /usr/local/lib/python3.6/dist-packages
writing requirements to /usr/local/lib/python3.6/dist-packages/Sphinx-1.8.2-py3.6.egg/EGG-INFO/requires.txt
Adding Sphinx 1.8.2 to easy-install.pth file
Installing sphinx-apidoc script to /usr/local/bin
Installing sphinx-autogen script to /usr/local/bin
Installing sphinx-build script to /usr/local/bin
Installing sphinx-quickstart script to /usr/local/bin

Installed /usr/local/lib/python3.6/dist-packages/Sphinx-1.8.2-py3.6.egg
Searching for cffi>=1.1.0
Reading https://pypi.org/simple/cffi/
Downloading https://files.pythonhosted.org/packages/6d/c0/47db8f624f3e4e2f3f27be03a93379d1ba16a1450a7b1aacfa0366e2c0dd/cffi-1.11.5-cp36-cp36m-manylinux1_x86_64.whl#sha256=770f3782b31f50b68627e22f91cb182c48c47c02eb405fd689472aa7b7aa16dc
Best match: cffi 1.11.5
Processing cffi-1.11.5-cp36-cp36m-manylinux1_x86_64.whl
Installing cffi-1.11.5-cp36-cp36m-manylinux1_x86_64.whl to /usr/local/lib/python3.6/dist-packages
writing requirements to /usr/local/lib/python3.6/dist-packages/cffi-1.11.5-py3.6-linux-x86_64.egg/EGG-INFO/requires.txt
Adding cffi 1.11.5 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/cffi-1.11.5-py3.6-linux-x86_64.egg
Searching for tinycss2
Reading https://pypi.org/simple/tinycss2/
Downloading https://files.pythonhosted.org/packages/88/95/0ec73db7fc638ec000e662936ffe1a4e1eaa22f2861c8de18b1597c42584/tinycss2-0.6.1-py2.py3-none-any.whl#sha256=5e881eaa263bf4dc5c050d43cd6d2203ade1e3a3cda61f5511cf878972e83b78
Best match: tinycss2 0.6.1
Processing tinycss2-0.6.1-py2.py3-none-any.whl
Installing tinycss2-0.6.1-py2.py3-none-any.whl to /usr/local/lib/python3.6/dist-packages
writing requirements to /usr/local/lib/python3.6/dist-packages/tinycss2-0.6.1-py3.6.egg/EGG-INFO/requires.txt
Adding tinycss2 0.6.1 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/tinycss2-0.6.1-py3.6.egg
Searching for defusedxml
Reading https://pypi.org/simple/defusedxml/
Downloading https://files.pythonhosted.org/packages/87/1c/17f3e3935a913dfe2a5ca85fa5ccbef366bfd82eb318b1f75dadbf0affca/defusedxml-0.5.0-py2.py3-none-any.whl#sha256=702a91ade2968a82beb0db1e0766a6a273f33d4616a6ce8cde475d8e09853b20
Best match: defusedxml 0.5.0
Processing defusedxml-0.5.0-py2.py3-none-any.whl
Installing defusedxml-0.5.0-py2.py3-none-any.whl to /usr/local/lib/python3.6/dist-packages
Adding defusedxml 0.5.0 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/defusedxml-0.5.0-py3.6.egg
Searching for cssselect2
Reading https://pypi.org/simple/cssselect2/
Downloading https://files.pythonhosted.org/packages/12/e2/91fcd4cd32545beec6e11628d64d3e20f11b5a95dd1ccf3216fd69f176b7/cssselect2-0.2.1-py2.py3-none-any.whl#sha256=267eebc7378ade2e8be710cd0179606ad9c95ecc673138fccfcfba42c5ce153d
Best match: cssselect2 0.2.1
Processing cssselect2-0.2.1-py2.py3-none-any.whl
Installing cssselect2-0.2.1-py2.py3-none-any.whl to /usr/local/lib/python3.6/dist-packages
writing requirements to /usr/local/lib/python3.6/dist-packages/cssselect2-0.2.1-py3.6.egg/EGG-INFO/requires.txt
Adding cssselect2 0.2.1 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/cssselect2-0.2.1-py3.6.egg
Searching for cairocffi
Reading https://pypi.org/simple/cairocffi/
Downloading https://files.pythonhosted.org/packages/62/be/ad4d422b6f38d99b09ad6d046ab725e8ccac5fefd9ca256ca35a80dbf3c6/cairocffi-0.9.0.tar.gz#sha256=15386c3a9e08823d6826c4491eaccc7b7254b1dc587a3b9ce60c350c3f990337
Best match: cairocffi 0.9.0
Processing cairocffi-0.9.0.tar.gz
Writing /tmp/easy_install-maba1nux/cairocffi-0.9.0/setup.cfg
Running cairocffi-0.9.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-maba1nux/cairocffi-0.9.0/egg-dist-tmp-m90eqod_
warning: no previously-included files found matching 'setup.pyc'
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
zip_safe flag not set; analyzing archive contents...
pycparser.ply.__pycache__.lex.cpython-36: module references __file__
pycparser.ply.__pycache__.lex.cpython-36: module MAY be using inspect.getsourcefile
pycparser.ply.__pycache__.yacc.cpython-36: module references __file__
pycparser.ply.__pycache__.yacc.cpython-36: module MAY be using inspect.getsourcefile
pycparser.ply.__pycache__.yacc.cpython-36: module MAY be using inspect.stack
pycparser.ply.__pycache__.ygen.cpython-36: module references __file__

Installed /tmp/easy_install-maba1nux/cairocffi-0.9.0/.eggs/pycparser-2.19-py3.6.egg
file cairocffi/_ffi.py (for module cairocffi._ffi) not found
file cairocffi/_ffi_pixbuf.py (for module cairocffi._ffi_pixbuf) not found
no previously-included directories found matching 'docs/_build'
warning: no previously-included files found matching 'cairocffi/_ffi*.py'
file cairocffi/_ffi.py (for module cairocffi._ffi) not found
file cairocffi/_ffi_pixbuf.py (for module cairocffi._ffi_pixbuf) not found
file cairocffi/_ffi.py (for module cairocffi._ffi) not found
file cairocffi/_ffi_pixbuf.py (for module cairocffi._ffi_pixbuf) not found
zip_safe flag not set; analyzing archive contents...
cairocffi.__pycache__.ffi_build.cpython-36: module references __file__
creating /usr/local/lib/python3.6/dist-packages/cairocffi-0.9.0-py3.6.egg
Extracting cairocffi-0.9.0-py3.6.egg to /usr/local/lib/python3.6/dist-packages
Adding cairocffi 0.9.0 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/cairocffi-0.9.0-py3.6.egg
Searching for attrdict
Reading https://pypi.org/simple/attrdict/
Downloading https://files.pythonhosted.org/packages/35/bb/bac3e42ae04bc082c28cd8186bfb5b50fb240a4f7419f876c683125ccc8b/attrdict-2.0.0.tar.gz#sha256=86aeb6d3809e0344409f8148d7cac9eabce5f0b577c160b5e90d10df3f8d2ad3
Best match: attrdict 2.0.0
Processing attrdict-2.0.0.tar.gz
Writing /tmp/easy_install-lc90dz5r/attrdict-2.0.0/setup.cfg
Running attrdict-2.0.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-lc90dz5r/attrdict-2.0.0/egg-dist-tmp-v93xdlib
Moving attrdict-2.0.0-py3.6.egg to /usr/local/lib/python3.6/dist-packages
Adding attrdict 2.0.0 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/attrdict-2.0.0-py3.6.egg
Searching for svgwrite
Reading https://pypi.org/simple/svgwrite/
Downloading https://files.pythonhosted.org/packages/87/ce/3259f75aebb12d8c7dd9e8c479ad4968db5ed18e03f24ee4f6be9d9aed23/svgwrite-1.2.1-py2.py3-none-any.whl#sha256=3a3ffd9cea9323ca53afd2e5049c2be174590078d306ea5fe3e2dce037a29343
Best match: svgwrite 1.2.1
Processing svgwrite-1.2.1-py2.py3-none-any.whl
Installing svgwrite-1.2.1-py2.py3-none-any.whl to /usr/local/lib/python3.6/dist-packages
writing requirements to /usr/local/lib/python3.6/dist-packages/svgwrite-1.2.1-py3.6.egg/EGG-INFO/requires.txt
Adding svgwrite 1.2.1 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/svgwrite-1.2.1-py3.6.egg
Searching for pycparser
Reading https://pypi.org/simple/pycparser/
Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz#sha256=a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3
Best match: pycparser 2.19
Processing pycparser-2.19.tar.gz
Writing /tmp/easy_install-src5bszs/pycparser-2.19/setup.cfg
Running pycparser-2.19/setup.py -q bdist_egg --dist-dir /tmp/easy_install-src5bszs/pycparser-2.19/egg-dist-tmp-4j77h0no
warning: no previously-included files found matching 'setup.pyc'
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
zip_safe flag not set; analyzing archive contents...
pycparser.ply.__pycache__.lex.cpython-36: module references __file__
pycparser.ply.__pycache__.lex.cpython-36: module MAY be using inspect.getsourcefile
pycparser.ply.__pycache__.yacc.cpython-36: module references __file__
pycparser.ply.__pycache__.yacc.cpython-36: module MAY be using inspect.getsourcefile
pycparser.ply.__pycache__.yacc.cpython-36: module MAY be using inspect.stack
pycparser.ply.__pycache__.ygen.cpython-36: module references __file__
creating /usr/local/lib/python3.6/dist-packages/pycparser-2.19-py3.6.egg
Extracting pycparser-2.19-py3.6.egg to /usr/local/lib/python3.6/dist-packages
Adding pycparser 2.19 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/pycparser-2.19-py3.6.egg
Searching for six==1.11.0
Best match: six 1.11.0
Adding six 1.11.0 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Searching for Pillow==5.2.0
Best match: Pillow 5.2.0
Adding Pillow 5.2.0 to easy-install.pth file

Using /home/oyvind/.local/lib/python3.6/site-packages
Searching for sphinxcontrib-websupport==1.1.0
Best match: sphinxcontrib-websupport 1.1.0
Adding sphinxcontrib-websupport 1.1.0 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages
Searching for snowballstemmer==1.2.1
Best match: snowballstemmer 1.2.1
Adding snowballstemmer 1.2.1 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages
Searching for setuptools==40.4.3
Best match: setuptools 40.4.3
Adding setuptools 40.4.3 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-3.6 script to /usr/local/bin

Using /usr/local/lib/python3.6/dist-packages
Searching for requests==2.19.1
Best match: requests 2.19.1
Adding requests 2.19.1 to easy-install.pth file

Using /home/oyvind/.local/lib/python3.6/site-packages
Searching for packaging==17.1
Best match: packaging 17.1
Adding packaging 17.1 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages
Searching for imagesize==1.0.0
Best match: imagesize 1.0.0
Adding imagesize 1.0.0 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages
Searching for docutils==0.14
Best match: docutils 0.14
Adding docutils 0.14 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages
Searching for Babel==2.6.0
Best match: Babel 2.6.0
Adding Babel 2.6.0 to easy-install.pth file
Installing pybabel script to /usr/local/bin

Using /usr/local/lib/python3.6/dist-packages
Searching for alabaster==0.7.11
Best match: alabaster 0.7.11
Adding alabaster 0.7.11 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages
Searching for Pygments==2.2.0
Best match: Pygments 2.2.0
Adding Pygments 2.2.0 to easy-install.pth file
Installing pygmentize script to /usr/local/bin

Using /usr/local/lib/python3.6/dist-packages
Searching for Jinja2==2.10
Best match: Jinja2 2.10
Adding Jinja2 2.10 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages
Searching for webencodings==0.5
Best match: webencodings 0.5
Adding webencodings 0.5 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Searching for pyparsing==2.2.0
Best match: pyparsing 2.2.0
Adding pyparsing 2.2.0 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages
Searching for urllib3==1.23
Best match: urllib3 1.23
Adding urllib3 1.23 to easy-install.pth file

Using /home/oyvind/.local/lib/python3.6/site-packages
Searching for certifi==2018.8.24
Best match: certifi 2018.8.24
Adding certifi 2018.8.24 to easy-install.pth file

Using /home/oyvind/.local/lib/python3.6/site-packages
Searching for chardet==3.0.4
Best match: chardet 3.0.4
Adding chardet 3.0.4 to easy-install.pth file
Installing chardetect script to /usr/local/bin

Using /usr/lib/python3/dist-packages
Searching for idna==2.7
Best match: idna 2.7
Adding idna 2.7 to easy-install.pth file

Using /home/oyvind/.local/lib/python3.6/site-packages
Searching for pytz==2018.5
Best match: pytz 2018.5
Adding pytz 2018.5 to easy-install.pth file

Using /home/oyvind/.local/lib/python3.6/site-packages
Searching for MarkupSafe==1.0
Best match: MarkupSafe 1.0
Adding MarkupSafe 1.0 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Finished processing dependencies for sphinxcontrib-wavedrom==1.3.2.dev9+g1f8bd40
oyvind@davos:~/sphinx-wavedrom$ python3 
Python 3.6.6 (default, Sep 12 2018, 18:26:19) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sphinxcontrib.wavedrom
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sphinxcontrib.wavedrom'
wallento commented 5 years ago

Interesting. Can you check if /usr/local/lib/python3.6/dist-packages is in your path?

Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/wallento/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']

Can you also check if the wavedrom package can be loaded?

Thanks!

oharboe commented 5 years ago
$ python3
Python 3.6.6 (default, Sep 12 2018, 18:26:19) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/oyvind/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/local/lib/python3.6/dist-packages/sphinxcontrib_wavedrom-1.3.2.dev9+g1f8bd40-py3.6.egg', '/usr/local/lib/python3.6/dist-packages/xcffib-0.6.0-py3.6.egg', '/usr/local/lib/python3.6/dist-packages/CairoSVG-2.2.1-py3.6.egg', '/usr/local/lib/python3.6/dist-packages/wavedrom-1.8.0rc3-py3.6.egg', '/usr/local/lib/python3.6/dist-packages/Sphinx-1.8.2-py3.6.egg', '/usr/local/lib/python3.6/dist-packages/cffi-1.11.5-py3.6-linux-x86_64.egg', '/usr/local/lib/python3.6/dist-packages/tinycss2-0.6.1-py3.6.egg', '/usr/local/lib/python3.6/dist-packages/defusedxml-0.5.0-py3.6.egg', '/usr/local/lib/python3.6/dist-packages/cssselect2-0.2.1-py3.6.egg', '/usr/local/lib/python3.6/dist-packages/cairocffi-0.9.0-py3.6.egg', '/usr/local/lib/python3.6/dist-packages/attrdict-2.0.0-py3.6.egg', '/usr/local/lib/python3.6/dist-packages/svgwrite-1.2.1-py3.6.egg', '/usr/local/lib/python3.6/dist-packages/pycparser-2.19-py3.6.egg', '/usr/lib/python3/dist-packages']
>>> 
wallento commented 5 years ago

That is odd. Can you please ls /usr/local/lib/python3.6/dist-packages/sphinxcontrib_wavedrom-1.3.2.dev9+g1f8bd40-py3.6.egg

Also, please check if import wavedrom works (which is installed at the same location).

What happens if you sudo python3?

oharboe commented 5 years ago
$  ls /usr/local/lib/python3.6/dist-packages/sphinxcontrib_wavedrom-1.3.2.dev9+g1f8bd40-py3.6.egg
EGG-INFO  sphinxcontrib
$
$ python3
Python 3.6.6 (default, Sep 12 2018, 18:26:19) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wavedrom
>>> 
$ sudo python3
[sudo] password for oyvind: 
Python 3.6.6 (default, Sep 12 2018, 18:26:19) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sphinxcontrib.wavedrom
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sphinxcontrib.wavedrom'
>>> 
wallento commented 5 years ago

I am not able to reproduce your problem. I have created a docker image as wallento/test-wavedrom:

FROM ubuntu:18.04

RUN apt-get update && apt-get install -y python3 git python3-setuptools sudo

RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
WORKDIR /home/docker

USER docker

Running inside that with docker run -ti wallento/test-wavedrom:

docker@f4314279d322:~$ git clone https://github.com/wallento/sphinx-wavedrom
Cloning into 'sphinx-wavedrom'...
remote: Enumerating objects: 49, done.
remote: Counting objects: 100% (49/49), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 209 (delta 19), reused 37 (delta 14), pack-reused 160
Receiving objects: 100% (209/209), 70.68 KiB | 761.00 KiB/s, done.
Resolving deltas: 100% (95/95), done.
docker@f4314279d322:~$ cd sphinx-wavedrom/
docker@f4314279d322:~/sphinx-wavedrom$ sudo python3 setup.py install
[sudo] password for docker: <docker>
<install as above>
Finished processing dependencies for sphinxcontrib-wavedrom==1.3.2.dev9+g1f8bd40
docker@f4314279d322:~/sphinx-wavedrom$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sphinxcontrib.wavedrom
>>> 

I am not sure if the issue relates to the package or some other Python issue on your machine.

oharboe commented 5 years ago

I've tried it on two Ubuntu 18.04 machines. I don't know what sort of Python snag we've run into here. I have a colleague(in a different company than me) who I'm sure can find out, but this is turning into real work, so I am a little bit as to a loss on how we might put this to bed.

bavovanachte commented 5 years ago

As it's likely a setup issue (works on a clean docker image), I propose to merge and test "in the wild" (maybe installing it through pip magically fixes things).