setup.py
def parse_version(fpath='wbia_lca/__init__.py'):
    """
    Statically parse the version number from a python file


    """
    import ast

    if not exists(fpath):
        raise ValueError('fpath={!r} does not exist'.format(fpath))
    with open(fpath, 'r') as file_:
        sourcecode = file_.read()
    pt = ast.parse(sourcecode)

    class VersionVisitor(ast.NodeVisitor):
        def visit_Assign(self, node):
            for target in node.targets:
                if getattr(target, 'id', None) == '__version__':
                    self.version = node.value.s

    visitor = VersionVisitor()
    visitor.visit(pt)
    return visitor.version

    Statically parse the version number from a python file


    
Statically parse the version number from a python file
Statically parse the version number from a python file
def parse_version(fpath='wbia_lca/__init__.py'):
    import ast
    if not exists(fpath):
        raise ValueError('fpath={!r} does not exist'.format(fpath))
    with open(fpath, 'r') as file_:
        sourcecode = file_.read()
    pt = ast.parse(sourcecode)
    class VersionVisitor(ast.NodeVisitor):
        def visit_Assign(self, node):
            for target in node.targets:
                if getattr(target, 'id', None) == '__version__':
                    self.version = node.value.s
    visitor = VersionVisitor()
    visitor.visit(pt)
    return visitor.version
def parse_version ( fpath = 'wbia_lca/__init__.py' ) : import ast if not exists ( fpath ) : raise ValueError ( 'fpath={!r} does not exist' . format ( fpath ) ) with open ( fpath , 'r' ) as file_ : sourcecode = file_ . read ( ) pt = ast . parse ( sourcecode ) class VersionVisitor ( ast . NodeVisitor ) : def visit_Assign ( self , node ) : for target in node . targets : if getattr ( target , 'id' , None ) == '__version__' : self . version = node . value . s visitor = VersionVisitor ( ) visitor . visit ( pt ) return visitor . version
Statically parse the version number from a python file
Statically parse the version number from a python file
"""
    Statically parse the version number from a python file


    """
fpath