Skip to content

Use pygeoif 1.0 - #136

Merged
cleder merged 9 commits into
cleder:python3from
MrNaif2018:feat/pygeoif-1.0
Oct 14, 2021
Merged

cleder merged 9 commits into
cleder:python3from
MrNaif2018:feat/pygeoif-1.0

Conversation

@MrNaif2018

@MrNaif2018 MrNaif2018 commented Oct 3, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #132

When migrating I was mostly relying on the tests suite which seems to be good enough to indentify things needed to change (from class constructors to class factories mostly)

EDIT: I think pep8 speaks is configured for wrong line length, as pyproject.toml uses line length of 88

I have edited pep8speaks config to use flake8 and configured line length. Unfortunately pep8speaks doesn't read pyproject.toml. If you want I can revert that change

About code quality: I don't think I can do something with that because the changes are minimal and it is not an actual worse quality change

Note that installing pygeoif doesn't work yet because it is in pre-release. You can review and accept this PR and it can wait till the release is done

Note: this doesn't work with shapely well
Many failures are like AttributeError: type object 'Polygon' has no attribute 'from_linear_rings'
Maybe only one provider should be supported? Which is more feature-complete? I see shapely has added bbox to __geo_interface of LineString and other objects too. Or what should I do? Create compat classes or something like so?

@pep8speaks

pep8speaks commented Oct 3, 2021 •

Copy link
Copy Markdown

Hello @MrNaif2018! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 1786:90: E501 line too long (100 > 89 characters)
Line 1800:90: E501 line too long (100 > 89 characters)
Line 1815:90: E501 line too long (100 > 89 characters)
Line 1819:90: E501 line too long (105 > 89 characters)
Line 1859:90: E501 line too long (100 > 89 characters)
Line 1863:90: E501 line too long (105 > 89 characters)
Line 1867:90: E501 line too long (100 > 89 characters)
Line 1888:90: E501 line too long (100 > 89 characters)

Comment last updated at 2021-10-13 20:53:41 UTC

@cleder
cleder changed the base branch from develop to python3 October 13, 2021 11:38
@cleder

cleder commented Oct 13, 2021 •

Copy link
Copy Markdown
Owner

Note: this doesn't work with shapely well

Many failures are like AttributeError: type object 'Polygon' has no attribute 'from_linear_rings'
Maybe only one provider should be supported? Which is more feature-complete? I see shapely has added bbox to __geo_interface of LineString and other objects too. Or what should I do? Create compat classes or something like so?

Yes please remove shapely for now.

Can you try making the version classifier in setup.py Development Status :: 3 - Alpha, maybe that solves the actions not running. Otherwise, hardcode the required version to the latest pygeoif beta

@cleder

cleder commented Oct 13, 2021

Copy link
Copy Markdown
Owner

BTW, can you run teyit (needs python 3.9) against the tests, there are some optimizations that can be made.

@codecov

codecov Bot commented Oct 13, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #136 (3549899) into python3 (628071d) will increase coverage by 0.24%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           python3     #136      +/-   ##
===========================================
+ Coverage    97.17%   97.42%   +0.24%     
===========================================
  Files            9        9              
  Lines         3081     3066      -15     
===========================================
- Hits          2994     2987       -7     
+ Misses          87       79       -8     

@MrNaif2018

Copy link
Copy Markdown
Contributor Author

@cleder I have added pygeoif via >=1.0b1 comparison, removed shapely and applied teyit. Should be good now

@sourcery-ai

sourcery-ai Bot commented Oct 13, 2021

Copy link
Copy Markdown
Contributor

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 0.98 ⭐ 0.96 ⭐ -0.02 👍
Method Length 67.54 🙂 66.67 🙂 -0.87 👍
Working memory 6.17 ⭐ 6.14 ⭐ -0.03 👍
Quality 77.60% ⭐ 77.86% ⭐ 0.26% 👍
Other metrics Before After Change
Lines 3029 3151 122
Changed files Quality Before Quality After Quality Change
setup.py 92.56% ⭐ 92.56% ⭐ 0.00%
examples/CreateKml.py % 71.67% 🙂 %
examples/ReadKml.py % 80.24% ⭐ %
examples/UsageExamples.py 93.60% ⭐ 93.60% ⭐ 0.00%
fastkml/geometry.py 68.75% 🙂 68.69% 🙂 -0.06% 👎
fastkml/gx.py 81.03% ⭐ 80.36% ⭐ -0.67% 👎
fastkml/test_main.py 78.58% ⭐ 78.94% ⭐ 0.36% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
fastkml/geometry.py Geometry._get_multigeometry 20 😞 219 ⛔ 11 😞 37.27% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
fastkml/test_main.py KmlFromStringTestCase.test_schema 0 ⭐ 311 ⛔ 8 🙂 57.13% 🙂 Try splitting into smaller methods
fastkml/geometry.py Geometry._get_geometry 4 ⭐ 129 😞 11 😞 59.41% 🙂 Try splitting into smaller methods. Extract out complex expressions
fastkml/test_main.py BuildKmlTestCase.test_untyped_extended_data 0 ⭐ 172 😞 10 😞 60.75% 🙂 Try splitting into smaller methods. Extract out complex expressions
fastkml/test_main.py BuildKmlTestCase.test_untyped_extended_data_nested 0 ⭐ 150 😞 10 😞 62.92% 🙂 Try splitting into smaller methods. 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!

@cleder
cleder merged commit d5f3e89 into cleder:python3 Oct 14, 2021
@MrNaif2018
MrNaif2018 deleted the feat/pygeoif-1.0 branch October 14, 2021 15:14
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.

3 participants