Skip to content

Commit a4e074d

Browse files
committed
final updates before release
1 parent 2cf86fb commit a4e074d

4 files changed

Lines changed: 22 additions & 20 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
Search the [DnD5e API](https://www.dnd5eapi.co) and return relevant information
44

5+
## Requirements
6+
7+
- Python ^3.7
8+
- [appdirs](https://github.com/ActiveState/appdirs)>=1.4.4 for finding
9+
what directories to store data in (helps this function as a
10+
platform-independent application)
11+
- [GitPython](https://github.com/gitpython-developers/GitPython)>=3.1.14 for
12+
downloading the database repository
13+
- [pymongo](https://github.com/mongodb/mongo-python-driver)>=3.11.3 for querying
14+
a local database
15+
- [requests](https://github.com/psf/requests)>=2.25.1 for querying the database
16+
at <https://dnd5eapi.co/api>
17+
- [rich](https://github.com/willmcgugan/rich)>=9.13.0 for formatting retrieved information
18+
519
## Optional Requirements
620

721
- If you want to query a local database (it's faster and works offline!),

dnfo/database_ops/build.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,6 @@ def download_db(url: str, location: str) -> str:
2525
return hexsha
2626

2727

28-
def hashes_match(lockfile: Path, newlock: str) -> bool:
29-
"""read a lockfile to see if the database needs to be updated.
30-
additionally, check if hashes match"""
31-
try:
32-
with lockfile.open() as file:
33-
oldlock: str = file.read().strip()
34-
if oldlock == newlock:
35-
return False
36-
except FileNotFoundError:
37-
pass
38-
finally:
39-
with lockfile.open() as file:
40-
file.write(newlock.strip())
41-
return True # pylint: disable=W0150
42-
43-
4428
def lock(lockfile: Path, newlock: str) -> bool:
4529
"""read a lockfile to see if the database needs to be updated.
4630
additionally, check if hashes match
@@ -130,9 +114,9 @@ def populate_db(rebuild=False) -> int:
130114

131115
try:
132116
DB_DIR.mkdir(parents=True)
133-
print(f"Creating '{DB_DIR}' for database storage...")
117+
print(f"Storing JSON files in '{DB_DIR}'.")
134118
except FileExistsError:
135-
print("Using existing database.")
119+
print(f"Existing JSON files found at '{DB_DIR}'.")
136120

137121
with tempfile.TemporaryDirectory(prefix="dnfo.") as tmpdir:
138122
head_hash = download_db(URL, tmpdir)

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
long_description=long_description,
1414
long_description_content_type="text/markdown",
1515
url="https://github.com/sudo-julia/dnfo",
16+
package_dir={"": "dnfo"},
1617
packages=find_packages(),
1718
modules=["database_ops", "queries"],
1819
classifiers=[
@@ -32,11 +33,16 @@
3233
"Typing :: Typed",
3334
],
3435
install_requires=[
36+
"appdirs>=1.4.4",
3537
"requests>=2.25.1",
3638
"rich>=>=9.13.0",
3739
"pymongo>=3.11.3",
3840
"GitPython>=3.1.14",
3941
],
4042
python_requires=">=3.7",
4143
entry_points={"console_scripts": ["dnfo = dnfo.__main__:main"]},
44+
project_urls={
45+
"Bug Reports": "https://github.com/sudo-julia/dnfo/issues",
46+
"Source": "https://github.com/sudo-julia/dnfo/issues",
47+
},
4248
)

0 commit comments

Comments
 (0)