diff --git a/.gitignore b/.gitignore index 44561bd..5017c76 100644 --- a/.gitignore +++ b/.gitignore @@ -112,11 +112,13 @@ ckpt # vscode .vscode +# JetBrains PyCharm +.idea + # tacred benchmark/tacred *.swp -<<<<<<< HEAD # data and pretrain pretrain benchmark diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..f9bd145 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include requirements.txt diff --git a/README.md b/README.md index a515ef3..c012103 100644 --- a/README.md +++ b/README.md @@ -64,23 +64,13 @@ If it is too slow, you can try git clone https://github.com/thunlp/OpenNRE.git --depth 1 ``` -Then install all the requirements: - +Then install the package with: ``` -pip install -r requirements.txt +pip install -e . ``` +if you don't want to modify the code, you can skip `-e ` flag. -**Note**: Please choose appropriate PyTorch version based on your machine (related to your CUDA version). For details, refer to https://pytorch.org/. - -Then install the package with -``` -python setup.py install -``` - -If you also want to modify the code, run this: -``` -python setup.py develop -``` +**Note**: Please install appropriate PyTorch version based on your machine (related to your CUDA version). For details, refer to https://pytorch.org/. Note that we have excluded all data and pretrain files for fast deployment. You can manually download them by running scripts in the ``benchmark`` and ``pretrain`` folders. For example, if you want to download FewRel dataset, you can run diff --git a/setup.py b/setup.py index 8f80025..024f023 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,27 @@ import setuptools -with open("README.md", "r") as fh: - setuptools.setup( - name='opennre', - version='0.1', - author="Tianyu Gao", - author_email="gaotianyu1350@126.com", - description="An open source toolkit for relation extraction", - url="https://github.com/thunlp/opennre", - packages=setuptools.find_packages(), - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: Linux", - ], - setup_requires=['wheel'] - ) + + +def read(filename: str) -> str: + with open(filename, "r") as f: + return f.read() + + +setuptools.setup( + name="opennre", + version="0.1", + author="Tianyu Gao", + author_email="gaotianyu1350@126.com", + description="An open source toolkit for relation extraction", + url="https://github.com/thunlp/opennre", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: Linux", + ], + setup_requires=["wheel"], + install_requires=read("requirements.txt").strip().splitlines(), + long_description=read("README.md"), + long_description_content_type="text/markdown", + license_files=("LICENSE",), +)