contentful / contentful.py

Python client for the Contentful Content Delivery API https://www.contentful.com/developers/documentation/content-delivery-api/
MIT License
45 stars 41 forks source link

Python EOL Version Support #86

Open seandstewart opened 4 months ago

seandstewart commented 4 months ago

Hello, I see there is very little active maintenance here, I assume because this client is stable. However, I have a few concerns after reviewing the library:

  1. Python 2-3.7 are EOL - do you intend to maintain strict support for versions which are no longer maintained?
  2. Related to the above, the library is unable to provide type annotations because of supporting versions 2-3.6 of Python, so the developer experience is quite lacking.
  3. Also related, there is no asyncio support, so this library is dangerous to use on asyncio-native applications, since all requests are sync and you have implemented retry mechanisms using time.sleep - is asyncio support on your roadmap?

The implementation looks flexible enough that adding support for (2) and (3) would be possible, but that largely depends upon your vision regarding (1). I'm happy to help support a transition if it's something you're open to.

rubydog commented 4 months ago

Hi @seandstewart! Thanks for bringing that up. Just to confirm, we're fully supporting the current supported version for Python. I'll remove the EOL versions and add the new version to our test matrix next week.

I'll also circle back to you next week regarding asyncio support. Thanks for your patience!

seandstewart commented 4 months ago

@rubydog - glad to hear it! I've forked this repository and I'm looking into some adjustments to add in asyncio.

There are quite a few improvements you can take advantage of in newer python aside from asyncio, some highlights:

I think asyncio support is probably highest priority, at least for my company's needs - we're all-in on asyncio for our services and we already use Contentful as a CMS for frontend and some backend use-cases. I started looking into this library's IO implementation as part of an investigation into availability issues with one of our services which uses it.

seandstewart commented 4 months ago

@rubydog -

I've opened a draft MR (https://github.com/contentful/contentful.py/pull/87) which starts the work to support asyncio. I will make sure to update tests, but wanted to start garnering feedback.

seandstewart commented 4 months ago

@rubydog -

I referenced MR is ready for a review - I have added a test suite for the async client (largely copy-paste - room to dry the whole suite in the future) and all tests are passing in all python versions:

❯ make test-all
tox
.pkg: _optional_hooks> python /Users/seanstewart/PycharmProjects/contentful.py/venv/lib/python3.9/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_sdist> python /Users/seanstewart/PycharmProjects/contentful.py/venv/lib/python3.9/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_wheel> python /Users/seanstewart/PycharmProjects/contentful.py/venv/lib/python3.9/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: prepare_metadata_for_build_wheel> python /Users/seanstewart/PycharmProjects/contentful.py/venv/lib/python3.9/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: build_sdist> python /Users/seanstewart/PycharmProjects/contentful.py/venv/lib/python3.9/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
py38-flakes: install_package> python -I -m pip install --force-reinstall --no-deps /Users/seanstewart/PycharmProjects/contentful.py/.tox/.tmp/package/33/contentful-2.1.1.tar.gz
py38-flakes: commands[0]> python -m unittest discover tests
.................................................................................................................................................................
----------------------------------------------------------------------
Ran 161 tests in 0.819s

OK
py38-flakes: OK ✔ in 2.25 seconds
py39-flakes: install_package> python -I -m pip install --force-reinstall --no-deps /Users/seanstewart/PycharmProjects/contentful.py/.tox/.tmp/package/34/contentful-2.1.1.tar.gz
py39-flakes: commands[0]> python -m unittest discover tests
.................................................................................................................................................................
----------------------------------------------------------------------
Ran 161 tests in 0.415s

OK
py39-flakes: OK ✔ in 1.98 seconds
py310-flakes: install_package> python -I -m pip install --force-reinstall --no-deps /Users/seanstewart/PycharmProjects/contentful.py/.tox/.tmp/package/35/contentful-2.1.1.tar.gz
py310-flakes: commands[0]> python -m unittest discover tests
.................................................................................................................................................................
----------------------------------------------------------------------
Ran 161 tests in 0.431s

OK
py310-flakes: OK ✔ in 1.5 seconds
py311-flakes: install_package> python -I -m pip install --force-reinstall --no-deps /Users/seanstewart/PycharmProjects/contentful.py/.tox/.tmp/package/36/contentful-2.1.1.tar.gz
py311-flakes: commands[0]> python -m unittest discover tests
.................................................................................................................................................................
----------------------------------------------------------------------
Ran 161 tests in 0.355s

OK
py311-flakes: OK ✔ in 1.46 seconds
py312-flakes: install_package> python -I -m pip install --force-reinstall --no-deps /Users/seanstewart/PycharmProjects/contentful.py/.tox/.tmp/package/37/contentful-2.1.1.tar.gz
py312-flakes: commands[0]> python -m unittest discover tests
.................................................................................................................................................................
----------------------------------------------------------------------
Ran 161 tests in 0.304s

OK
py312-flakes: OK ✔ in 2.54 seconds
pypy3-flakes: install_package> python -I -m pip install --force-reinstall --no-deps /Users/seanstewart/PycharmProjects/contentful.py/.tox/.tmp/package/38/contentful-2.1.1.tar.gz
pypy3-flakes: commands[0]> python -m unittest discover tests
.............Executing <Task pending name='Task-25' coro=<IsolatedAsyncioTestCase._asyncioLoopRunner() running at /Users/seanstewart/.pyenv/versions/pypy3.10-7.3.13/lib/pypy3.10/unittest/async_case.py:101> created at /Users/seanstewart/.pyenv/versions/pypy3.10-7.3.13/lib/pypy3.10/unittest/async_case.py:117> took 0.129 seconds
....................................................................................................................................................
----------------------------------------------------------------------
Ran 161 tests in 1.303s

OK
.pkg: _exit> python /Users/seanstewart/PycharmProjects/contentful.py/venv/lib/python3.9/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
  py38-flakes: OK (2.25=setup[1.19]+cmd[1.05] seconds)
  py39-flakes: OK (1.98=setup[1.33]+cmd[0.65] seconds)
  py310-flakes: OK (1.50=setup[0.84]+cmd[0.67] seconds)
  py311-flakes: OK (1.46=setup[0.87]+cmd[0.59] seconds)
  py312-flakes: OK (2.54=setup[2.01]+cmd[0.53] seconds)
  pypy3-flakes: OK (3.26=setup[1.55]+cmd[1.71] seconds)
  congratulations :) (13.11 seconds)