Conversation
|
Please remove the 3.6 badge from README. |
|
I found the following codes are related to this PR. "Optuna supports Python 3.6 or newer." in optuna/optuna/samplers/_qmc.py Lines 160 to 167 in 4bc3dfc optuna/optuna/trial/_frozen.py Lines 169 to 183 in 4bc3dfc |
|
@not522 Thanks for the good catch! Fixed. |
Please update this statement. |
Codecov Report
@@ Coverage Diff @@
## master #4150 +/- ##
==========================================
+ Coverage 90.03% 90.06% +0.03%
==========================================
Files 161 161
Lines 12690 12680 -10
==========================================
- Hits 11425 11420 -5
+ Misses 1265 1260 -5
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
toshihikoyanase
left a comment
There was a problem hiding this comment.
Thank you for your PR! The change will simplify CI, setup, and tests 👍
I have a question about FrozenTrial.
| else \ | ||
| pip install ${PIP_OPTIONS} -e '.[checking, document, integration]' -f https://download.pytorch.org/whl/torch_stable.html; \ | ||
| fi \ | ||
| pip install ${PIP_OPTIONS} -e '.[checking, document, integration]' -f https://download.pytorch.org/whl/torch_stable.html; \ |
There was a problem hiding this comment.
Good catch!
[Note] We could remove this line when we dropped Python 3.5 support actually.
| # TODO(hvy): Avoid casting to `OrderedDict` when Python 3.6 is no longer supported since | ||
| # order will be guaranteed. | ||
| search_space = OrderedDict(search_space) | ||
|
|
There was a problem hiding this comment.
👍
Changed in version 3.7: Dictionary order is guaranteed to be insertion order. This behavior was an implementation detail of CPython from 3.6.
https://docs.python.org/3.7/library/stdtypes.html?highlight=dict#dict
| params = {k: distributions[k].to_external_repr(p) for k, p in log["params"].items()} | ||
| if log["datetime_start"] is not None: | ||
| datetime_start = datetime_from_isoformat(log["datetime_start"]) | ||
| datetime_start = datetime.datetime.fromisoformat(log["datetime_start"]) |
There was a problem hiding this comment.
Caution This does not support parsing arbitrary ISO 8601 strings - it is only intended as the inverse operation of datetime.isoformat().
https://docs.python.org/3.10/library/datetime.html#datetime.datetime.fromisoformat
I confirmed that log["datetime_start"] and log["datetime_complete"] are formatted by the datetime.isoformat function.
e.g.,
optuna/optuna/storages/_journal/storage.py
Lines 184 to 207 in 10c3c08
| # Ordered list of fields required for `__repr__`, `__hash__` and dataframe creation. | ||
| # TODO(hvy): Remove this list in Python 3.7 as the order of `self.__dict__` is preserved. | ||
| _ordered_fields = [ | ||
| "number", | ||
| "_values", | ||
| "datetime_start", | ||
| "datetime_complete", | ||
| "params", | ||
| "_distributions", | ||
| "user_attrs", | ||
| "system_attrs", | ||
| "intermediate_values", | ||
| "_trial_id", | ||
| "state", | ||
| ] |
There was a problem hiding this comment.
Question: The keys of self.__dict__ will be as follows:
['_number', 'state', '_values', '_datetime_start', 'datetime_complete', '_params', '_user_attrs', '_system_attrs', 'intermediate_values', '_distributions', '_trial_id']We can see some differences:
- Some field including
number,params,user_attrsandsystem_attrswill be prefixed with_. - The order of fields is different. For example,
_valuesis the second item of_ordered_field, but it is the third one ofself.__dict__.
But, I don't think they affect users because of the following two reasons:
hashvalue will be changed, buthashvalues are different process by process originally. So, we cannot compare hash values of different processes even if we use the current master.- I confirmed that
trial_str = repr(trial)can be restored byeval(trial_str). - I also confirmed that dumped trial with
reprinmastercan be restored byevalin this PR.
What do you think of it?
There was a problem hiding this comment.
Thanks for the insightful review. Actually, the items and order of self.__dict__ and _ordered_field are different each other. But, as you confirmed,
I confirmed that trial_str = repr(trial) can be restored by eval(trial_str).
I also confirmed that dumped trial with repr in master can be restored by eval in this PR.
The impact of this change on users would be minimal. So, we can accept it.
There was a problem hiding this comment.
Thank you for your reply. That makes sense.

Motivation
The Python 3.6 is EOL and , recently, the latest official docker image of Ubuntu is 22.04, which does not support Python 3.6 anymore. We, the maintainers, have decided to drop Python 3.6 as we do not feel it is appropriate to continue to officially support it any longer. Future releases of Optuna will only be available for Python 3.7 or later. In addition, CI will not be testing with Python 3.6 at all; users who wish to continue using Python 3.6 will have to use versions of Optuna up to 3.0.3.
Description of the changes
setup.pyand CI.pytest.skip.