Skip to content

Conversation

@ajw-aws
Copy link

@ajw-aws ajw-aws commented May 25, 2020

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.

@nrbgt
Copy link

nrbgt commented Jun 12, 2020

This looks great! Adding setuptools to install_requires in setup.py would be good, for completeness!

@ajw-aws
Copy link
Author

ajw-aws commented Jun 12, 2020

PR updated

This looks great! Adding setuptools to install_requires in setup.py would be good, for completeness!

setup.py Outdated
packages=['safety_db'],
license='Attribution-NonCommercial-ShareAlike 4.0 International',
install_requires=[],
install_requires=['install_requires'],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

erm, setuptools

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and 👍 for the quick response!

@pawamoy
Copy link

pawamoy commented Nov 18, 2020

Hello! Is there something I can help with to get this PR merged?

pawamoy referenced this pull request Nov 18, 2020
Not doing so causes nothing in the data directory to be included in the distribution.
@lingrlongr
Copy link

Any reason why this has not merged yet?

@m-aciek
Copy link

m-aciek commented Dec 3, 2021

If I understand correctly stdlib's importlib.resources would be preferred over setuptools' pkg_resources, wouldn't they?

@bollwyvl
Copy link

bollwyvl commented Dec 3, 2021

stdlib's importlib.resources

Yep, wait a few more weeks on this until 3.6 is EOL and yeah, stdlib ftw!

efokschaner added a commit to efokschaner/safety-db that referenced this pull request Feb 4, 2022
This is a updated fix for pyupio#2308 and supersedes pyupio#2309 It uses importlib.resources which means dropping support for python 3.6 and below
@efokschaner
Copy link

I've made a version of this PR which uses importlib.resources as suggested #2351

Let's get import safety_db working again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

8 participants