-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Migrate to f-strings for the Python code #4136
Comments
I can work on this if no one is assigned |
I would like to take this one up if no one's assigned. |
@coldkillerr @NovusEdge Thanks! Sure, please feel free to pick up any file(s) you like! |
…rosoft#4136" This reverts commit 6f28bd1.
* Migrated to f-strings for .\.nuget\create_nuget.py #4136 * Migrate to f-strings for the Python code for docs/conf.py #4136 * add missing whitespace at ./docs/conf.py:79:14 * Revert "add missing whitespace at ./docs/conf.py:79:14" This reverts commit 6020084. * Revert "Migrate to f-strings for the Python code for docs/conf.py #4136" This reverts commit 6f28bd1. * added the requested changes in .nuget/create_nuget.py * added the requested changes * Update .nuget/create_nuget.py Co-authored-by: Nikita Titov <nekit94-08@mail.ru> * Update .nuget/create_nuget.py Co-authored-by: Nikita Titov <nekit94-08@mail.ru> * Update .nuget/create_nuget.py Co-authored-by: Nikita Titov <nekit94-08@mail.ru> Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
Hi may I please work on this? |
@akshitadixit yes please! We'd be grateful for the help. Please only submit pull requests for a single file, and please check the list of open pull requests at https://github.com/microsoft/LightGBM/pulls since there are a few related to this issue already open. |
Oh also, the code in |
Sure, I will keep all of this in mind. |
Hi, may i work on this issue ? |
Sure, thank you! Please only submit a pull request for one file at a time. |
Thank you so much @jameslamb |
Hey, please add a checkmark on the following files since they have no strings that need to be migrated:
|
ah yes you're right, thanks very much @akshitadixit ! |
Hello, can I contribute to this issue ?? |
Yes please! Thanks for the help @sagnik1511 |
Thanks, @jameslamb for letting me collaborate ! |
Hey, May I work on this file: .\examples\python-guide\advanced_example.py ? |
@sayantan1410 thanks for all your help! You can work on any file mentioned in this issue. |
Thank you !! |
Hey, can I contribute to this issue? |
Yes please, we'd be grateful for the help. |
Thanks, @jameslamb for letting me contribute ! |
Hey @jameslamb is there any other file that needs changing, I am unable to find any? Do we need to use regex with f-strings in .\helpers\check_dynamic_dependencies.py |
Thanks for looking! I agree that I updated the list in this issue's description:
Thanks so much for your help! We hope you'll contribute again in the future. |
Great, it was fun contributing! |
This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
Migrate all Python code from old-fashioned
format()
functions, formatting%
operators and simple concatenations (+
) to modernf-strings
(brief guide). They are known to be the fastest approach and also increase code readability.Source: https://cito.github.io/blog/f-strings/.
They are supported starting from Python 3.6 which is the oldest Python version LightGBM officially supports:
LightGBM/python-package/setup.py
Lines 374 to 378 in 9cab93a
If you're interested in contributing, you do not need to fix all files at once. Pull requests that address all replacements in one file are mostly welcomed!
Refer to #4137 for the example PR.
.\.ci\get_workflow_status.py
(https://github.com/microsoft/LightGBM/pull/4436/files#r663508231).\.nuget\create_nuget.py
([python] Migrated to f-strings for .\.nuget\create_nuget.py #4136 #4162).\docs\conf.py
([python] added f-strings to docs/conf.py #4147).\examples\python-guide\advanced_example.py
([python] Improving the syntax of the fstrings in the file: .\examples\python-guide\advanced_example.py #4386).\examples\python-guide\logistic_regression.py
([python-package] use f-strings for concatenation in examples/python-guide/logistic_regression.py #4356).\examples\python-guide\plot_example.py
([python-package] f-string format updated in plot_example.py #4421).\examples\python-guide\simple_example.py
([python] Improving the syntax ofprint
s insimple_example.py
andsklearn_example.py
#4396).\examples\python-guide\sklearn_example.py
([python] Improving the syntax ofprint
s insimple_example.py
andsklearn_example.py
#4396).\examples\python-guide\dask\binary-classification.py
.\examples\python-guide\dask\multiclass-classification.py
.\examples\python-guide\dask\prediction.py
.\examples\python-guide\dask\ranking.py
.\examples\python-guide\dask\regression.py
.\helpers\check_dynamic_dependencies.py
.\helpers\parameter_generator.py
([python] added f-strings to helpers/parameter_generator.py #4146).\python-package\setup.py
([python] added f-strings to python-package/setup.py #4145).\python-package\lightgbm\basic.py
([python] added f-string to python-package/lightgbm/basic.py #4143).\python-package\lightgbm\callback.py
([python] added f-string to python-package/lightgbm/callback.py #4142).\python-package\lightgbm\compat.py
.\python-package\lightgbm\dask.py
([python] added f-strings to python-package/lightgbm/dask.py #4144).\python-package\lightgbm\engine.py
([python] added f-strings to python-package/lightgbm/engine.py #4258).\python-package\lightgbm\libpath.py
([ci] use f-strings inlibpath.py
#4137).\python-package\lightgbm\plotting.py
(Migrate to f-strings in python-package\lightgbm\plotting.py (#4136) #4279).\python-package\lightgbm\sklearn.py
([python] Migrate to f-strings in python-package/lightgbm/sklearn.py #4188).\python-package\lightgbm\__init__.py
.\tests\cpp_test\test.py
.\tests\c_api_test\test_.py
(improved the string formatting syntax #4287).\tests\python_package_test\test_basic.py
([python] improving the syntax of the fstring in the file : tests/python_package_test/test_basic.py #4312).\tests\python_package_test\test_consistency.py
([python-package] updated test_consistency.py to use f-strings #4348).\tests\python_package_test\test_dask.py
([python] improving the syntax of the fstring in the file : tests/python_package_test/test_dask.py #4358).\tests\python_package_test\test_dual.py
.\tests\python_package_test\test_engine.py
([python-package] convert string concatenation to f-strings in test_engine.py (fixes #4136) #4436).\tests\python_package_test\test_plotting.py
(Updated tests/python_package_test/test_plotting.py to use f-strings #4359).\tests\python_package_test\test_sklearn.py
.\tests\python_package_test\test_utilities.py
.\tests\python_package_test\utils.py
.\tests\python_package_test\__init__.py
The text was updated successfully, but these errors were encountered: