INNER CODE UNIT · Python

get_requirements

brentp/peddy · setup.py:6

def get_requirements():
    """Get requirements from requirements.txt"""
    with open("requirements.txt") as handle:
        return [x.strip() for x in handle]


def get_version():
    """Get the version info from the mpld3 package without importing it"""
    import ast

    with open(os.path.join("peddy", "__init__.py"), "r") as init_file:
        module = ast.parse(init_file.read())

    version = (ast.literal_eval(node.value) for node in ast.walk(module)
             if isinstance(node, ast.Assign)
             and node.targets[0].id == "__version__")
    try:
        return next(version)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…