Repository: alan-turing-institute/empiarreader (language: python)

Issue:
Updating poetry/pyproject dependencies
Addresses issue #16 

Allows empiarreader to be installed via poetry according to `README.md` instructions. During bug-fixing of `pyproject.toml` and `poetry.lock` interactions (pytest >6.2.5 required), I reorganised repo structure. Feel free to change it back if preferred! 

I add the file `tests/test_empiar_cache.py` in which I have a couple of functions I used to try out the functionality of empiarreader. In these I also started to look at whether setting intake cache parameters to non-defaults would allow enable persistent caching of downloaded files. Testing this is incomplete.

Whilst doing these tests I noticed that they will fail if I try to access EMPIAR entry 10340 instead of 10943 (used in other tests). Perhaps `tests/test_empiar_cache.py` would be a good candidate to extend to investigate why empiarreader breaks on entry 10340? 


Discussion / hints:
Thanks @JatGreer

Moving the package to src got me thinking about the project structure/name again. I have some other ideas that I'll put on another PR after we merge this one.

~`tests/test_empiar_cache.py` - this has some notes/exploration which seems valuable, but don't think it is testing anything (yet, maybe) since we're not doing caching. Okay to repurpose this into a test for the download functionality?~ (Sorry, please ignore - I missed the part of your message noting this was incomplete)

Will merge as is.
> Whilst doing these tests I noticed that they will fail if I try to access EMPIAR entry 10340 instead of 10943 (used in other tests). Perhaps tests/test_empiar_cache.py would be a good candidate to extend to investigate why empiarreader breaks on entry 10340?

Ah interesting, I'll open an issue for investigating this

Fix patch:
diff --git a/README.md b/README.md
index ca59e4c..24dd299 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ pip install git+https://github.com/alan-turing-institute/empiarreader/
 To retrieve a dataset from an Empiar entry, use the following code:
 
 ```
-from intake_cryoem.empiar import EmpiarSource
+from empiarreader import EmpiarSource
 
 dataset = EmpiarSource(
             number,
diff --git a/pyproject.toml b/pyproject.toml
index e1cf8cf..51d0c68 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,5 +1,5 @@
 [tool.poetry]
-name = "intake-cryoem"
+name = "empiarreader"
 version = "0.0.1"
 description = ""
 authors = ["mooniean <bcostagomes@turing.ac.uk>", "ots22 <ostrickson@turing.ac.uk>"]
@@ -26,6 +26,6 @@ requires = ["poetry-core @ git+https://github.com/python-poetry/poetry-core.git@
 build-backend = "poetry.core.masonry.api"
 
 [tool.poetry.plugins."intake.drivers"]
-mrc = "intake_cryoem.mrcsource:MrcSource"
-star = "intake_cryoem.starsource:StarSource"
-empiar = "intake_cryoem.empiar:EmpiarCatalog"
+mrc = "empiarreader:MrcSource"
+star = "empiarreader:StarSource"
+empiar = "empiarreader:EmpiarCatalog"
diff --git a/src/empiarreader/__init__.py b/src/empiarreader/__init__.py
new file mode 100644
index 0000000..4ce26c7
--- /dev/null
+++ b/src/empiarreader/__init__.py
@@ -0,0 +1,3 @@
+from .mrcsource import MrcSource  # noqa: F401
+from .starsource import StarSource  # noqa: F401
+from .empiar import EmpiarCatalog, EmpiarSource  # noqa: F401
diff --git a/src/intake_cryoem/empiar.py b/src/empiarreader/empiar.py
similarity index 100%
rename from src/intake_cryoem/empiar.py
rename to src/empiarreader/empiar.py
diff --git a/src/intake_cryoem/mrcsource.py b/src/empiarreader/mrcsource.py
similarity index 100%
rename from src/intake_cryoem/mrcsource.py
rename to src/empiarreader/mrcsource.py
diff --git a/src/intake_cryoem/starsource.py b/src/empiarreader/starsource.py
similarity index 100%
rename from src/intake_cryoem/starsource.py
rename to src/empiarreader/starsource.py
diff --git a/src/intake_cryoem/__init__.py b/src/intake_cryoem/__init__.py
deleted file mode 100644
index e69de29..0000000


Test patch:
diff --git a/tests/test_empiar_cache.py b/tests/test_empiar_cache.py
index 47d4b05..f69ab05 100644
--- a/tests/test_empiar_cache.py
+++ b/tests/test_empiar_cache.py
@@ -3,7 +3,7 @@
 from unittest.mock import patch
 from intake.config import conf
 
-from intake_cryoem.empiar import EmpiarCatalog, EmpiarSource
+from empiarreader import EmpiarCatalog, EmpiarSource
 
 import os
 import pytest
diff --git a/tests/test_empiar_retrieval.py b/tests/test_empiar_retrieval.py
index 0551072..dcfce52 100644
--- a/tests/test_empiar_retrieval.py
+++ b/tests/test_empiar_retrieval.py
@@ -1,6 +1,6 @@
 import pytest
 
-from intake_cryoem.empiar import EmpiarCatalog, EmpiarSource
+from empiarreader import EmpiarCatalog, EmpiarSource
 
 
 def test_empiar():