Skip to content

Conversation

anand2312
Copy link
Contributor

This PR changes the namespace from postgrest_py to postgrest.

Other changes:

  • Separate constants into their own file
  • Pass headers/params down the builders, instead of adding them directly to the session
  • Add more documentation/examples

We were earlier modifying session.headers/session.params for every
query. Instead of this we follow what postgrest-js does and add
headers and params as arguments to the query builders, and pass them
down the chain of builders, and finally pass it to the execute method.
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Apr 13, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 2.84%.

Quality metrics Before After Change
Complexity 0.41 ⭐ 0.00 ⭐ -0.41 👍
Method Length 23.78 ⭐ 22.91 ⭐ -0.87 👍
Working memory 4.66 ⭐ 3.81 ⭐ -0.85 👍
Quality 91.70% 94.54% 2.84% 👍
Other metrics Before After Change
Lines 1766 823 -943
Changed files Quality Before Quality After Quality Change
docs/conf.py 93.26% ⭐ 93.42% ⭐ 0.16% 👍
tests/_async/test_client.py 92.39% ⭐ 92.39% ⭐ 0.00%
tests/_async/test_filter_request_builder.py 97.78% ⭐ 97.33% ⭐ -0.45% 👎
tests/_async/test_query_request_builder.py 98.19% ⭐ 96.33% ⭐ -1.86% 👎
tests/_async/test_request_builder.py 93.99% ⭐ 94.09% ⭐ 0.10% 👍
tests/_sync/test_client.py 92.61% ⭐ 92.41% ⭐ -0.20% 👎
tests/_sync/test_filter_request_builder.py 97.78% ⭐ 97.33% ⭐ -0.45% 👎
tests/_sync/test_query_request_builder.py 98.19% ⭐ 96.33% ⭐ -1.86% 👎
tests/_sync/test_request_builder.py 93.99% ⭐ 94.09% ⭐ 0.10% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
tests/_async/test_request_builder.py request_response_with_data 0 ⭐ 31 ⭐ 10 😞 79.58% ⭐ Extract out complex expressions
tests/_sync/test_request_builder.py request_response_with_data 0 ⭐ 31 ⭐ 10 😞 79.58% ⭐ Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@codecov
Copy link

codecov bot commented Apr 13, 2022

Codecov Report

Merging #114 (d6d50f6) into master (c4fbd29) will increase coverage by 0.52%.
The diff coverage is 94.83%.

@@            Coverage Diff             @@
##           master     #114      +/-   ##
==========================================
+ Coverage   92.25%   92.78%   +0.52%     
==========================================
  Files          22       23       +1     
  Lines         930      942      +12     
==========================================
+ Hits          858      874      +16     
+ Misses         72       68       -4     
Impacted Files Coverage Δ
postgrest/_async/__init__.py 100.00% <ø> (ø)
postgrest/_sync/__init__.py 100.00% <ø> (ø)
postgrest/base_client.py 90.90% <ø> (ø)
postgrest/deprecated_client.py 88.88% <ø> (ø)
postgrest/deprecated_get_request_builder.py 87.50% <ø> (ø)
postgrest/exceptions.py 51.85% <ø> (ø)
postgrest/types.py 100.00% <ø> (ø)
postgrest/utils.py 93.33% <ø> (ø)
postgrest/_async/client.py 90.00% <75.00%> (ø)
postgrest/_sync/client.py 90.00% <75.00%> (ø)
... and 13 more

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 c4fbd29...d6d50f6. Read the comment docs.

@anand2312
Copy link
Contributor Author

If we make a release now, I think it should be v0.11.0

@anand2312 anand2312 requested review from dreinon and J0 April 15, 2022 03:43
Copy link
Contributor

@J0 J0 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for putting this together!

Copy link
Contributor

@dreinon dreinon left a comment

Choose a reason for hiding this comment

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

Awesome! Lgmt!

@J0 J0 merged commit 6493154 into master Apr 18, 2022
@anand2312 anand2312 deleted the namespace-change branch March 6, 2023 15:24
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