Initial feature-set docs and starter code (#2)

* add logo, update readme

* add travis config

* .travis.yml - add newline at file end

* fix typo

* add example cli

* ignore vscode config

* reference contributing.md from readme.md

* add packaging tools

* revfix: capitalize SDK

* pytest support, basic test

* drop support for python2 in travis

* revfix: typos and improvements
This commit is contained in:
Ben Greenier 2019-01-04 16:45:05 -05:00 коммит произвёл GitHub
Родитель db00f1abd0
Коммит f004196f8b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
15 изменённых файлов: 147 добавлений и 1 удалений

Двоичные данные
.github/logo.png поставляемый Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 43 KiB

3
.gitignore поставляемый
Просмотреть файл

@ -1,3 +1,6 @@
# Vscode settings
.vscode/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

9
.travis.yml Normal file
Просмотреть файл

@ -0,0 +1,9 @@
language: python
python:
- "3.6"
# command to install dependencies
install:
- pip install -r src/requirements.txt
# command to run tests
script:
- pytest

36
CONTRIBUTING.md Normal file
Просмотреть файл

@ -0,0 +1,36 @@
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
## Getting started
+ Install [python >= 3.7.2](https://www.python.org/downloads/)
+ Ensure you have [pip](https://pip.pypa.io/en/stable/installing/)
+ `cd src`
+ `pip install -r requirements.txt`
+ Ready to code and run
## Dependency Management
In this project, we manage dependencies [this way](https://www.kennethreitz.org/essays/a-better-pip-workflow) (because it's simple and meets our minimum requirements).
To add dependencies:
+ Add an entry to `requirements-to-freeze.txt`
+ Then run `pip install -r requirements-to-freeze.txt`
+ Finally, when ready to lock versions (before release), run `pip freeze > requirements.txt`
To update dependencies:
+ Run `pip install -r requirements-to-freeze.txt --upgrade`
+ Finally, when ready to lock versions (before release), run `pip freeze > requirements.txt`

Просмотреть файл

@ -1,5 +1,36 @@
# cadet-cli
# Contributing
**C**osmos **A**utomated **D**ata **E**xchange **T**ool - A cross-platform utility to synchronize data with a [DocumentDB](https://docs.microsoft.com/en-us/azure/cosmos-db/create-sql-api-dotnet)-backed [Azure Cosmos DB](https://azure.microsoft.com/en-us/services/cosmos-db/) instance. 👩‍🚀☁
![Cadet-cli branded logo of a rocketship](./.github/logo.png)
You can __install the latest version of `cadet` from the [Releases](https://github.com/Microsoft/cadet-cli/releases/latest) page__, right here on GitHub.
## How it works
> Note: at this time, `cadet` [does not support](https://github.com/Microsoft/cadet-cli/issues/1) downloading data from Azure Cosmos DB.
Cadet is designed to make it simple to exchange data with Azure Cosmos DB instances that are using the [DocumentDB](https://docs.microsoft.com/en-us/azure/cosmos-db/create-sql-api-dotnet) backing store. It is a cross-platform [python](https://www.python.org/) CLI that leverages the Azure Cosmos DB python SDK under the hood. Here are some common things you can do using `cadet`:
### Import data from csv
The following command will import a comma-separated values file into the Azure Cosmos DB server located at `your-server-connection-string` into the collection `your-collection-name`. It will read the data from `path/to/csv.csv`, and will output progress as data uploads.
```
cadet import --type csv --uri "your-server-connection-string" --collection "your-collection-name" path/to/csv.csv
```
### Import data from tsv
The following command will import a tab-separated values file into the Azure Cosmos DB server located at `your-server-connection-string` into the collection `your-collection-name`. It will read the data from `path/to/tsv.tsv`, and will output progress as data uploads.
```
cadet import --type tsv --uri "your-server-connection-string" --collection "your-collection-name" path/to/tsv.tsv
```
## Contributing
For more information - including how to get started - see the [CONTRIBUTING](./CONTRIBUTING.md) document.
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us

3
package/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
*.spec
build/
dist/

15
package/README.md Normal file
Просмотреть файл

@ -0,0 +1,15 @@
# package
This folder contains the utilities needed to package `cadet` into an install-able format, using [pyInstaller](https://pyinstaller.readthedocs.io/).
## Producing a package
> Note: to create builds for different operating systems, these steps must be done on each desired os.
The following commands will produce a build artifact in the `./dist` folder.
```
# note: ensure you're in the /package directory of this project
pip install -r requirements.txt
pyinstaller --onefile ../src/cadet.py
```

Просмотреть файл

@ -0,0 +1 @@
pyinstaller

6
package/requirements.txt Normal file
Просмотреть файл

@ -0,0 +1,6 @@
altgraph==0.16.1
future==0.17.1
macholib==1.11
pefile==2018.8.8
PyInstaller==3.4
pywin32-ctypes==0.2.0

0
src/__init__.py Normal file
Просмотреть файл

9
src/cadet.py Normal file
Просмотреть файл

@ -0,0 +1,9 @@
import click
@click.version_option('1.0.0')
@click.group()
def cadet():
pass
if __name__ == '__main__':
cadet()

Просмотреть файл

@ -0,0 +1,3 @@
pylint
pytest
click

21
src/requirements.txt Normal file
Просмотреть файл

@ -0,0 +1,21 @@
altgraph==0.16.1
astroid==2.1.0
atomicwrites==1.2.1
attrs==18.2.0
Click==7.0
colorama==0.4.1
future==0.17.1
isort==4.3.4
lazy-object-proxy==1.3.1
macholib==1.11
mccabe==0.6.1
more-itertools==5.0.0
pefile==2018.8.8
pluggy==0.8.0
py==1.7.0
PyInstaller==3.4
pylint==2.2.2
pytest==4.0.2
pywin32-ctypes==0.2.0
six==1.12.0
wrapt==1.10.11

0
src/test/__init__.py Normal file
Просмотреть файл

Просмотреть файл

@ -0,0 +1,9 @@
import click
from click.testing import CliRunner
from ..cadet import cadet
def test_version():
runner = CliRunner()
result = runner.invoke(cadet, ['--version'])
assert result.exit_code == 0
assert result.output == 'cadet, version 1.0.0\n'