Change min supported Python version #50

Closed
opened 2021-11-20 11:25:11 +00:00 by ungleich-gitea · 17 comments

Regarding https://code.ungleich.ch/ungleich-public/cdist/-/merge_requests/888
I have just tried running $ cdist -h with Python 3.2.6 and I see that preos implementation broke Python 3.2 support:

Traceback (most recent call last):
  File "scripts/cdist", line 27, in <module>
    import cdist.argparse
  File "/usr/home/darko/ungleich/upstream/cdist/cdist/argparse.py", line 9, in <module>
    import cdist.preos
  File "/usr/home/darko/ungleich/upstream/cdist/cdist/preos.py", line 46
    yield from preos_plugin(module)
             ^
SyntaxError: invalid syntax

And nobody is complaining :)

yield from is added in 3.3.

@nico @steven I would go with min 3.5, and simplify current state of https://code.ungleich.ch/ungleich-public/cdist/-/merge_requests/888 so that we don't have version check for log server.

Regarding https://code.ungleich.ch/ungleich-public/cdist/-/merge_requests/888 I have just tried running `$ cdist -h` with Python 3.2.6 and I see that `preos` implementation broke `Python 3.2` support: ``` Traceback (most recent call last): File "scripts/cdist", line 27, in <module> import cdist.argparse File "/usr/home/darko/ungleich/upstream/cdist/cdist/argparse.py", line 9, in <module> import cdist.preos File "/usr/home/darko/ungleich/upstream/cdist/cdist/preos.py", line 46 yield from preos_plugin(module) ^ SyntaxError: invalid syntax ``` And nobody is complaining :) `yield from` is added in `3.3`. @nico @steven I would go with min 3.5, and simplify current state of https://code.ungleich.ch/ungleich-public/cdist/-/merge_requests/888 so that we don't have version check for log server.
Author
Owner

closed

closed
Author
Owner
https://code.ungleich.ch/ungleich-public/cdist/-/commit/eec7ab8e4577008c6a48a473e295a9d1e31f2358
Author
Owner

Note that this affects only a system you are running cdist on, not the hosts you are configuring, cdist target hosts do not require python at all.
https://www.cdi.st/cdist-install.html#requirements

Note that this affects only a system you are running cdist on, not the hosts you are configuring, cdist target hosts do not require python at all. https://www.cdi.st/cdist-install.html#requirements
Author
Owner

It is decided.

Min python version is going to be bumped to 3.5.

@ssrq Jessie's end of life is here.
https://wiki.debian.org/LTS/Jessie.

It is decided. Min python version is going to be bumped to **3.5**. @ssrq Jessie's end of life is here. https://wiki.debian.org/LTS/Jessie.
Author
Owner

mentioned in merge request !890

mentioned in merge request !890
Author
Owner

@ssrq For now, we will not bump min required version. At least not until both cdist BDFLs give a green light :)

@ssrq For now, we will not bump min required version. At least not until both cdist BDFLs give a green light :)
Author
Owner

I can push these upstream if someone is interested:

[21:54:25] eos:.cdist-hpc% la type/ | grep pyenv
drwxr-xr-x   3 sar sar   5 May 22  2018 __pyenv
drwxr-xr-x   4 sar sar   7 Feb 17 21:45 __pyenv_python
drwxr-xr-x   4 sar sar   7 May 22  2018 __pyenv_virtualenv
[21:54:25] eos:.cdist-hpc% 
I can push these upstream if someone is interested: ``` [21:54:25] eos:.cdist-hpc% la type/ | grep pyenv drwxr-xr-x 3 sar sar 5 May 22 2018 __pyenv drwxr-xr-x 4 sar sar 7 Feb 17 21:45 __pyenv_python drwxr-xr-x 4 sar sar 7 May 22 2018 __pyenv_virtualenv [21:54:25] eos:.cdist-hpc% ```
Author
Owner

@poljakowski OK, I see. So it seems that Python 3.2 is not used anymore.

Could we bump the minimum requirement to 3.4 instead of 3.5?
I still have Debian jessie systems around (one of them being the machine that contains my collection of VMs that I use to test my cdist types.)

@poljakowski OK, I see. So it seems that Python 3.2 is not used anymore. Could we bump the minimum requirement to 3.4 instead of 3.5? I still have Debian jessie systems around (one of them being the machine that contains my collection of VMs that I use to test my cdist types.)
Author
Owner

It seems it was a woman :) Grace Hopper.

https://en.wikiquote.org/wiki/Grace_Hopper

@steven So if I get you right, we should just do it. :)

It seems it was a woman :) Grace Hopper. https://en.wikiquote.org/wiki/Grace_Hopper @steven So if I get you right, we should just do it. :)
Author
Owner

A wise man once said: Better ask forgiveness then permission.

A wise man once said: Better ask forgiveness then permission.
Author
Owner

Is it worth to go deeper and deeper?

Nobody is complaining since 2017. when DEVNULL is introduced :)

Is it worth to go deeper and deeper? Nobody is complaining since 2017. when DEVNULL is introduced :)
Author
Owner

We are also using subprocess.DEVNULL which is introduced in 3.3.

I wonder what else.

We are also using `subprocess.DEVNULL` which is introduced in `3.3`. I wonder what else.
Author
Owner

Hm... yield from is actually used in more places :)

$ find . -type f -name "*py" -exec grep 'yield from' {} +
./cdist/config.py:            yield from cdist.hostsource.HostSource(source)()
./cdist/hostsource.py:            yield from self._hosts_from_file()
./cdist/hostsource.py:            yield from self._hosts_from_sequence()
./cdist/hostsource.py:        yield from self.hosts()
./cdist/preos.py:            yield from preos_plugin(module)
./cdist/preos.py:                yield from preos_plugin(c)
./cdist/preos.py:        yield from scan_preos_dir_plugins(dir)

We can fix those though.

Hm... `yield from` is actually used in more places :) ``` $ find . -type f -name "*py" -exec grep 'yield from' {} + ./cdist/config.py: yield from cdist.hostsource.HostSource(source)() ./cdist/hostsource.py: yield from self._hosts_from_file() ./cdist/hostsource.py: yield from self._hosts_from_sequence() ./cdist/hostsource.py: yield from self.hosts() ./cdist/preos.py: yield from preos_plugin(module) ./cdist/preos.py: yield from preos_plugin(c) ./cdist/preos.py: yield from scan_preos_dir_plugins(dir) ``` We can fix those though.
Author
Owner

If it can be fixed with a one line change, why not?
If more changes are required, this can be discussed, IMO.

If it can be fixed with a one line change, why not? If more changes are required, this can be discussed, IMO.
Author
Owner

I know, but I am not sure if it's worth it to keep supporting old Python versions.

I know, but I am not sure if it's worth it to keep supporting old Python versions.
Author
Owner

This issue could easily be fixed (cf. also PEP 380):

for plugin in preos_plugin(module):
    yield plugin
This issue could easily be fixed (cf. also [PEP 380](https://www.python.org/dev/peps/pep-0380/)): ```python for plugin in preos_plugin(module): yield plugin ```
Author
Owner

as discussed already in chat - LGTM

as discussed already in chat - LGTM
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ungleich-public/cdist#50
No description provided.