Repository: alonfnt/bayex (language: python)

Issue:
Pip install broken
**Describe the bug**
Pip installing the package, then importing with `import bayex` yields the error `ModuleNotFoundError: No module named 'bayex.src'`

**To Reproduce**
Create virtual env with `python3.10.5 -m venv .venv` 
Activate virtual environment with `source .venv/bin/activate`
Install bayes `pip install bayex`
Try to import `import bayex`

```>>> import bayex
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/thomasfoster/Documents/simplicity_is_all_you_need/.venv/lib/python3.10/site-packages/bayex/__init__.py", line 1, in <module>
    from bayex.src.optimizer import Optimizer, OptimizerState
ModuleNotFoundError: No module named 'bayex.src'```


Cloning the repo and installing with `pip install .` works, but then run into many errors with imports, such as cannot import domain from Bayex


Discussion / hints:

Fix patch:
diff --git a/bayex/__init__.py b/bayex/__init__.py
index 2a9fed3..11ebc26 100644
--- a/bayex/__init__.py
+++ b/bayex/__init__.py
@@ -1,8 +1,8 @@
-from bayex.src.optimizer import Optimizer, OptimizerState
-from bayex.src import domain
+from .optimizer import Optimizer, OptimizerState
+from . import domain
 
 
-__version__ = "0.2.0"
+__version__ = "0.2.1c"
 
 __all__ = [
         "Optimizer",
diff --git a/bayex/src/acq.py b/bayex/acq.py
similarity index 96%
rename from bayex/src/acq.py
rename to bayex/acq.py
index 39325cc..a3bec52 100644
--- a/bayex/src/acq.py
+++ b/bayex/acq.py
@@ -2,7 +2,7 @@
 import jax.numpy as jnp
 from jax.scipy.stats import norm
 
-from bayex.src.gp import GPParams, predict
+from bayex.gp import GPParams, predict
 
 
 def expected_improvement(
diff --git a/bayex/src/domain.py b/bayex/domain.py
similarity index 100%
rename from bayex/src/domain.py
rename to bayex/domain.py
diff --git a/bayex/src/gp.py b/bayex/gp.py
similarity index 100%
rename from bayex/src/gp.py
rename to bayex/gp.py
diff --git a/bayex/src/optimizer.py b/bayex/optimizer.py
similarity index 99%
rename from bayex/src/optimizer.py
rename to bayex/optimizer.py
index 9ff861a..897db5c 100644
--- a/bayex/src/optimizer.py
+++ b/bayex/optimizer.py
@@ -5,8 +5,8 @@
 import jax.numpy as jnp
 import numpy as np
 
-import bayex.src.acq as boacq
-from bayex.src.gp import GPParams, GPState, posterior_fit
+import bayex.acq as boacq
+from bayex.gp import GPParams, GPState, posterior_fit
 
 
 class OptimizerState(NamedTuple):
diff --git a/pyproject.toml b/pyproject.toml
index 0e1ae1e..7a590a9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
 
 [project]
 name = "bayex"
-version = "0.2.0"
+version = "0.2.1c"
 description = "Minimal Bayesian Optimization Implementation with Gaussian Processes written in JAX."
 readme = "README.md"
 requires-python = ">=3.9"


Test patch:
diff --git a/bayex/src/gp_test.py b/bayex/gp_test.py
similarity index 95%
rename from bayex/src/gp_test.py
rename to bayex/gp_test.py
index a1444f5..0ddb6c9 100644
--- a/bayex/src/gp_test.py
+++ b/bayex/gp_test.py
@@ -1,6 +1,6 @@
 import jax.numpy as jnp
 import pytest
-from bayex.src.gp import GPParams, gaussian_process, exp_quadratic, cov
+from bayex.gp import GPParams, gaussian_process, exp_quadratic, cov
 
 @pytest.mark.parametrize("x1, x2, mask, expected", [
     (jnp.array([0]), jnp.array([0]), 1, 1),
diff --git a/bayex/src/optimizer_test.py b/bayex/optimizer_test.py
similarity index 97%
rename from bayex/src/optimizer_test.py
rename to bayex/optimizer_test.py
index c915a9c..411425c 100644
--- a/bayex/src/optimizer_test.py
+++ b/bayex/optimizer_test.py
@@ -29,7 +29,7 @@ def f(x):
     assert opt_state.best_params['x'] == params['x'][np.argmax(ys)]
 
     assert type(opt_state) == bayex.OptimizerState
-    assert type(opt_state.gp_state) == bayex.src.gp.GPState # pyright: ignore
+    assert type(opt_state.gp_state) == bayex.gp.GPState # pyright: ignore
 
     assert opt_state.params['x'].shape == (10,)
     assert opt_state.ys.shape == (10,)