Skip to content

Commit

Permalink
Partial revert "Hack package build script to rename to keras-hub (ker…
Browse files Browse the repository at this point in the history
…as-team#1793)"

Partial revert commit e4b133d.
  • Loading branch information
mattdangerw committed Sep 19, 2024
1 parent fb3dc3b commit 71f2fef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
19 changes: 6 additions & 13 deletions pip_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import re
import shutil

package = "keras_hub"
package = "keras_nlp"
build_directory = "tmp_build_dir"
dist_directory = "dist"
to_copy = ["setup.py", "setup.cfg", "README.md"]
Expand All @@ -48,15 +48,15 @@ def ignore_files(_, filenames):

def export_version_string(version, is_nightly=False):
"""Export Version and Package Name."""
date = datetime.datetime.now()
version += f".dev{date.strftime('%Y%m%d%H%M%S')}"
if is_nightly:
# Replaces `name="keras-hub"` in `setup.py` with `keras-hub-nightly`
date = datetime.datetime.now()
version += f".dev{date.strftime('%Y%m%d%H')}"
# Replaces `name="keras-nlp"` in `setup.py` with `keras-nlp-nightly`
with open("setup.py") as f:
setup_contents = f.read()
with open("setup.py", "w") as f:
setup_contents = setup_contents.replace(
'name="keras-hub"', 'name="keras-hub-nightly"'
'name="keras-nlp"', 'name="keras-nlp-nightly"'
)
f.write(setup_contents)

Expand All @@ -78,18 +78,11 @@ def copy_source_to_build_directory(root_path):
os.chdir(root_path)
os.mkdir(build_directory)
shutil.copytree(
"keras_nlp", os.path.join(build_directory, package), ignore=ignore_files
package, os.path.join(build_directory, package), ignore=ignore_files
)
for fname in to_copy:
shutil.copy(fname, os.path.join(f"{build_directory}", fname))
os.chdir(build_directory)
# TODO: remove all of this when our code is actually renamed in the repo.
os.system("grep -lR 'keras_nlp' . | xargs sed -i 's/keras_nlp/keras_hub/g'")
os.system("grep -lR 'keras-nlp' . | xargs sed -i 's/keras-nlp/keras-hub/g'")
os.system("grep -lR 'KerasNLP' . | xargs sed -i 's/KerasNLP/KerasHub/g'")
os.system(
"grep -lR 'compat_package_name' . | xargs sed -i 's/compat_package_name/keras_nlp/g'"
)


def build(root_path, is_nightly=False):
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ def get_version(rel_path):

setup(
name="keras-nlp",
description="🚧🚧🚧 Work in progress. 🚧🚧🚧 More details soon!",
long_description="🚧🚧🚧 Work in progress. 🚧🚧🚧 More details soon!",
description=(
"Industry-strength Natural Language Processing extensions for Keras."
),
long_description=README,
long_description_content_type="text/markdown",
version=VERSION,
url="https:/keras-team/keras-nlp",
author="Keras team",
Expand Down

0 comments on commit 71f2fef

Please sign in to comment.