Access files as setuptools pkg_resource
from data/__init__.py:
with open("data/insecure.json") as __f:
That open is relative to your working directory, the reason it works for testing is that folder data is in the root of your package. The proper way to access this file is with pkg_resources from setuptools as a resource_filename.
This looks great! Adding setuptools to install_requires in setup.py would be good, for completeness!
PR updated
This looks great! Adding
setuptoolstoinstall_requiresinsetup.pywould be good, for completeness!
Hello! Is there something I can help with to get this PR merged?
Any reason why this has not merged yet?
If I understand correctly stdlib's importlib.resources would be preferred over setuptools' pkg_resources, wouldn't they?
stdlib's importlib.resources
Yep, wait a few more weeks on this until 3.6 is EOL and yeah, stdlib ftw!
I've made a version of this PR which uses importlib.resources as suggested https://github.com/pyupio/safety-db/pull/2351
Let's get import safety_db working again!