cadet-cli/CONTRIBUTING.md

50 строки
2.4 KiB
Markdown
Исходник Постоянная ссылка Обычный вид История

# 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
Creates the `cadet import` command (#4) * Creates the starting point for the CLI tool. * Aligns the code to the Specs. * Adds a number of try-catch statements for better error-handling. * Removes a comment that was wrong (the raised error is hit). * Adds a docstring to the beginning of the file. * Updates the flags/options to match the portal's vocabulary, and corresponding variable names. Swaps out print() and puts in click.echo(). Adds in a try/catch for the document upsert * Changes how a click.echo message was formatted to use correct syntax. * Unifies which string quotation marks are used (now single instead of a mix); Adds new lines in exception messages for readability; Moves the source_size variable check inside of a try/catch so that if the source file provided doesn't exist, it fails gracefully. * Adds a check for the source file's extension being CSV or TSV and raising an exception if it's not. * Moves a comment and removes a bunch of blank lines. * Feature: Add CI and release pipeline (#3) * add azure-pipelines.yml * update? * add test step * drop travis * add badge * update contrib * pr validation, package on master * move condition for github * added a linting step via pylint before test * updated so that all stages lint and that the correct module is passed into linter * Removes the newline characters from the messages since it's clunky. * Adds a `required=True` on the collection name, database name, and type flags so that if any of them are missing, then it should fail. The connection flags have separate fail-safes in place so they don't need the `required=True`. * Pulls out some functionality into separate functions for easier testing; adds function descriptions for those new functions; fixes a connection typo. * Corrects unnecessary white space at the end of a few lines. * Cleans up from pylint suggestions. * Updates a function comment * Add initial tests and test files (#5) * Add initial tests and test files * Add newline * Import mock * Add test import * Add testing, remove test cases that rely on auth response * Add connection string parsing and test * Remove extra line, and unused import statement * Modify tests and test file * Remove optionality of arguments * Add comments on test * Mock on upsertedDocs * Rewrite test mocking * Remove print statement * Add comment to describe test * Fix spacing, typo * Creates the starting point for the CLI tool. * Aligns the code to the Specs. * Adds a number of try-catch statements for better error-handling. * Removes a comment that was wrong (the raised error is hit). * Updates the flags/options to match the portal's vocabulary, and corresponding variable names. Swaps out print() and puts in click.echo(). Adds in a try/catch for the document upsert * Changes how a click.echo message was formatted to use correct syntax. * Adds a docstring to the beginning of the file. * Unifies which string quotation marks are used (now single instead of a mix); Adds new lines in exception messages for readability; Moves the source_size variable check inside of a try/catch so that if the source file provided doesn't exist, it fails gracefully. * Adds a check for the source file's extension being CSV or TSV and raising an exception if it's not. * Moves a comment and removes a bunch of blank lines. * Removes the newline characters from the messages since it's clunky. * Adds a `required=True` on the collection name, database name, and type flags so that if any of them are missing, then it should fail. The connection flags have separate fail-safes in place so they don't need the `required=True`. * Pulls out some functionality into separate functions for easier testing; adds function descriptions for those new functions; fixes a connection typo. * Corrects unnecessary white space at the end of a few lines. * Cleans up from pylint suggestions. * Updates a function comment * Add initial tests and test files (#5) * Add initial tests and test files * Add newline * Import mock * Add test import * Add testing, remove test cases that rely on auth response * Add connection string parsing and test * Remove extra line, and unused import statement * Modify tests and test file * Remove optionality of arguments * Add comments on test * Mock on upsertedDocs * Rewrite test mocking * Remove print statement * Add comment to describe test * Fix spacing, typo * Moves things from my previous branch into the style from master. Updates the CONTRIBUTING and README docs. * The first(-ish) pass of the linting/reorganizing. * Updates some dependencies. * Updates the Azure pipelines to run `pip3` since we require Python 3. * Changes to pipeline to see if pylint and pytest. * Separates the installing of required modules from the actual testing. Is there a synchronous issue? * Makes the change to the Windows build since that is where the failure is happening. * Removes a broken requirement that was possibly introduced. * Feature/linting tests (#6) * Add docstrings, remove instances of 'self' on classes * Fix file importation and reading * Re-add 'connection-string' * Add conditional, to allow users to type in source_path * Change variable names, edit tests * Consistency on click options * Feature/add description to pylint ignore (#7) * Fix typo * Add descriptive pylint ignore message * Update test_cadet.py * Updates the contributing docs to include a note about a known bug. * Splits up the installing and testing for the linux build..
2019-01-29 23:21:42 +03:00
+ Install [python >= 3.6.0](https://www.python.org/downloads/)
+ Ensure you have python 3.x's installer `pip3`
+ For the Ubuntu distribution 16.04+, the command should be `sudo apt-get install python3-pip`
+ (_Recommended_) Get familiar with Python's [`venv`](https://docs.python.org/3/tutorial/venv.html) or [`virtualenv`](https://virtualenv.pypa.io/en/latest/)
+ This allows for compartmentalizing any development work
+ `pip3 install -r src/requirements.txt`
+ Ready to code and run
## Testing
> Note: Ensure you've first completed the [Getting started](#getting-started) steps!
Creates the `cadet import` command (#4) * Creates the starting point for the CLI tool. * Aligns the code to the Specs. * Adds a number of try-catch statements for better error-handling. * Removes a comment that was wrong (the raised error is hit). * Adds a docstring to the beginning of the file. * Updates the flags/options to match the portal's vocabulary, and corresponding variable names. Swaps out print() and puts in click.echo(). Adds in a try/catch for the document upsert * Changes how a click.echo message was formatted to use correct syntax. * Unifies which string quotation marks are used (now single instead of a mix); Adds new lines in exception messages for readability; Moves the source_size variable check inside of a try/catch so that if the source file provided doesn't exist, it fails gracefully. * Adds a check for the source file's extension being CSV or TSV and raising an exception if it's not. * Moves a comment and removes a bunch of blank lines. * Feature: Add CI and release pipeline (#3) * add azure-pipelines.yml * update? * add test step * drop travis * add badge * update contrib * pr validation, package on master * move condition for github * added a linting step via pylint before test * updated so that all stages lint and that the correct module is passed into linter * Removes the newline characters from the messages since it's clunky. * Adds a `required=True` on the collection name, database name, and type flags so that if any of them are missing, then it should fail. The connection flags have separate fail-safes in place so they don't need the `required=True`. * Pulls out some functionality into separate functions for easier testing; adds function descriptions for those new functions; fixes a connection typo. * Corrects unnecessary white space at the end of a few lines. * Cleans up from pylint suggestions. * Updates a function comment * Add initial tests and test files (#5) * Add initial tests and test files * Add newline * Import mock * Add test import * Add testing, remove test cases that rely on auth response * Add connection string parsing and test * Remove extra line, and unused import statement * Modify tests and test file * Remove optionality of arguments * Add comments on test * Mock on upsertedDocs * Rewrite test mocking * Remove print statement * Add comment to describe test * Fix spacing, typo * Creates the starting point for the CLI tool. * Aligns the code to the Specs. * Adds a number of try-catch statements for better error-handling. * Removes a comment that was wrong (the raised error is hit). * Updates the flags/options to match the portal's vocabulary, and corresponding variable names. Swaps out print() and puts in click.echo(). Adds in a try/catch for the document upsert * Changes how a click.echo message was formatted to use correct syntax. * Adds a docstring to the beginning of the file. * Unifies which string quotation marks are used (now single instead of a mix); Adds new lines in exception messages for readability; Moves the source_size variable check inside of a try/catch so that if the source file provided doesn't exist, it fails gracefully. * Adds a check for the source file's extension being CSV or TSV and raising an exception if it's not. * Moves a comment and removes a bunch of blank lines. * Removes the newline characters from the messages since it's clunky. * Adds a `required=True` on the collection name, database name, and type flags so that if any of them are missing, then it should fail. The connection flags have separate fail-safes in place so they don't need the `required=True`. * Pulls out some functionality into separate functions for easier testing; adds function descriptions for those new functions; fixes a connection typo. * Corrects unnecessary white space at the end of a few lines. * Cleans up from pylint suggestions. * Updates a function comment * Add initial tests and test files (#5) * Add initial tests and test files * Add newline * Import mock * Add test import * Add testing, remove test cases that rely on auth response * Add connection string parsing and test * Remove extra line, and unused import statement * Modify tests and test file * Remove optionality of arguments * Add comments on test * Mock on upsertedDocs * Rewrite test mocking * Remove print statement * Add comment to describe test * Fix spacing, typo * Moves things from my previous branch into the style from master. Updates the CONTRIBUTING and README docs. * The first(-ish) pass of the linting/reorganizing. * Updates some dependencies. * Updates the Azure pipelines to run `pip3` since we require Python 3. * Changes to pipeline to see if pylint and pytest. * Separates the installing of required modules from the actual testing. Is there a synchronous issue? * Makes the change to the Windows build since that is where the failure is happening. * Removes a broken requirement that was possibly introduced. * Feature/linting tests (#6) * Add docstrings, remove instances of 'self' on classes * Fix file importation and reading * Re-add 'connection-string' * Add conditional, to allow users to type in source_path * Change variable names, edit tests * Consistency on click options * Feature/add description to pylint ignore (#7) * Fix typo * Add descriptive pylint ignore message * Update test_cadet.py * Updates the contributing docs to include a note about a known bug. * Splits up the installing and testing for the linux build..
2019-01-29 23:21:42 +03:00
+ `python3 -m pytest src/test/`
## 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`
Creates the `cadet import` command (#4) * Creates the starting point for the CLI tool. * Aligns the code to the Specs. * Adds a number of try-catch statements for better error-handling. * Removes a comment that was wrong (the raised error is hit). * Adds a docstring to the beginning of the file. * Updates the flags/options to match the portal's vocabulary, and corresponding variable names. Swaps out print() and puts in click.echo(). Adds in a try/catch for the document upsert * Changes how a click.echo message was formatted to use correct syntax. * Unifies which string quotation marks are used (now single instead of a mix); Adds new lines in exception messages for readability; Moves the source_size variable check inside of a try/catch so that if the source file provided doesn't exist, it fails gracefully. * Adds a check for the source file's extension being CSV or TSV and raising an exception if it's not. * Moves a comment and removes a bunch of blank lines. * Feature: Add CI and release pipeline (#3) * add azure-pipelines.yml * update? * add test step * drop travis * add badge * update contrib * pr validation, package on master * move condition for github * added a linting step via pylint before test * updated so that all stages lint and that the correct module is passed into linter * Removes the newline characters from the messages since it's clunky. * Adds a `required=True` on the collection name, database name, and type flags so that if any of them are missing, then it should fail. The connection flags have separate fail-safes in place so they don't need the `required=True`. * Pulls out some functionality into separate functions for easier testing; adds function descriptions for those new functions; fixes a connection typo. * Corrects unnecessary white space at the end of a few lines. * Cleans up from pylint suggestions. * Updates a function comment * Add initial tests and test files (#5) * Add initial tests and test files * Add newline * Import mock * Add test import * Add testing, remove test cases that rely on auth response * Add connection string parsing and test * Remove extra line, and unused import statement * Modify tests and test file * Remove optionality of arguments * Add comments on test * Mock on upsertedDocs * Rewrite test mocking * Remove print statement * Add comment to describe test * Fix spacing, typo * Creates the starting point for the CLI tool. * Aligns the code to the Specs. * Adds a number of try-catch statements for better error-handling. * Removes a comment that was wrong (the raised error is hit). * Updates the flags/options to match the portal's vocabulary, and corresponding variable names. Swaps out print() and puts in click.echo(). Adds in a try/catch for the document upsert * Changes how a click.echo message was formatted to use correct syntax. * Adds a docstring to the beginning of the file. * Unifies which string quotation marks are used (now single instead of a mix); Adds new lines in exception messages for readability; Moves the source_size variable check inside of a try/catch so that if the source file provided doesn't exist, it fails gracefully. * Adds a check for the source file's extension being CSV or TSV and raising an exception if it's not. * Moves a comment and removes a bunch of blank lines. * Removes the newline characters from the messages since it's clunky. * Adds a `required=True` on the collection name, database name, and type flags so that if any of them are missing, then it should fail. The connection flags have separate fail-safes in place so they don't need the `required=True`. * Pulls out some functionality into separate functions for easier testing; adds function descriptions for those new functions; fixes a connection typo. * Corrects unnecessary white space at the end of a few lines. * Cleans up from pylint suggestions. * Updates a function comment * Add initial tests and test files (#5) * Add initial tests and test files * Add newline * Import mock * Add test import * Add testing, remove test cases that rely on auth response * Add connection string parsing and test * Remove extra line, and unused import statement * Modify tests and test file * Remove optionality of arguments * Add comments on test * Mock on upsertedDocs * Rewrite test mocking * Remove print statement * Add comment to describe test * Fix spacing, typo * Moves things from my previous branch into the style from master. Updates the CONTRIBUTING and README docs. * The first(-ish) pass of the linting/reorganizing. * Updates some dependencies. * Updates the Azure pipelines to run `pip3` since we require Python 3. * Changes to pipeline to see if pylint and pytest. * Separates the installing of required modules from the actual testing. Is there a synchronous issue? * Makes the change to the Windows build since that is where the failure is happening. * Removes a broken requirement that was possibly introduced. * Feature/linting tests (#6) * Add docstrings, remove instances of 'self' on classes * Fix file importation and reading * Re-add 'connection-string' * Add conditional, to allow users to type in source_path * Change variable names, edit tests * Consistency on click options * Feature/add description to pylint ignore (#7) * Fix typo * Add descriptive pylint ignore message * Update test_cadet.py * Updates the contributing docs to include a note about a known bug. * Splits up the installing and testing for the linux build..
2019-01-29 23:21:42 +03:00
+ Gotcha: Beware, there is a [known bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=871790) where a package `pkg-resources==0.0.0` gets added if you have a virtual environment running. **Remove this line before pushing it to any pipeline.**
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`
## Packaging
Creates the `cadet import` command (#4) * Creates the starting point for the CLI tool. * Aligns the code to the Specs. * Adds a number of try-catch statements for better error-handling. * Removes a comment that was wrong (the raised error is hit). * Adds a docstring to the beginning of the file. * Updates the flags/options to match the portal's vocabulary, and corresponding variable names. Swaps out print() and puts in click.echo(). Adds in a try/catch for the document upsert * Changes how a click.echo message was formatted to use correct syntax. * Unifies which string quotation marks are used (now single instead of a mix); Adds new lines in exception messages for readability; Moves the source_size variable check inside of a try/catch so that if the source file provided doesn't exist, it fails gracefully. * Adds a check for the source file's extension being CSV or TSV and raising an exception if it's not. * Moves a comment and removes a bunch of blank lines. * Feature: Add CI and release pipeline (#3) * add azure-pipelines.yml * update? * add test step * drop travis * add badge * update contrib * pr validation, package on master * move condition for github * added a linting step via pylint before test * updated so that all stages lint and that the correct module is passed into linter * Removes the newline characters from the messages since it's clunky. * Adds a `required=True` on the collection name, database name, and type flags so that if any of them are missing, then it should fail. The connection flags have separate fail-safes in place so they don't need the `required=True`. * Pulls out some functionality into separate functions for easier testing; adds function descriptions for those new functions; fixes a connection typo. * Corrects unnecessary white space at the end of a few lines. * Cleans up from pylint suggestions. * Updates a function comment * Add initial tests and test files (#5) * Add initial tests and test files * Add newline * Import mock * Add test import * Add testing, remove test cases that rely on auth response * Add connection string parsing and test * Remove extra line, and unused import statement * Modify tests and test file * Remove optionality of arguments * Add comments on test * Mock on upsertedDocs * Rewrite test mocking * Remove print statement * Add comment to describe test * Fix spacing, typo * Creates the starting point for the CLI tool. * Aligns the code to the Specs. * Adds a number of try-catch statements for better error-handling. * Removes a comment that was wrong (the raised error is hit). * Updates the flags/options to match the portal's vocabulary, and corresponding variable names. Swaps out print() and puts in click.echo(). Adds in a try/catch for the document upsert * Changes how a click.echo message was formatted to use correct syntax. * Adds a docstring to the beginning of the file. * Unifies which string quotation marks are used (now single instead of a mix); Adds new lines in exception messages for readability; Moves the source_size variable check inside of a try/catch so that if the source file provided doesn't exist, it fails gracefully. * Adds a check for the source file's extension being CSV or TSV and raising an exception if it's not. * Moves a comment and removes a bunch of blank lines. * Removes the newline characters from the messages since it's clunky. * Adds a `required=True` on the collection name, database name, and type flags so that if any of them are missing, then it should fail. The connection flags have separate fail-safes in place so they don't need the `required=True`. * Pulls out some functionality into separate functions for easier testing; adds function descriptions for those new functions; fixes a connection typo. * Corrects unnecessary white space at the end of a few lines. * Cleans up from pylint suggestions. * Updates a function comment * Add initial tests and test files (#5) * Add initial tests and test files * Add newline * Import mock * Add test import * Add testing, remove test cases that rely on auth response * Add connection string parsing and test * Remove extra line, and unused import statement * Modify tests and test file * Remove optionality of arguments * Add comments on test * Mock on upsertedDocs * Rewrite test mocking * Remove print statement * Add comment to describe test * Fix spacing, typo * Moves things from my previous branch into the style from master. Updates the CONTRIBUTING and README docs. * The first(-ish) pass of the linting/reorganizing. * Updates some dependencies. * Updates the Azure pipelines to run `pip3` since we require Python 3. * Changes to pipeline to see if pylint and pytest. * Separates the installing of required modules from the actual testing. Is there a synchronous issue? * Makes the change to the Windows build since that is where the failure is happening. * Removes a broken requirement that was possibly introduced. * Feature/linting tests (#6) * Add docstrings, remove instances of 'self' on classes * Fix file importation and reading * Re-add 'connection-string' * Add conditional, to allow users to type in source_path * Change variable names, edit tests * Consistency on click options * Feature/add description to pylint ignore (#7) * Fix typo * Add descriptive pylint ignore message * Update test_cadet.py * Updates the contributing docs to include a note about a known bug. * Splits up the installing and testing for the linux build..
2019-01-29 23:21:42 +03:00
To create production binaries (releases), see [package/README.md](./package/README.md).