Code Monkey home page Code Monkey logo

Comments (4)

pbenner avatar pbenner commented on June 12, 2024 1

The [...]/site-packages/data directory is created when installing the package and it contains the figshare files, because of:

matbench_discovery = ["../data/figshare/*"]

One solution would be to move the data/figshare folder into the matbench_discovery folder. But I guess it would take a few more modifications to turn it into a real python package. For instance, this is not compatible:

ROOT = os.path.dirname(os.path.dirname(__file__)) # repo root directory
DATA_DIR = f"{ROOT}/data" # directory to store raw data
SITE_FIGS = f"{ROOT}/site/src/figs" # directory for interactive figures
SITE_MODELS = f"{ROOT}/site/src/routes/models" # directory to write model analysis
FIGSHARE = f"{ROOT}/data/figshare"
SCRIPTS = f"{ROOT}/scripts"
PDF_FIGS = f"{ROOT}/paper/figs" # directory for light-themed PDF figures

The ROOT variable points to the [...]/site-package directory.

from matbench-discovery.

janosh avatar janosh commented on June 12, 2024

pkg_resources is deprecated. Maybe we should use importlib.resources. I'll have to read up on that.

from matbench-discovery.

janosh avatar janosh commented on June 12, 2024

@pbenner are the /tmp and /data directories empty or actually used for anything. maybe the solution is just to get rid of this or check if the package is using an editable install before running this.

for directory in [SITE_FIGS, SITE_MODELS, FIGSHARE, PDF_FIGS]:
os.makedirs(directory, exist_ok=True)

from matbench-discovery.

janosh avatar janosh commented on June 12, 2024

@pbenner Sorry this took ages to address. I think I fixed the supporting data directories being created in root-level /site-packages in 55ab66b. This dynamic way of deciding where data files go feels like a bad solution:

# check if package is installed in editable mode
# hopefully better method coming in https://github.com/pypa/setuptools/issues/4186
pkg_is_editable = os.path.isdir(f"{PKG_DIR}/../matbench_discovery.egg-info")
# repo root directory if editable install, else the pkg directory
ROOT = os.path.dirname(PKG_DIR) if pkg_is_editable else PKG_DIR

I opened pypa/setuptools#4186 to either design a less hacky way of implementing this or maybe learn how to better address the underlying issue.

from matbench-discovery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.