From a4e074d5c112737082821daffddd428b1ce6dd7b Mon Sep 17 00:00:00 2001 From: sudo-julia Date: Tue, 6 Apr 2021 11:42:50 -0700 Subject: [PATCH] final updates before release --- README.md | 14 ++++++++++++++ dnfo/database_ops/build.py | 20 ++------------------ setup.cfg | 2 -- setup.py | 6 ++++++ 4 files changed, 22 insertions(+), 20 deletions(-) delete mode 100644 setup.cfg diff --git a/README.md b/README.md index 20d6be1..6fc64a6 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,20 @@ Search the [DnD5e API](https://www.dnd5eapi.co) and return relevant information +## Requirements + +- Python ^3.7 +- [appdirs](https://github.com/ActiveState/appdirs)>=1.4.4 for finding +what directories to store data in (helps this function as a +platform-independent application) +- [GitPython](https://github.com/gitpython-developers/GitPython)>=3.1.14 for +downloading the database repository +- [pymongo](https://github.com/mongodb/mongo-python-driver)>=3.11.3 for querying +a local database +- [requests](https://github.com/psf/requests)>=2.25.1 for querying the database +at +- [rich](https://github.com/willmcgugan/rich)>=9.13.0 for formatting retrieved information + ## Optional Requirements - If you want to query a local database (it's faster and works offline!), diff --git a/dnfo/database_ops/build.py b/dnfo/database_ops/build.py index b36c8f5..63055f7 100644 --- a/dnfo/database_ops/build.py +++ b/dnfo/database_ops/build.py @@ -25,22 +25,6 @@ def download_db(url: str, location: str) -> str: return hexsha -def hashes_match(lockfile: Path, newlock: str) -> bool: - """read a lockfile to see if the database needs to be updated. - additionally, check if hashes match""" - try: - with lockfile.open() as file: - oldlock: str = file.read().strip() - if oldlock == newlock: - return False - except FileNotFoundError: - pass - finally: - with lockfile.open() as file: - file.write(newlock.strip()) - return True # pylint: disable=W0150 - - def lock(lockfile: Path, newlock: str) -> bool: """read a lockfile to see if the database needs to be updated. additionally, check if hashes match @@ -130,9 +114,9 @@ def populate_db(rebuild=False) -> int: try: DB_DIR.mkdir(parents=True) - print(f"Creating '{DB_DIR}' for database storage...") + print(f"Storing JSON files in '{DB_DIR}'.") except FileExistsError: - print("Using existing database.") + print(f"Existing JSON files found at '{DB_DIR}'.") with tempfile.TemporaryDirectory(prefix="dnfo.") as tmpdir: head_hash = download_db(URL, tmpdir) diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 1acc31a..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -bugtrack_url = https://github.com/sudo-julia/dnfo/issues diff --git a/setup.py b/setup.py index 39433b9..c6ffb92 100644 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/sudo-julia/dnfo", + package_dir={"": "dnfo"}, packages=find_packages(), modules=["database_ops", "queries"], classifiers=[ @@ -32,6 +33,7 @@ "Typing :: Typed", ], install_requires=[ + "appdirs>=1.4.4", "requests>=2.25.1", "rich>=>=9.13.0", "pymongo>=3.11.3", @@ -39,4 +41,8 @@ ], python_requires=">=3.7", entry_points={"console_scripts": ["dnfo = dnfo.__main__:main"]}, + project_urls={ + "Bug Reports": "https://github.com/sudo-julia/dnfo/issues", + "Source": "https://github.com/sudo-julia/dnfo/issues", + }, )