archive
/
md-pdf
Archived
1
Fork 0

Create project skeleton

This commit is contained in:
Jake Howard 2017-03-27 09:02:05 +01:00
parent 5d9f8bd18c
commit 0097d50767
6 changed files with 57 additions and 1 deletions

1
.gitignore vendored
View File

@ -9,7 +9,6 @@ __pycache__/
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/

18
setup.py Normal file
View File

@ -0,0 +1,18 @@
from setuptools import setup
setup(
name="md-pdf",
version="1.0",
install_requires=[
"beautifulsoup4==4.5.3",
"click==6.7.0",
"jinja2==2.9.5",
"pdfkit==0.6.1",
"pypandoc==1.3.3"
],
entry_points="""
[console_scripts]
mdp=src.cli:cli
"""
)

0
src/__init__.py Normal file
View File

0
src/build/__init__.py Normal file
View File

0
src/build/cli.py Normal file
View File

39
src/cli.py Normal file
View File

@ -0,0 +1,39 @@
import os.path
import click
import logging
FORMAT = "[%(levelname)s]: %(message)s"
logging.basicConfig(format=FORMAT, level=logging.DEBUG)
logging.getLogger("requests").setLevel(logging.WARNING)
class MDPDFCLI(click.MultiCommand):
def list_commands(self, ctx):
return ['build']
def get_command(self, ctx, name):
ns = {}
if name not in self.list_commands(ctx):
return
try:
fn = os.path.join(os.path.dirname(__file__), name + '/cli.py')
with open(fn) as f:
code = compile(f.read(), fn, 'exec')
eval(code, ns, ns)
return ns['cli']
except:
return
cli = MDPDFCLI(help='This tool\'s subcommands are loaded from a plugin folder dynamically.')
@click.command(cls=MDPDFCLI)
def cli():
pass
if __name__ == '__main__':
cli()