Skip to content

Commit

Permalink
Migrate from colon- to space-separated commands #6
Browse files Browse the repository at this point in the history
- Sub spaces for colons in command entry_points
- Update docs to reflect removal of colons from command names
- Update tests to reflect removal of colons from command names
- Bump plugin version to 0.2.0
  • Loading branch information
zstumgoren committed Jan 17, 2018
1 parent 94c7ac8 commit f0b20be
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 33 deletions.
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
History
=======


0.2.0 (2018-01-17)
------------------

* Switch from colon- to space-separated plugin commands


0.1.0 (2016-03-16)
------------------

Expand Down
2 changes: 1 addition & 1 deletion datakit_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """Serdar Tumgoren"""
__email__ = '[email protected]'
__version__ = '0.1.0'
__version__ = '0.2.0'

from .commands.init import Init
from .commands.push import Push
Expand Down
6 changes: 3 additions & 3 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Install::
Initialize project for use with S3::

$ cd /path/to/my-project
$ datakit data:init
$ datakit data init

Edit `config/datakit-data.json`::

Expand All @@ -26,8 +26,8 @@ Drop data files in project data directory::

Push/pull data files between local machine and S3::

$ datakit data:push
$ datakit data:pull
$ datakit data push
$ datakit data pull

.. note::

Expand Down
4 changes: 2 additions & 2 deletions docs/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ has been integrated with S3 (see :ref:`usage-init`)::
$ cd /path/to/data-project

# Stash data on S3
$ datakit data:push
$ datakit data push

# Fetch data from S3
$ datakit data:pull
$ datakit data pull

Please see :ref:`usage` for more details on integrating a project with an S3 data store.

Expand Down
16 changes: 8 additions & 8 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ Initialize
To initialize::

$ cd /path/to/my-project
$ datakit data:init
$ datakit data init

The `data:init` command creates:
The `data init` command creates:

* `data/` - a directory where data files should be placed. This directory will be synced to the S3
bucket and path specified in the project configuration file (see below).
Expand Down Expand Up @@ -78,7 +78,7 @@ AWS integration. This feature helps speed up S3 integration for new projects.

Default values for the `aws_user_profile` and `s3_bucket` settings mentioned in :ref:`usage-configure` can be placed
in **~/.datakit/plugins/datakit-data/config.json**. These configurations will then be applied
to all projects when `datakit data:init` is run.
to all projects when `datakit data init` is run.


Example
Expand Down Expand Up @@ -146,8 +146,8 @@ Pushing and pulling data between your local machine and the S3 data store requir

.. code::
$ datakit data:push
$ datakit data:pull
$ datakit data push
$ datakit data pull
The above commands provide a human-friendly interface to the `AWS S3 sync`_ commmand line utility.
Expand Down Expand Up @@ -178,15 +178,15 @@ The flags must be passed to `datakit` as additional paramaters **without leading

For example, to delete files on S3 that are *not* present locally::

$ datakit data:push delete
$ datakit data push delete

To view which files will be affected before pushing data to S3::

$ datakit data:push dryrun
$ datakit data push dryrun

or

$ datakit data:push delete dryrun
$ datakit data push delete dryrun


Please refer to the `AWS S3 sync`_ documentation for details on other boolean flags.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.0
current_version = 0.2.0
commit = True
tag = True

Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

setup(
name='datakit-data',
version='0.1.0',
version='0.2.0',
description="A datakit plugin to manage data assets on AWS S3.",
long_description=__doc__,
author="Serdar Tumgoren",
Expand All @@ -36,9 +36,9 @@
include_package_data=True,
entry_points={
'datakit.plugins': [
'data:init= datakit_data:Init',
'data:push= datakit_data:Push',
'data:pull= datakit_data:Pull',
'data init= datakit_data:Init',
'data push= datakit_data:Push',
'data pull= datakit_data:Pull',
]
},
install_requires=requirements,
Expand Down
14 changes: 7 additions & 7 deletions tests/commands/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_project_buildout(caplog, fake_project, monkeypatch, tmpdir):
"""
Init should auto-generate directories and project-level config file.
"""
cmd = Init(None, None, cmd_name='data:init')
cmd = Init(None, None, cmd_name='data init')
parsed_args = mock.Mock()
cmd.run(parsed_args)
contents = dir_contents(tmpdir.strpath)
Expand All @@ -40,7 +40,7 @@ def test_plugin_configs_not_initialized(dkit_home):
"""
Init should NOT auto-generate plugin-level configurations.
"""
cmd = Init(None, None, cmd_name='data:init')
cmd = Init(None, None, cmd_name='data init')
parsed_args = mock.Mock()
cmd.run(parsed_args)
# Guard against auto-generation of plugin-level configs
Expand All @@ -59,7 +59,7 @@ def test_inherit_plugin_level_configs(dkit_home, fake_project):
}
create_plugin_config(dkit_home, 'datakit-data', plugin_configs)
# Iniitalize project
cmd = Init(None, None, cmd_name='data:init')
cmd = Init(None, None, cmd_name='data init')
parsed_args = mock.Mock()
cmd.run(parsed_args)
assert cmd.project_configs == plugin_configs
Expand All @@ -76,7 +76,7 @@ def test_s3_path_prefix(dkit_home, fake_project):
}
create_plugin_config(dkit_home, 'datakit-data', plugin_configs)
# Iniitalize project
cmd = Init(None, None, cmd_name='data:init')
cmd = Init(None, None, cmd_name='data init')
parsed_args = mock.Mock()
cmd.run(parsed_args)
assert cmd.project_configs['s3_path'] == 'projects/2017/fake-project'
Expand All @@ -91,7 +91,7 @@ def test_s3_path_suffix(dkit_home, fake_project):
}
create_plugin_config(dkit_home, 'datakit-data', plugin_configs)
# Iniitalize project
cmd = Init(None, None, cmd_name='data:init')
cmd = Init(None, None, cmd_name='data init')
parsed_args = mock.Mock()
cmd.run(parsed_args)
assert cmd.project_configs['s3_path'] == 'fake-project/data'
Expand All @@ -107,7 +107,7 @@ def test_s3_path_prefix_and_suffix(dkit_home, fake_project):
}
create_plugin_config(dkit_home, 'datakit-data', plugin_configs)
# Iniitalize project
cmd = Init(None, None, cmd_name='data:init')
cmd = Init(None, None, cmd_name='data init')
parsed_args = mock.Mock()
cmd.run(parsed_args)
assert cmd.project_configs['s3_path'] == 'projects/2017/fake-project/data'
Expand All @@ -121,7 +121,7 @@ def test_preexisting_project_configs_honored(fake_project):
"""
# Mimic a prior initialization by pre-creating the config file
create_project_config(fake_project, {'aws_user_profile': 'user2'})
cmd = Init(None, None, cmd_name='data:init')
cmd = Init(None, None, cmd_name='data init')
parsed_args = mock.Mock()
cmd.run(parsed_args)
proj_configs = cmd.project_configs
Expand Down
8 changes: 4 additions & 4 deletions tests/commands/test_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_s3_instantiation(mocker):
'datakit_data.commands.pull.S3',
autospec=True,
)
cmd = Pull(None, None, 'data:pull')
cmd = Pull(None, None, 'data pull')
parsed_args = mock.Mock()
parsed_args.args = []
cmd.run(parsed_args)
Expand All @@ -42,7 +42,7 @@ def test_pull_invocation(mocker):
'datakit_data.commands.pull.S3.pull',
autospec=True,
)
cmd = Pull(None, None, 'data:pull')
cmd = Pull(None, None, 'data pull')
parsed_args = mock.Mock()
parsed_args.args = []
cmd.run(parsed_args)
Expand All @@ -60,7 +60,7 @@ def test_pull_at_s3_layer(mocker):
autospec=True,
return_value=b'Some gunk\rupload: foo\nMore gunk\rupload: bar\n'
)
cmd = Pull(None, None, 'data:pull')
cmd = Pull(None, None, 'data pull')
parsed_args = mock.Mock()
parsed_args.args = []
cmd.run(parsed_args)
Expand All @@ -81,7 +81,7 @@ def test_boolean_cli_flags(mocker):
)
parsed_args = mock.Mock()
parsed_args.args = ['dryrun']
cmd = Pull(None, None, 'data:pull')
cmd = Pull(None, None, 'data pull')
cmd.run(parsed_args)
pull_mock.assert_any_call(
mock.ANY,
Expand Down
6 changes: 3 additions & 3 deletions tests/commands/test_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_s3_instantiation(mocker):
'datakit_data.commands.push.S3',
autospec=True,
)
cmd = Push(None, None, 'data:push')
cmd = Push(None, None, 'data push')
parsed_args = mock.Mock()
parsed_args.args = []
cmd.run(parsed_args)
Expand All @@ -41,7 +41,7 @@ def test_push_invocation(mocker):
'datakit_data.commands.push.S3.push',
autospec=True,
)
cmd = Push(None, None, 'data:push')
cmd = Push(None, None, 'data push')
parsed_args = mock.Mock()
parsed_args.args = []
cmd.run(parsed_args)
Expand All @@ -60,7 +60,7 @@ def test_boolean_cli_flags(mocker):
)
parsed_args = mock.Mock()
parsed_args.args = ['dry-run']
cmd = Push(None, None, 'data:push')
cmd = Push(None, None, 'data push')
cmd.run(parsed_args)
push_mock.assert_any_call(
mock.ANY,
Expand Down

0 comments on commit f0b20be

Please sign in to comment.