PKjL+zg flinx.py"""Configuration-free Python doc generation via Sphinx.""" import sys import webbrowser from pathlib import Path import click from jinja2 import Environment from project_metadata import MetadataConfig from sphinx.cmd.build import main as sphinx __version__ = '0.1.1' GENERATED_TEXT = "THIS FILE IS GENERATED AUTOMATICALLY BY FLINX. " "MANUAL CHANGES WILL BE LOST." env = Environment() env.filters['repr'] = repr poject_relpath = Path('..') env.filters['project_rel'] = lambda s: str(poject_relpath / s) TEMPLATE_DIR = Path('templates') conf_tpl = env.from_string((TEMPLATE_DIR / 'conf.py.tpl').read_text()) index_tpl = env.from_string((TEMPLATE_DIR / 'index.rst.tpl').read_text()) def write_template_files(output_dir, generated=True): """Generate the ``conf.py`` and ``README.rst`` files.""" # TODO: refuse to overwrite non-generated ones metadata = MetadataConfig() generated_text = GENERATED_TEXT if generated else None index_text = index_tpl.render( readme=metadata['readme'], module_name=metadata['module'], generated_text=generated_text, ) (output_dir / 'index.rst').write_text(index_text) copyright_year = '2018' author = metadata['author'] conf_text = conf_tpl.render( module_path='..', project=metadata['module'], copyright=f'{copyright_year}, {author}', author=author, version=metadata['version'], language='en', # TODO: options for autodoc extensions=['sphinx.ext.autodoc', 'sphinx.ext.intersphinx'], source_suffix=['.rst'], master_basename='index', generated_text=generated_text, ) conf_path = output_dir / 'conf.py' conf_path.write_text(conf_text) return conf_path @click.group() def main(): pass @main.command() def generate(): docs_dir = Path('./docs') write_template_files(docs_dir) @main.command() def eject(): docs_dir = Path('./docs') write_template_files(docs_dir, generated=False) @main.command() @click.option('-a', '--all', is_flag=True, help='Rebuild all the docs, regardless of what has changed.') @click.option('-o', '--open', is_flag=True, help='Open the HTML index in a browser.') @click.option('--format', default='html', type=click.Choice(['html']), help='The output format.') def build(all=False, format='html', open=False): """Build the documentation.""" docs_dir = Path('./docs') build_dir = docs_dir / '_build' / format docs_dir.mkdir(exist_ok=True) conf_path = write_template_files(docs_dir) args = [ '-b', format, '-c', str(conf_path.parent), # config file '-j', 'auto', # processors '-q', # quiet str(docs_dir), str(build_dir) ] if all: args += ['-a'] status = sphinx(args) if status: sys.exit(sys.exit) if open and format == 'html': webbrowser.open(str(build_dir / 'index.html')) if __name__ == '__main__': main() PK!H5"$&flinx-0.1.1.dist-info/entry_points.txtN+I/N.,()J̫Vy\\PKZL0*88flinx-0.1.1.dist-info/LICENSEThe MIT License (MIT) Copyright (c) 2018 Oliver Steele Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HNOflinx-0.1.1.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,zd&Y)r$[)T&UrPK!H-rȰflinx-0.1.1.dist-info/METADATAXnOqj#pqQ-ބ k8lffEA˓;3Û)PȹwsF҉R8]t3oɥ刖j lM,ժ3a7])CֺR [tM5de{]˴+H_;pRn-BCmU受W.qfDWp\Me-T5 oQKM>ʟ;eMy#L¨[_l\:[s Sc]֪P{)iDyjӸm%g+WSip򦔭ͱ^Q|a"UXp?rtc[Uƙ.:'ᅐOmt&dm usע,\zq@`+HQ$mP6J8i0Iz$2 b5%DI[R DimF%{$y,jEqA.-ʢ&4-$-9>DN9RoIjXuGZW+rltk܊GIrJqv#/8Z Y}T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