NREL / BuildingMOTIF

Building Metadata OnTology Interoperability Framework (BuildingMOTIF)
https://buildingmotif.readthedocs.io/
Other
43 stars 6 forks source link

Skip ipynb checkpoint directory #330

Open gtfierro opened 2 weeks ago

gtfierro commented 2 weeks ago

This directory can contain duplicate files which have been cached when running a notebook. This can cause an issue when scanning the local file system for libraries and/or graphs, when BuildingMOTIF insists on enforcing uniqueness on certain tables. This patch prevents file in `.ipynb_chekcpoints' directories from being given to BuildingMOTIF.

@haneslinger @TShapinsky @MatthewSteen any ideas on how I could / should unit test this?

MatthewSteen commented 2 weeks ago

Could you simply create an .ipynb_checkpoints/.gitkeep file (or similar), then do an assert in the test_utils.py?

gtfierro commented 2 weeks ago

I'm not sure that would fix the issue, but maybe I'm misunderstanding how .gitkeep works. The problem is the notebooks will create the checkpoints folder regardless. One example workflow:

Before:

tutorial/
     templates.yml

after:

tutorial/
     .ipynb_checkpoints/
          templates.yml
     templates.yml

Doesn't .gitkeep keep the folder around? The above issue happens regardless of what git is doing

MatthewSteen commented 2 weeks ago

Yes, .gitkeep keeps the folder around. I was just suggesting it as an example file for testing only. Not a file to actually create and track with Git.

Where is the uniqueness error coming from, sql db?

gtfierro commented 2 weeks ago

🤦 that should have been obvious to me.... thanks! That's a good suggestion for tests

Yes, the uniqueness constraint comes from our schema. We want library names to be unique, and we want template names to be unique within each library.