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

NOTISSUES: Add kinesis tests, refactor doc and refactor code style #654

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

vir-mir
Copy link
Member

@vir-mir vir-mir commented Dec 15, 2018

  1. change in tests:
    • add kinesis tests
    • remove test_patches, dependency management through pyup-bot, this test prevents him
    • Improved make file, for testing locally or via AWS
  2. change in docs:
    • add kinesis summary and useful links
    • common format for message commit
    • common format for name branch
    • common format for file CHANGES.txt
    • added more input information in instructions for contributors
  3. refactor code style:
    • add isort
  4. change in examples:
    • add kinesis example
    • common format for a directory with examples
  5. change in requirements:
    • grouping dependencies in one directory for pyup-bot

@jettify review please

@codecov
Copy link

codecov bot commented Dec 15, 2018

Codecov Report

Merging #654 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #654      +/-   ##
==========================================
+ Coverage   93.89%   93.93%   +0.04%     
==========================================
  Files           9        9              
  Lines         557      561       +4     
==========================================
+ Hits          523      527       +4     
  Misses         34       34
Impacted Files Coverage Δ
aiobotocore/session.py 85% <ø> (ø) ⬆️
aiobotocore/client.py 95.06% <100%> (ø) ⬆️
aiobotocore/paginate.py 87.09% <100%> (+0.28%) ⬆️
aiobotocore/args.py 97.36% <100%> (ø) ⬆️
aiobotocore/endpoint.py 95.45% <100%> (+0.02%) ⬆️
aiobotocore/waiter.py 94.33% <100%> (+0.1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa81b07...d146732. Read the comment docs.

@thehesiod
Copy link
Collaborator

You cannot remove test patches, do you understand its purpose? If it fails it means a human needs to validate the upstream changes. There may be new feature support needed.

@vir-mir
Copy link
Member Author

vir-mir commented Dec 15, 2018

@thehesiod, Yes, I understand.
But this test does nothing useful, it just checks that the hash has not changed.
For this there are tests for the used functionality.
All versions of dependencies are freeze in requirements / *. To manage dependencies, use pyup-bot, in any case human intervention will be needed.

But now this test only hinders, for example #653 the result is that all the functionality is working, according to the tests. But due to the fact that the hash has not converged, we get fail https://travis-ci.com/aio-libs/aiobotocore/jobs/164023523

I do not understand why this is, if the functionality works. Even if the user receives an error, after the update, due to the fact that we have not covered all the tests, can use roll back the version and create issues.

@thehesiod
Copy link
Collaborator

that is not how releases work, we must try to guarantee that with each release we've done everything possible to ensure that the release works and behaves like the botocore equivalent. If aiobotocore were to accept turning off the patches I would start working from a fork. The patches ensure that if any changes are made to the botocore super classes a human will verify if any changes are necessary in aiobotocore. Without it we'll start to have failures creep in over time. Long term we have other strategies to remove this requirement. Please see the other open issues

@vir-mir
Copy link
Member Author

vir-mir commented Dec 16, 2018

Who should make the decision on updating super classes?
And doesn't it lead to the same situation?

@thehesiod
Copy link
Collaborator

The super classes are in botocore, we need to mirror their changes in aiobotocore. I think we need to expand the readme to explain this better. I'll try to write something up

@vir-mir
Copy link
Member Author

vir-mir commented Dec 16, 2018

@thehesiod but it is not. there is still a main class aiobotocore and aiohttp.

What classes should be in this test? I will return, but I think this is an extra measure to check.

@thehesiod
Copy link
Collaborator

@vir-mir Like I said, this is not a standard library, you cannot write unittests for functionality you do not know exists. A new botocore can add new functionality for which we have not added tests, and the patches test will catch this. Sorry I haven't had a chance to write this doc yet. Hopefully soon.

@vir-mir
Copy link
Member Author

vir-mir commented Jan 4, 2019

@thehesiod you look the changes, I returned the test

@thehesiod
Copy link
Collaborator

sorry for delay, finally updated the doc: https://github.com/aio-libs/aiobotocore/blob/master/CONTRIBUTING.rst @vir-mir let me know what you think

@thehesiod
Copy link
Collaborator

@vir-mir cool, I'll try to review this, I hope the new docs make sense, if you still think its wrong lets discuss here before this gets approved.


3. Make sure all tests passed

4. Make sure the coverage doesn't get worse.
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is enforced via the automated tests, do we need to state this? Also for 5, you can't just commit it, you need to open a PR and have it reviewed before you can commit.

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to say here. You can check the coverage before use pull request

Copy link
Collaborator

Choose a reason for hiding this comment

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

there is no reference for what the current coverage levels are, I think this is only checkable via the CI no?


.. code-block:: shell

$ cd aiobotocore
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think a better strategy going forward is using tox, so you can test against multiple python versions easily. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

Start to "tox" is good for "CI", for development it is desirable to check on the new version. Here I agree with Andrey in his report https://www.youtube.com/watch?v=7KgihdKTWY4

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry, I don't understand what you're trying to say? I don't understand russian either so that video doesn't help. Is that the aiohttp author by chance, asvetlov?

rm -rf build
rm -rf cover
rm -rf dist
@rm -rf `find . -name __pycache__`
Copy link
Collaborator

Choose a reason for hiding this comment

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

can just do all this via a git clean no?

Copy link
Member Author

Choose a reason for hiding this comment

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

I do not know removes git clone python pyc..., did not find something in google

Copy link
Collaborator

Choose a reason for hiding this comment

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

try git clean -fx, it should remove the need for this big list

aiobotocore/endpoint.py Outdated Show resolved Hide resolved
aiobotocore/endpoint.py Outdated Show resolved Hide resolved
CONTRIBUTING.rst Outdated Show resolved Hide resolved
CONTRIBUTING.rst Outdated Show resolved Hide resolved
@thehesiod
Copy link
Collaborator

first thank you for your submission! I know it's a lot of work putting something like this together and that it's taking awhile to get movement on this :) ok I've personally mostly reviewed it, could you update your description as things have changed and it has incomplete sentences (this test prevents him ...?). Also given the scope of this I think @jettify should review as well. Perhaps splitting it up into multiple PRs and this touches a lot of different areas. Lets get some consensus as I'm also just a contributor.

@vir-mir
Copy link
Member Author

vir-mir commented Jan 25, 2019

@thehesiod @jettify Thanks for the criticism, I answered all the questions. I will make another change.

Since I actively use this library in my work, I would like to help in its development, I hope we will work together.

@vir-mir
Copy link
Member Author

vir-mir commented Jan 25, 2019

sorry for delay, finally updated the doc: https://github.com/aio-libs/aiobotocore/blob/master/CONTRIBUTING.rst @vir-mir let me know what you think

@thehesiod Thx!
Now it became clear to me why this test is needed and what to do to remove it!

I would only add motivation before the description. in order to immerse in context before reading.
example

Hashes of Botocore Code (important)

We do not support all Botocore unit tests and so we decided to do the following.

Because of the way aiobotocore is implemented (see Background section), it is very tightly coupled with botocore
.......

@thehesiod
Copy link
Collaborator

re last cmt, feel free to update contributing in this PR

@vir-mir
Copy link
Member Author

vir-mir commented Jan 28, 2019

@thehesiod Hi.

I made changes according to the discussion.
For the convenience of code review, I broke into commits.

  • return back the format code for botocore (f975b6d)
  • removed doubtful instructions (d66cfe5)
  • removed instructions of naming format commit and branch (4fa418f)
  • edit instructions for changes in file CHANGES.txt (551900c)
  • sync master (fef885d)
  • edit notice of important specialty features in the library (bda83f1)
  • fix file CHANGES.txt after sync with the master (8880b38)

@thehesiod
Copy link
Collaborator

cool! I'll try to get to this review asap, if someone else didn't get to it before me


2. Make a change

3. Make sure all tests passed
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
3. Make sure all tests passed
3. Make sure all tests pass

* Name commit

If you set the date and version, it will be the last and will be released
Version must be raised in your last committee
Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI, I've created templates for logging new issues and PRs. Could you also in here update the template so the two match each other?

@@ -151,8 +149,8 @@ def paginate(self, **kwargs):
documented_paginator_cls = type(
paginator_class_name, (Paginator,), {'paginate': paginate})

operation_model = self._service_model.\
operation_model(actual_operation_name)
operation_model = self._service_model.operation_model(
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this change match the botocore impl?

response_dict, operation_model.output_shape)
response_dict,
operation_model.output_shape
)
Copy link
Collaborator

@thehesiod thehesiod Jan 31, 2019

Choose a reason for hiding this comment

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

do the above changes match the botocore impl?

btw, adding to steps should be, making sure overriden code matches formatting from botocore impl as well as file names

self._previous_next_token == self._next_token:

is_not_none = self._previous_next_token is not None
if is_not_none and self._previous_next_token == self._next_token:
Copy link
Collaborator

Choose a reason for hiding this comment

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

does these changes match botocore formatting?

from botocore.waiter import Waiter, WaiterError, logger, xform_name

# WaiterModel is required for client.py import
WaiterModel = import_module('botocore.waiter').WaiterModel
Copy link
Collaborator

Choose a reason for hiding this comment

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

why?

async with client('kinesis', loop, **kwargs) as kinesis:
shards = await get_shards(kinesis, stream_name, save_shards)
while True:
await asyncio.sleep(0.2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there not a waiter you can use instead of sleep?

@@ -0,0 +1,3 @@
aiohttp==3.3.2
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be open ended, it was before: aiohttp>=3.3.1

@@ -128,7 +129,7 @@

@pytest.mark.xfail(raises=NotImplementedError)
@pytest.mark.asyncio
async def test_result_key_iters(s3_client, bucket_name,):
async def test_result_key_iters(s3_client, bucket_name, ):
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think the extra comma at the end was a typo, mind removing?

@thehesiod
Copy link
Collaborator

ok added a few comments that need to be resolved, otherwise looks good

@terricain
Copy link
Collaborator

This hasn't been touched for over a year, is there anything of value we want to incorperate from this pr?


import botocore
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I understand what you're doing here, separating built-in modules from third party modules, I've been adding a comment before each section to make this clear in my code. Could you please do the same?

@@ -199,11 +200,24 @@ def sns_server():
@pytest.yield_fixture(scope="session")
def sqs_server():
host = "localhost"
port = 5004
port = get_free_tcp_port()
Copy link
Collaborator

Choose a reason for hiding this comment

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

if you merge from master I've fixed this

@thehesiod
Copy link
Collaborator

@terrycain ya there are new tests, normalizing of include ordering, more docs, etc. But there are still a lot of questionable changes, outdated changes, and other misc problems. Either @vir-mir should split out these changes into separate PRs or we start picking out ideas from this PR and giving credit.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Alexey Firsov seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@thehesiod
Copy link
Collaborator

a lot has changed :) can you please updated, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants