diff --git a/keras_nlp/__init__.py b/keras_nlp/__init__.py index 0e81a7f731..e46172e307 100644 --- a/keras_nlp/__init__.py +++ b/keras_nlp/__init__.py @@ -26,6 +26,4 @@ from keras_nlp import samplers from keras_nlp import tokenizers from keras_nlp import utils - -# This is the global source of truth for the version number. -__version__ = "0.7.0" +from keras_nlp.version import __version__ diff --git a/keras_nlp/version.py b/keras_nlp/version.py new file mode 100644 index 0000000000..15fede3a08 --- /dev/null +++ b/keras_nlp/version.py @@ -0,0 +1,23 @@ +# Copyright 2023 The KerasNLP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from keras_nlp.api_export import keras_nlp_export + +# Unique source of truth for the version number. +__version__ = "0.7.0" + + +@keras_nlp_export("keras_nlp.version") +def version(): + return __version__ diff --git a/setup.py b/setup.py index 13214e70e0..52f5c84fdb 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,7 @@ def get_version(rel_path): HERE = pathlib.Path(__file__).parent README = (HERE / "README.md").read_text() +VERSION = get_version("keras_nlp/version.py") setup( name="keras-nlp", @@ -45,7 +46,7 @@ def get_version(rel_path): ), long_description=README, long_description_content_type="text/markdown", - version=get_version("keras_nlp/__init__.py"), + version=VERSION, url="https://github.com/keras-team/keras-nlp", author="Keras team", author_email="keras-nlp@google.com",