Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version info to druid package and use it for CLI version output #50

Merged
merged 2 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref-names: $Format:%D$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git_archival.txt export-subst
Copy link
Member Author

@simonvanderveldt simonvanderveldt Oct 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is some git "magic" that processes the file on the left using the attribute on the right.
export-subst basically substitutes some placeholders, see https://git-scm.com/docs/gitattributes#_creating_an_archive for more details.

The result is something like

ref-names: HEAD -> add-version-info, tag: 0.1.3, origin/add-version-info

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ dkms.conf
build/
dist/
__pycache__/
.eggs
*.log
*~
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

setup(
name="monome-druid",
version="0.1.1",
description="Terminal interface for crow",
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -21,11 +20,18 @@
packages=find_packages("src"),
package_dir={"": "src"},
include_package_data=True,
use_scm_version=True,
python_requires=">=3.5",
setup_requires=[
"setuptools_scm",
"setuptools_scm_git_archive",
],
install_requires=[
"Click>=7.0",
"prompt-toolkit>=2.0.10",
"pyserial>=3.4",
"setuptools_scm",
"setuptools_scm_git_archive",
Comment on lines +33 to +34
Copy link
Member Author

@simonvanderveldt simonvanderveldt Oct 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to have these installed at runtime as well, otherwise the detection isn't possible.
Not super happy about that but if you want runtime detection there isn't really another option. We can of course discuss if we want/need runtime detection, but personally I quiet like it if we ask someone for some info for a bug that we know that something might or might not have been changed,

],
extras_require={
"test": [
Expand Down
4 changes: 4 additions & 0 deletions src/druid/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import pkg_resources

from setuptools_scm import get_version
__version__ = get_version()
4 changes: 2 additions & 2 deletions src/druid/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

import click

from druid import crowlib
from druid import __version__, crowlib
from druid import repl as druid_repl

@click.group(invoke_without_command=True)
@click.pass_context
@click.version_option()
@click.version_option(__version__)
def cli(ctx):
""" Terminal interface for crow """
if ctx.invoked_subcommand is None:
Expand Down