From 8a3cff8a98035d8565d9c9b8a57cd72c88f87f49 Mon Sep 17 00:00:00 2001 From: Luca Wehrstedt Date: Wed, 1 May 2019 14:13:38 -0700 Subject: [PATCH] Other fixes to packaging Summary: Basically make sure that license information is properly preserved in metadata, source and built distributions. Also, start having a .gitignore with common stuff. Reviewed By: adamlerer Differential Revision: D15166521 fbshipit-source-id: 3b64e208829f3983fc2ad589c6608b584e6b40ac --- .gitignore | 9 +++++++++ LICENSE => LICENSE.txt | 0 MANIFEST.in | 1 + setup.cfg | 4 +++- setup.py | 9 ++++++++- torchbiggraph/VERSION.txt | 1 + torchbiggraph/__init__.py | 4 ++++ torchbiggraph/examples/{LICENSE => LICENSE.txt} | 0 8 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 .gitignore rename LICENSE => LICENSE.txt (100%) create mode 100644 MANIFEST.in create mode 100644 torchbiggraph/VERSION.txt rename torchbiggraph/examples/{LICENSE => LICENSE.txt} (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..21a3b362 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*~ +build/ +data/ +dist/ +model/ +*.pyc +**/__pycache__/ +torchbiggraph.egg-info/ +venv/ diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..56547378 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +global-include LICENSE* diff --git a/setup.cfg b/setup.cfg index 41ee7d19..fecacdb0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,5 @@ # Include license in the wheel distribution. [metadata] -license_files = LICENSE +license_files = + LICENSE + torchbiggraph/examples/LICENSE diff --git a/setup.py b/setup.py index 9bf7c465..becab810 100755 --- a/setup.py +++ b/setup.py @@ -14,9 +14,12 @@ with open("requirements.txt", "rt") as f: requirements = f.readlines() +with open("torchbiggraph/VERSION.txt", "rt") as f: + version = f.read().strip() + setup( name="torchbiggraph", - version="1.dev", + version=version, description="A distributed system to learn embeddings of large graphs", long_description=long_description, long_description_content_type="text/markdown", @@ -36,8 +39,12 @@ "Topic :: Scientific/Engineering :: Artificial Intelligence", ], keywords="machine-learning knowledge-base graph-embedding link-prediction", + license="BSD License", packages=find_packages(exclude=["docs", "test"]), package_data={ + "torchbiggraph": [ + "VERSION.txt", + ], "torchbiggraph.examples": [ "configs/*.py", ], diff --git a/torchbiggraph/VERSION.txt b/torchbiggraph/VERSION.txt new file mode 100644 index 00000000..5073c599 --- /dev/null +++ b/torchbiggraph/VERSION.txt @@ -0,0 +1 @@ +1.dev1 diff --git a/torchbiggraph/__init__.py b/torchbiggraph/__init__.py index e5a0d9b4..7716c37f 100644 --- a/torchbiggraph/__init__.py +++ b/torchbiggraph/__init__.py @@ -1 +1,5 @@ #!/usr/bin/env python3 + +import pkg_resources + +__version__ = pkg_resources.resource_string("torchbiggraph", "VERSION.txt").decode("utf-8").strip() diff --git a/torchbiggraph/examples/LICENSE b/torchbiggraph/examples/LICENSE.txt similarity index 100% rename from torchbiggraph/examples/LICENSE rename to torchbiggraph/examples/LICENSE.txt