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

Drop support for Python versions 2.7 and 3.4 #1126

Merged
merged 22 commits into from
Apr 6, 2020

Conversation

biozz
Copy link
Contributor

@biozz biozz commented Mar 23, 2020

As discussed in #1124, we can start the process of dropping older python versions support.

Main changes are driven by following this article and include:

  • remove py3compat module
  • remove try/except imports which were necessary for Python 2
  • remove six imports and usage
  • cleanup setup.py
  • cleanup tox.ini

Other changes include:

  • remove Python 2 related import of ConfigParser and urlparse in circus/util.py
  • change to lambda sorting in circus/config.py
  • add Loader=yaml.FullLoader in yaml.load calls
  • add IS_WINDOWS skips for couple of tests
  • add __pycache__ removal in make clean command
  • remove coding line, because of PEP 3120

I also did a small test on Windows (inside VirtualBox), thats why there are couple of skipIf(IS_WINDOWS) in the changes. Unfortunately the tests are completely broken in Windows and I think proper fixing should be done separately.

Finally, I went through examples directory and tried starting several of those to make sure the changes didn't break anything.

@biozz biozz changed the title Drop support for Python versions 2.7 and 3.4 Drop support for Python versions 2.7 and 3.4 (part 1) Mar 23, 2020
@coveralls
Copy link

coveralls commented Mar 23, 2020

Coverage Status

Coverage increased (+0.9%) to 63.911% when pulling 48dadba on biozz:drop-py27-py34 into bfa2189 on circus-tent:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at ?% when pulling 8e128e7 on biozz:drop-py27-py34 into 422d64d on circus-tent:master.

@biozz biozz changed the title Drop support for Python versions 2.7 and 3.4 (part 1) Drop support for Python versions 2.7 and 3.4 Mar 29, 2020
@biozz biozz marked this pull request as ready for review March 29, 2020 11:58
circus/config.py Outdated Show resolved Hide resolved
Copy link
Contributor

@k4nar k4nar left a comment

Choose a reason for hiding this comment

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

This is a huge work, thank you!

nose-cov
coverage
gevent
circus-web
Copy link
Contributor

Choose a reason for hiding this comment

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

This means that tests using gevent or circus-web are now skipped. I think we should add a tox env with them. Also, papa tests seems to be skipped, I'm not sure why papa is not installed in tox.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added new env called extra both in tox and in travis, which includes all the extra packages (gevent, papa, circus-web). I also had to fix one test in circus/tests/test_circusd.py, which raised RuntimeError when sys.modules dict changed size during iteration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After giving it some more thoughts and looking back at the tox config I decided to merge extra and main configs, because they are practically the same. The only difference is 1 gevent-related test (test_daemonize). Do you think we should have an extra env just for that?

I also realized that with py27 env removed the coverage/coveralls setup broke, so I brought it back in 48dadba.

Copy link
Contributor

Choose a reason for hiding this comment

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

We might have had different envs to make sure that everything was working fine without gevent. But I'm ok with merging this for now, we'll see if it causes issues down the line.

biozz added 21 commits April 3, 2020 18:40
This is a first commit in the series of removal lower Python versions.
It includes:

- clean-up of tox config
- clean-up of travis config
- fix yaml warning when it is used without Loader
- fix isinstance calls
- remove PY2 conditional from py3compat
A lot of real world examples failed (even example1.ini) because of the
types misuse between bytes and str in streamer and other parts of the
package.

I reverted b and s methods as to_bytes and to_str respectively, keeping
the same signature.
- remove try/except imports
- remove leftover six imports (with relevatn changes in actual code)
- remove unused itertools imports
- coverage was not picking up by coveralls, because I removed the
  coverage package from deps while removing py27 config
- remove PYTHONHASHSEED variable, because it is not necessary in Python
  3
- remove extra env from travis config
Copy link
Contributor

@k4nar k4nar left a comment

Choose a reason for hiding this comment

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

Thanks for the great work! 🎉

@k4nar k4nar merged commit aa1bca9 into circus-tent:master Apr 6, 2020
@huydangg
Copy link

huydangg commented Jul 15, 2020

I am facing the problem when I set httpd is True.

Traceback (most recent call last):
File "", line 1, in
File "/data1/python38/lib/python3.8/site-packages/circusweb/circushttpd.py", line 17, in
from circusweb.util import AutoDiscovery, run_command
File "/data1/python38/lib/python3.8/site-packages/circusweb/util.py", line 12, in
from circusweb.session import get_controller
File "/data1/python38/lib/python3.8/site-packages/circusweb/session.py", line 1, in
from circusweb.controller import Controller
File "/data1/python38/lib/python3.8/site-packages/circusweb/controller.py", line 2, in
from circusweb.client import AsynchronousCircusClient
File "/data1/python38/lib/python3.8/site-packages/circusweb/client.py", line 9, in
from circus.py3compat import string_types
ModuleNotFoundError: No module named 'circus.py3compat'`

This is relate to "remove py3compat module"?

Thanks.

@biozz
Copy link
Contributor Author

biozz commented Jul 15, 2020

Yes, you are right. I completely forgot about circus-web, sorry. I will try to have a look at it as soon as possible. Thank you for reporting!

@biozz
Copy link
Contributor Author

biozz commented Jul 17, 2020

@huydangg I had a look on this issue and fixing this import is just the tip of the iceberg... We will have to make circus-web compatible with python3 as well as with the new versions of tornado. I will try to make it happen, but it is not trivial and might take quite some time. For now you can try using previous versions of circus/circus-web/tornado.

@huydangg
Copy link

@biozz Thank you for your support. I will try using previous version.

@biozz biozz added this to the 0.17 milestone Aug 6, 2020
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.

4 participants