Skip to content

Commit

Permalink
Fix src/ layout
Browse files Browse the repository at this point in the history
  • Loading branch information
NPodlozhniy committed Dec 24, 2024
1 parent 513e237 commit 27ea926
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 10 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
build:

name: Build, run tests & display coverage
name: Build & Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -41,7 +41,9 @@ jobs:
- name: Unit testing with pytest
run: |
python -m pip install pytest
python -m pytest
# Running `pytest` instead of `python -m pytest` is equivalent
# except that the latter will add the current directory to sys.path
pytest
- name: Produce the .coverage file
run: |
python -m pip install coverage
Expand Down
12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ dependencies = [
]

[project.urls]
Homepage = "https://github.com/NPodlozhniy/seqabpy"
Issues = "https://npodlozhniy.github.io/posts/sequential-testing/"
Homepage = "https://npodlozhniy.github.io/posts/sequential-testing/"
"Source Code" = "https://github.com/NPodlozhniy/seqabpy"

[tool.hatch.version]
path = "src/seqabpy/__init__.py"

# config works for pytest >= 7
# for earlier version you may
# a) set PYTHONPATH=".:src/"
# b) set sys path in tests/__init__.py
# c) run `pip install --editable .` prior to pytest
[tool.pytest.ini_options]
pythonpath = "src/"

[tool.coverage.paths]
source = [
"*/src",
Expand Down
Empty file removed src/__init__.py
Empty file.
9 changes: 7 additions & 2 deletions src/seqabpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
__version__ = "0.1.1"
__version__ = "0.1.2"

import numpy as np
from scipy.stats import norm

from src.seqabpy import gatsby, gavi
# np and norm are given to gatsby and gavi via (import *)
from seqabpy import gatsby, gavi

# once everything is imported, with (from seqabpy import *)
# only gavi and gatsby will be imported
__all__ = ["gatsby", "gavi"]
2 changes: 1 addition & 1 deletion src/seqabpy/gatsby.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from scipy.stats import multivariate_normal
from statsmodels.sandbox.distributions.extras import mvnormcdf

from src.seqabpy import *
from seqabpy import *


def alpha_spending_function(
Expand Down
2 changes: 1 addition & 1 deletion src/seqabpy/gavi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from scipy.special import gammaln, loggamma, xlogy

from src.seqabpy import *
from seqabpy import *


class AlwaysValidInference:
Expand Down
3 changes: 3 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import sys

sys.path.append("src")
2 changes: 1 addition & 1 deletion tests/test_gavi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

from src.seqabpy.gavi import *
from seqabpy.gavi import *


def test_sequential_p_value():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gst.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

from src.seqabpy.gatsby import *
from seqabpy.gatsby import *

def test_calculate_sequential_bounds():
expected_bounds = (
Expand Down

0 comments on commit 27ea926

Please sign in to comment.