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

fix: standardize requirements and fixes for marshmallow3+ #98

Merged
merged 6 commits into from
Mar 10, 2021

Conversation

dkunitsk
Copy link

Signed-off-by: Dmitriy Kunitskiy dkunitskiy@lyft.com

Summary of Changes

  • adds a **kwargs arg to decorated methods per marshmallow3 docs. This was blocking downstream adoption.
  • standardize requirements handling:
    • in packages, setup.py's install_requires are installed by pip and requirements.txt are for the repo's own functionality. Generally requirements.txt should not repeat the packages in setup.py. Have changed to follow this convention.
    • As of pip 18, dependency_links are NOT followed and the correct way to specify direct url dependencies is by putting them in install_requires using the repo @ git+url syntax. Pip19 even removed the --follow-dependency-links option.
    • Moment of weirdness: the way we install this package for testing with python setup.py install does not use pip, it uses setuptools+easy_install which is old school. Turns out that setuptools only knows how to use dependency_links and does not know the syntax above. So I believe the answer is to include marshmallow-annotations in BOTH dependency_links AND install_requires. The former will be for python3 install setup.py and the latter for consumers who install this package via pip. The other option is to change this line to run pip install .. But since python3 install setup.py is so ubiquitously encouraged in Amundsen-land I wanted this to continue working.

CheckList

Make sure you have checked all steps below to ensure a timely review.

  • PR title addresses the issue accurately and concisely. Example: "Updates the version of Flask to v1.0.2"
  • PR includes a summary of changes.

Signed-off-by: Dmitriy Kunitskiy <dkunitskiy@lyft.com>
Dmitriy Kunitskiy added 2 commits March 9, 2021 17:28
Signed-off-by: Dmitriy Kunitskiy <dkunitskiy@lyft.com>
Signed-off-by: Dmitriy Kunitskiy <dkunitskiy@lyft.com>
Copy link
Contributor

@dorianj dorianj left a comment

Choose a reason for hiding this comment

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

Generally LGTM.

Given that this package is guaranteed to only be used by other Amundsen projects, would it be reasonable to move the remaining dependencies to setup.py and get rid of requirements.txt?

@@ -10,4 +10,4 @@
# review when someone opens a pull request.
* @amundsen-io/amundsen-committers

*.py @feng-tao @jinhyukchang @allisonsuarez @dikshathakur3119 @verdan @bolkedebruin @mgorsk1
Copy link
Contributor

Choose a reason for hiding this comment

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

I know Diksha left Lyft, but she's still an Amundsen committer. She's welcome to remove herself if she no longer wants to be associated with the project, and we'll eventually remove any inactive maintainers, but I think this isn't needed quite yet (and should be done in a separate PR anyhow)

Copy link
Author

Choose a reason for hiding this comment

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

I don't believe she had intended to stay involved in the project, so the cleanup made sense. But I am happy to undo as well.

Copy link
Member

Choose a reason for hiding this comment

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

i think remove the name doesn't mean remove her to be a committer. And I don't agree with the term we'll eventually remove any inactive maintainers (not sure where it comes from). We made it explicit that only the committer could raise the request to not be a committer when we donated the project.

Copy link
Contributor

Choose a reason for hiding this comment

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

@feng-tao ah, you're right, I remembered there being a default demotion to emeritus status due to inactivity in the governance, but that doesn't exist.

@dkunitsk
Copy link
Author

Given that this package is guaranteed to only be used by other Amundsen projects, would it be reasonable to move the remaining dependencies to setup.py and get rid of requirements.txt?

It's not an accepted practice to include unused-by-the-package dependencies in setup.py. Given that what's left in reqs.txt is test-only dependencies, requirements.txt is the right place I believe.

feng-tao
feng-tao previously approved these changes Mar 10, 2021
@feng-tao
Copy link
Member

@dkunitsk CI fails with unit test error

Signed-off-by: Dmitriy Kunitskiy <dkunitskiy@lyft.com>
Signed-off-by: Dmitriy Kunitskiy <dkunitskiy@lyft.com>
def test(self) -> None:
with app.test_request_context(), patch.object(http_header_caller_retrieval, 'request') as mock_request:
with app.test_request_context(), \
Copy link
Author

Choose a reason for hiding this comment

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

I am very confused why this was working previously. patch.object returns an AsyncMock by default (see https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch) and that was not being used correctly.

@@ -12,4 +12,4 @@
class HttpHeaderCallerRetrieval(BaseCallerRetriever):
def get_caller(self) -> str:
header_key = flask_app.config.get(CALLER_HEADER_KEY, 'user-agent')
return request.headers.get(header_key, 'UNKNOWN')
return request.headers.get(header_key) or 'UNKNOWN'
Copy link
Author

Choose a reason for hiding this comment

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

Possibly a change due to the minor Flask upgrade: headers is a Headers object (not a dict) and the old mypy annotation was broken.

Signed-off-by: Dmitriy Kunitskiy <dkunitskiy@lyft.com>
@@ -25,6 +25,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip3 install -r requirements.txt && pip3 install codecov
run: pip3 install -r requirements.txt && pip3 install codecov && pip install .
Copy link
Author

Choose a reason for hiding this comment

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

using pip anyway as python setup.py install leaves a build/ directory that makes mypy unhappy.

@dkunitsk
Copy link
Author

@feng-tao ready for another look and merge (assuming we agreed that cleaning up code owners made sense? i can revert that if not)

@feng-tao feng-tao merged commit d185046 into amundsen-io:master Mar 10, 2021
dorianj added a commit to amundsen-io/amundsenmetadatalibrary that referenced this pull request Mar 16, 2021
Removal per amundsen-io/amundsencommon#98 (comment)

Signed-off-by: Dorian Johnson <2020@dorianj.net>
dorianj added a commit to amundsen-io/amundsenmetadatalibrary that referenced this pull request Mar 16, 2021
Removal per amundsen-io/amundsencommon#98 (comment)

Signed-off-by: Dorian Johnson <2020@dorianj.net>
dorianj added a commit to dorianj/amundsen that referenced this pull request Apr 25, 2021
feng-tao pushed a commit to amundsen-io/amundsen that referenced this pull request May 7, 2021
Removal per amundsen-io/amundsencommon#98 (comment)

Signed-off-by: Dorian Johnson <2020@dorianj.net>
zacr pushed a commit to SaltIO/amundsen that referenced this pull request May 13, 2022
hansadriaans pushed a commit to DataChefHQ/amundsen that referenced this pull request Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants