Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Add Python SDK version string #2418

Merged
merged 4 commits into from
May 19, 2020
Merged

Conversation

liuzhe-lz
Copy link
Contributor

@liuzhe-lz liuzhe-lz commented May 11, 2020

Test PYPI: linux windows

I'm confused by the letter "v" problem.
The version string placeholder is "999.0.0-developing", without leading letter "v". But during installation, it's replaced by git tag, which is something like "v1.5".
If the leading letter "v" is desired, we should fix the placeholder; and if it should not be there, we should fix NNI_VERSION_VALUE in makefiles. Personally I prefer not to include leading "v" in NNI_VERSION_VALUE, because that's Python's common practice as I know. If a module wants the leading "v", it can append it before placeholder and the replacement should work fine.

@@ -1,6 +1,8 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

__version__ = '999.0.0-developing'
Copy link
Contributor

Choose a reason for hiding this comment

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

where this string is replaced with correct version? this string in setup.py is replaced in Makefile

chicm-ms
chicm-ms previously approved these changes May 18, 2020
@@ -47,6 +47,7 @@ build:
cp $(CWD)../../src/nni_manager/package.json $(CWD)nni
sed -ie 's/$(NNI_VERSION_TEMPLATE)/$(NNI_VERSION_VALUE)/' $(CWD)nni/package.json
cd $(CWD)nni && $(NNI_YARN) --prod
sed -ie 's/$(NNI_VERSION_TEMPLATE)/$(NNI_VERSION_VALUE)/' $(CWD)../../src/sdk/pynni/nni/__init__.py
cd $(CWD) && sed -ie 's/$(NNI_VERSION_TEMPLATE)/$(NNI_VERSION_VALUE)/' setup.py && python3 setup.py bdist_wheel -p $(WHEEL_SPEC)
Copy link
Contributor

@chicm-ms chicm-ms May 18, 2020

Choose a reason for hiding this comment

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

there a sed replacement statement in nni/Makefile for source/dev install

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When checking the Makefile I found a problem. I think dev-install should not replace the version string in setup.py.
Firstly developers are highly likely tracking their source files with git, and therefore the files should keep in sync with our repo. If a developer dev-install source code, do some editting, and then git commit -a, the replaced version string will be added to patch.
And I think the "developing" placeholder is a good version string for dev-install, because the target of symbol links may be any version. For example if I dev-install on v1.5 branch, and checkout v1.6 code tree later, the version string becomes misleading.
So I suggest only replace version string on normal install, and leave the placeholder unchanged for dev install.

Copy link
Contributor

@chicm-ms chicm-ms May 19, 2020

Choose a reason for hiding this comment

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

Yes, I agree that replacement on source generates annoying git changes.
The IT pipelines install nnimanager with source install and use depoyment install with docker based training service, and there is a version check in trial keeper...
https://github.com/microsoft/nni/blob/master/tools/nni_trial_tool/trial_keeper.py#L122
If we replace setup.py version and not replace nni.__version__ with source install, then in IT pipeline, the two types of version (nni.__version__ and pip distribution version) will be different, this may cause potential problem.

suggest to remove the existing replacement for setup.py in source install and update trial keeper version search pattern. https://github.com/microsoft/nni/blob/master/tools/nni_trial_tool/trial_keeper.py#L24

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 agree source install should keep in sync with pip install. But I think dev install does not necessarily need to be same as release version. I mean, 999.0-developing is a good version number for dev install I think, since it's always the "latest".
If dev install is currently used in release build, I feel okay to replace version string for now. But I believe it should use a separate target like fast-install.

So should we simply replace the version string anywhere for v1.6 release, or delay this PR for a refactor?

Copy link
Contributor

Choose a reason for hiding this comment

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

build release pipeline is using deployment/pypi/Makefile pip install. Since 999.0-developing is a good version for dev, maybe remove the current sed replacement on setup.py for source/dev install ? This also can be done later.

@chicm-ms chicm-ms dismissed their stale review May 18, 2020 06:06

for source install

@SparkSnail SparkSnail merged commit 063efd9 into microsoft:master May 19, 2020
@liuzhe-lz liuzhe-lz deleted the sdk-version branch May 19, 2020 11:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants