-
Notifications
You must be signed in to change notification settings - Fork 69
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
Upgrade tested Python and Django versions #123
Conversation
f301744
to
59e6027
Compare
Alright, ready for review. @smithdc1 : If you have any time to check the workaround in |
Hi Adam 👋 -- yes happy to have a look at this in this morning. Just one initial comment, it seems that the |
#: Module version, as defined in PEP-0396. | ||
from pkg_resources import DistributionNotFound | ||
|
||
pkg_resources = __import__('pkg_resources') | ||
try: | ||
distribution = pkg_resources.get_distribution('django-geojson') | ||
__version__ = distribution.version | ||
except (AttributeError, DistributionNotFound): | ||
__version__ = 'unknown' | ||
import warnings | ||
warnings.warn('No distribution found.') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using pkg_resources
causes a warning on the latest setuptools:
File "/.../django-geojson/djgeojson/__init__.py", line 2, in <module>
from pkg_resources import DistributionNotFound
File "/.../python3.10/site-packages/pkg_resources/__init__.py", line 102, in <module>
warnings.warn(
DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
That warning crashes the test suite thanks to the -W error::DeprecationWarning
option we’re using since 1761635.
I think removing the __version__
attribute is the most sensible approach. I’ve done this in all my packages. There’s now a standard API for retrieving a package version in the standard library, importlib.metadata.version()
.
co-authored-by: David Smith <smithdc@gmail.com>
59e6027
to
8ec70cc
Compare
Thanks, done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Adam
This looks good to me. It's interesting to see how this issue can be worked around!
It seems that SpatiaLite 5.1 fixed this issue so when that's more easily available the workaround can be removed. I'm guessing it's not worth the effort to try and install that in place of workaround in quicktest.py
now that this is working nicely.
@@ -680,9 +679,9 @@ def test_within_viewport(self): | |||
response = self.view.render_to_response(context={}) | |||
geojson = json.loads(smart_str(response.content)) | |||
self.assertEqual(len(geojson['features']), 2) | |||
self.assertAlmostEqual(geojson['features'][0]['geometry']['coordinates'][0], 6.843322039261242) | |||
self.assertAlmostEqual(geojson['features'][0]['geometry']['coordinates'][0], 6.843321961076886) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think proj / gdal introduced some calculation changes at some point. In my testing with spatialite==5.0
I saw this.
AssertionError: 6.843322040120945 != 6.843321961076886 within 7 places (7.904405929792802e-08 difference)
@@ -69,6 +69,22 @@ def run_tests(self): | |||
|
|||
django.setup() | |||
|
|||
# Workaround for incompatibility between SQLite 3.36+ and SpatiaLite 5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Workaround for incompatibility between SQLite 3.36+ and SpatiaLite 5, | |
# Workaround for incompatibility between SQLite 3.36+ and SpatiaLite 5.0, |
I've not tested many version combinations but it seems that SpatiaLite 5.0 is the issue. The tests pass for me with SpatiaLite 5.1 and SQLite 3.45.2 (appreciate it is also a much more modern version of SQLite)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for testing. Yeah, I guess to update SpatiaLite, we would need to update the Ubuntu version on GitHub Actions, when 24.04 becomes available.
Are there any clear release notes for SpatiaLite 5.1? I found the site hard to navigate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any release notes either.
Thanks for the PR 👍 . I'll merge as soon as the CI finishes. |
This PR:
quicktest.py
.