Skip to content

docs: import version and specification version from sigmf #110

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

Closed
wants to merge 1 commit into from

Conversation

daniestevez
Copy link
Contributor

@daniestevez daniestevez commented May 17, 2025

Rather than parsing __init__.py, import the Python module and grab the values from there. This should work as long as sigmf-python is installed in the venv used to build the docs.

Rather than parsing __init__.py, import the Python module and grab
the values from there. This should work as long as sigmf-python is
installed in the venv used to build the docs.
@daniestevez
Copy link
Contributor Author

I got this to work locally by running the following:

python3 -mvenv docs/venv
source docs/venv/bin/activate
pip install -r docs/requirements.txt 
pip install .
pip install scipy
sphinx-build docs/source/ docs/out

Note that I needed to install scipy manually, since otherwise I got the following when running sphinx-build:

WARNING: [autosummary] failed to import sigmf.apps.convert_wav.
Possible hints:
* ModuleNotFoundError: No module named 'scipy'
* AttributeError: module 'sigmf.apps' has no attribute 'convert_wav'
* ImportError: 

Since sigmf/apps/convert_wav.py imports scipy, this should be listed as a dependency in pyproject.toml.

@daniestevez
Copy link
Contributor Author

I've sent another PR to fix the scipy problem #111.

@Teque5
Copy link
Collaborator

Teque5 commented May 18, 2025

I appreciate the effort here. I checked out your branch but the downside to this approach is that if you already have sigmf installed and want to experiment with the docs, it will be reading the installed version and not the version local to the conf.py.

I'll create a PR to clarify how to build the docs locally, though:

cd docs
make html

@Teque5 Teque5 closed this May 18, 2025
@Teque5 Teque5 mentioned this pull request May 18, 2025
@daniestevez
Copy link
Contributor Author

FWIW, the docs Makefile could create a venv, install the dependencies and sigmf-python, and run doc generation in that venv. The main point of this PR was that by loading data from the Python package rather than parsing __init__.py, we will be able to load the schema version in __init__.py by parsing the JSON, rather than hardcoding it. Another possible approach that avoids the need to import sigmf in conf.py would be to use the same code for parsing the JSON both in __init__.py and conf.py.

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