Skip to content

Commit

Permalink
Merge pull request #5 from Vini2/main
Browse files Browse the repository at this point in the history
Add click version options and update setup.py to include README.md info
  • Loading branch information
beardymcjohnface authored Jan 19, 2023
2 parents 4206032 + 757dae9 commit a8eb74d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
14 changes: 14 additions & 0 deletions {{cookiecutter.project_slug}}/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ def get_version():
)
) as f:
return f.readline().strip()


def get_description():
with open("README.md", "r") as fh:
long_description = fh.read()
return long_description


def get_data_files():
data_files = [(".", ["README.md"])]
return data_files


CLASSIFIERS = [
Expand All @@ -33,9 +44,12 @@ def get_version():
url="{{cookiecutter.project_url}}",
python_requires="{{cookiecutter.min_python_version}}",
description="{{cookiecutter.project_description}}",
long_description=get_description(),
long_description_content_type="text/markdown",
version=get_version(),
author="{{cookiecutter.full_name}}",
author_email="{{cookiecutter.email}}",
data_files=get_data_files(),
py_modules=["{{cookiecutter.project_slug}}"],
install_requires=[
"snakemake{{cookiecutter.snakemake_version}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from .util import (
snake_base,
print_version,
get_version,
default_to_output,
copy_config,
run_snakemake,
Expand Down Expand Up @@ -82,8 +82,11 @@ def common_options(func):
@click.group(
cls=OrderedCommands, context_settings=dict(help_option_names=["-h", "--help"])
)
@click.version_option(get_version(), "-v", "--version", is_flag=True)
def cli():
"""For more options, run:
"""{{cookiecutter.project_description}}
\b
For more options, run:
{{cookiecutter.project_slug}} command --help"""
pass

Expand Down Expand Up @@ -150,7 +153,6 @@ def citation(**kwargs):


def main():
print_version()
cli()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def snake_base(rel_path):
return os.path.join(os.path.dirname(os.path.realpath(__file__)), rel_path)


def print_version():
def get_version():
with open(snake_base("{{cookiecutter.project_slug}}.VERSION"), "r") as f:
version = f.readline()
echo_click("\n" + "{{cookiecutter.project_name}} version " + version + "\n")
return version


def echo_click(msg, log=None):
Expand Down

0 comments on commit a8eb74d

Please sign in to comment.