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

convert_path is not part of setuptools API and will be removed #1219

Closed
abravalheri opened this issue Apr 22, 2024 · 7 comments
Closed

convert_path is not part of setuptools API and will be removed #1219

abravalheri opened this issue Apr 22, 2024 · 7 comments

Comments

@abravalheri
Copy link

Importing setuptools.convert_path has been deprecated for almost 2 years and is about to be removed.

ck/ck/setup.py

Line 25 in baf3402

from setuptools import convert_path

from setuptools import find_packages, setup, convert_path

from setuptools import find_packages, setup, convert_path

In the past setuptools would import convert_path from one of its dependencies for internal use, but that is no longer true.

@gfursin
Copy link
Contributor

gfursin commented Apr 23, 2024

Hi

Thank you for noting that @abravalheri!

The CK framework is archived and we do not update it unless requested by users, but this deprecation influence our new CM framework here.

Do you know if there is an alternative from distutils? Should I do something like this code to import it (while keeping backward compatibility for older systems with setuptools)?

Thank you!

@abravalheri
Copy link
Author

abravalheri commented Apr 23, 2024

Do you know if there is an alternative from distutils? Should I do something like this code to import it (while keeping backward compatibility for older systems with setuptools)?

Hi @gfursin, I find that convert_path is usually not essential for implementing the common functionality.

This is the description of the function:

   """Return 'pathname' as a name that will work on the native filesystem,
   i.e. split it on '/' and put it back together again using the current
   directory separator.  Needed because filenames in the setup script are
   always supplied in Unix style, and have to be converted to the local
   convention before we can actually use them in the filesystem.  Raises
   ValueError on non-Unix-ish systems if 'pathname' either starts or
   ends with a slash.
   """

But most of the Python functions nowadays already allow you to use / for paths even on windows...

Other than that, the function also raises an error if the path is absolute or if it ends in /, but that is easily implementable with os.path.isabs and str.rstrip if needed... Finally, if normalisation is needed you can go with os.path.normpath.

@abravalheri
Copy link
Author

I see that in this particular setup.py what is being used is something like:

long_description=open(convert_path('./README.md'),
                          encoding="utf-8").read(),

which probably will work just fine if you replace
convert_path('./README.md') => "README.md"

@gfursin
Copy link
Contributor

gfursin commented Apr 23, 2024

Cool! Thank you for the update. Let me check it this week!

gfursin added a commit that referenced this issue Apr 23, 2024
…automations and entries

- removed outdated convert_path (#1219)
@gfursin
Copy link
Contributor

gfursin commented Apr 23, 2024

I removed convert_path from the CM framework.

Are you using CK framework? If not, I prefer not to touch it until it really fails in the future ;) ...

@abravalheri
Copy link
Author

Hi @gfursin, thank you for taking a look on this.

No, I am not working with CK. I am working on removing deprecated parts from setuptools.

ctuning-admin added a commit that referenced this issue Apr 23, 2024
CM v2.2.0 release:
- fixed detection of a CM artifact using 'cm info .' when inside virtual
env entries.
- added "cmind.utils.debug_here" function to attach remote Python
debugger
     and tested with Visual Studio Code.
   - added test to avoid checking out CM repo that was not pulled
- added utils.safe_load_json to return empty dict if file doesn't exist
- added utils.compare_versions to check min version requirements for
automations and entries
- removed outdated convert_path
(#1219)
- added utils.check_if_true_yes_on
(#1216)
- check "min_cm_version" in CM automations and CM scripts (use _cm.yaml
or _cm.json)
gfursin added a commit that referenced this issue Apr 23, 2024
CM v2.2.0 release:
- fixed detection of a CM artifact using 'cm info .' when inside virtual
env entries.
- added "cmind.utils.debug_here" function to attach remote Python
debugger
     and tested with Visual Studio Code.
   - added test to avoid checking out CM repo that was not pulled
- added utils.safe_load_json to return empty dict if file doesn't exist
- added utils.compare_versions to check min version requirements for
automations and entries
- removed outdated convert_path
(#1219)
- added utils.check_if_true_yes_on
(#1216)
- check "min_cm_version" in CM automations and CM scripts (use _cm.yaml
or _cm.json)
@gfursin
Copy link
Contributor

gfursin commented Apr 23, 2024

Sure. Thanks for noting the issue! Then the CM project should be fine but we keep CK archived for now. I will close this issue!

@gfursin gfursin closed this as completed Apr 23, 2024
ctuning-admin added a commit that referenced this issue Apr 26, 2024
CM v2.2.0 release:
- fixed detection of a CM artifact using 'cm info .' when inside virtual
env entries.
- added "cmind.utils.debug_here" function to attach remote Python
debugger
     and tested with Visual Studio Code.
   - added test to avoid checking out CM repo that was not pulled
- added utils.safe_load_json to return empty dict if file doesn't exist
- added utils.compare_versions to check min version requirements for
automations and entries
- removed outdated convert_path
(#1219)
- added utils.check_if_true_yes_on
(#1216)
- check "min_cm_version" in CM automations and CM scripts (use _cm.yaml
or _cm.json)
gfursin added a commit that referenced this issue Apr 28, 2024
CM v2.2.0 release:
- fixed detection of a CM artifact using 'cm info .' when inside virtual
env entries.
- added "cmind.utils.debug_here" function to attach remote Python
debugger
     and tested with Visual Studio Code.
   - added test to avoid checking out CM repo that was not pulled
- added utils.safe_load_json to return empty dict if file doesn't exist
- added utils.compare_versions to check min version requirements for
automations and entries
- removed outdated convert_path
(#1219)
- added utils.check_if_true_yes_on
(#1216)
- check "min_cm_version" in CM automations and CM scripts (use _cm.yaml
or _cm.json)
arjunsuresh pushed a commit to mlcommons/cm4mlops that referenced this issue May 1, 2024
…automations and entries

- removed outdated convert_path (mlcommons/ck#1219)
arjunsuresh pushed a commit to mlcommons/cm4mlops that referenced this issue May 1, 2024
CM v2.2.0 release:
- fixed detection of a CM artifact using 'cm info .' when inside virtual
env entries.
- added "cmind.utils.debug_here" function to attach remote Python
debugger
     and tested with Visual Studio Code.
   - added test to avoid checking out CM repo that was not pulled
- added utils.safe_load_json to return empty dict if file doesn't exist
- added utils.compare_versions to check min version requirements for
automations and entries
- removed outdated convert_path
(mlcommons/ck#1219)
- added utils.check_if_true_yes_on
(mlcommons/ck#1216)
- check "min_cm_version" in CM automations and CM scripts (use _cm.yaml
or _cm.json)
arjunsuresh pushed a commit to mlcommons/cm4mlops that referenced this issue May 1, 2024
CM v2.2.0 release:
- fixed detection of a CM artifact using 'cm info .' when inside virtual
env entries.
- added "cmind.utils.debug_here" function to attach remote Python
debugger
     and tested with Visual Studio Code.
   - added test to avoid checking out CM repo that was not pulled
- added utils.safe_load_json to return empty dict if file doesn't exist
- added utils.compare_versions to check min version requirements for
automations and entries
- removed outdated convert_path
(mlcommons/ck#1219)
- added utils.check_if_true_yes_on
(mlcommons/ck#1216)
- check "min_cm_version" in CM automations and CM scripts (use _cm.yaml
or _cm.json)
arjunsuresh pushed a commit to mlcommons/cm4mlops that referenced this issue May 1, 2024
CM v2.2.0 release:
- fixed detection of a CM artifact using 'cm info .' when inside virtual
env entries.
- added "cmind.utils.debug_here" function to attach remote Python
debugger
     and tested with Visual Studio Code.
   - added test to avoid checking out CM repo that was not pulled
- added utils.safe_load_json to return empty dict if file doesn't exist
- added utils.compare_versions to check min version requirements for
automations and entries
- removed outdated convert_path
(mlcommons/ck#1219)
- added utils.check_if_true_yes_on
(mlcommons/ck#1216)
- check "min_cm_version" in CM automations and CM scripts (use _cm.yaml
or _cm.json)
arjunsuresh pushed a commit to mlcommons/cm4mlops that referenced this issue May 1, 2024
CM v2.2.0 release:
- fixed detection of a CM artifact using 'cm info .' when inside virtual
env entries.
- added "cmind.utils.debug_here" function to attach remote Python
debugger
     and tested with Visual Studio Code.
   - added test to avoid checking out CM repo that was not pulled
- added utils.safe_load_json to return empty dict if file doesn't exist
- added utils.compare_versions to check min version requirements for
automations and entries
- removed outdated convert_path
(mlcommons/ck#1219)
- added utils.check_if_true_yes_on
(mlcommons/ck#1216)
- check "min_cm_version" in CM automations and CM scripts (use _cm.yaml
or _cm.json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants