Skip to content

Commit

Permalink
docs: populate autodock_mock_imports with all modules
Browse files Browse the repository at this point in the history
  • Loading branch information
trichter committed Sep 19, 2024
1 parent 2a80d40 commit a724c94
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
4 changes: 1 addition & 3 deletions anchorna/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,12 @@ def _make_rgb_transparent(rgb, bg_rgb, alpha):
for (c1, c2) in zip(to_rgb(rgb), to_rgb(bg_rgb))]


cols = list(mcolors.TABLEAU_COLORS.values())
to_hex(cols[0], 0.3)

def jalview_features(anchors, mode='aa', score_use_fluke=None):
"""
Write anchors to Jalview feature file
"""
assert mode in ('nt', 'cds', 'aa')
cols = list(mcolors.TABLEAU_COLORS.values())
anchors = sorted(anchors, key=lambda a: a.guide.start)
content = []
header = []
Expand Down
40 changes: 24 additions & 16 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,44 @@
# Configuration file for the Sphinx documentation builder.
# Build doc locally with with
# Build doc locally with
# sphinx-build -anE -c . src _build

import sys
import os

os.environ['SPHINX_BUILD'] = '1'


def version():
def parse_version():
from pathlib import Path
import re
init_path = Path(__file__).parent.parent / 'anchorna/__init__.py'
with open(init_path) as f:
content = f.read()
match = re.search("""__version__\s*=\s*['"]([^\s]+)['"]""", content)
regex = r"""__version__\s*=\s*['"]([^\s]+)['"]"""
match = re.search(regex, content)
if match:
return match.group(1)


def parse_imports():
from pathlib import Path
import re
root_path = Path(__file__).parent.parent / 'anchorna/'
root_path = Path('/home/gi48zar/dev/anchorna/anchorna/')
regex = r'^\s*import\s+(\w+)(?:.\w+)*|^\s*from\s+(\w+)(?:.\w+)*\s+import'
modules = set()
for fname in root_path.glob('**/*.py'):
with open(fname) as f:
content = f.read()
for match in re.finditer(regex, content, flags=re.MULTILINE):
modules |= set(match.groups())
modules -= {None, 'anchorna'}
return sorted(modules)


project = 'AnchoRNA'
copyright = '2024, Tom Eulenfeld'
author = 'Tom Eulenfeld'
version = version()
version = parse_version()

### General configuration
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
default_role = 'py:obj'
templates_path = ['_templates']
exclude_patterns = ['_build']

# Add any Sphinx extension module names here
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
Expand All @@ -43,11 +51,11 @@ def version():
'private-members': True,
'show-inheritance': True,
}
autodoc_mock_imports = parse_imports()
print(f'set {autodoc_mock_imports=}')

autodoc_mock_imports = ['sugar', 'tqdm']

html_theme = 'furo'
html_title = f'AnchoRNA <br>v{version} <br>documentation'
html_theme = 'furo'
html_theme_options = {
'footer_icons' : [],
'top_of_page_buttons': [],
Expand Down

0 comments on commit a724c94

Please sign in to comment.