Skip to content

Commit

Permalink
Update deps, remove py37 and fix test warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
benjeffery committed Oct 12, 2023
1 parent 113229b commit 22d7199
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ orbs:
jobs:
build:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.10
working_directory: /home/circleci/msprime
steps:
- checkout
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/docker/shared.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
PYTHON_VERSIONS=(
cp39-cp39
cp38-cp38
cp37-cp37m
cp310-cp310
cp311-cp311
)
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: [ 3.7, 3.11 ]
python: [ 3.8, 3.11 ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
defaults:
run:
Expand Down Expand Up @@ -62,7 +62,6 @@ jobs:
channels: conda-forge
channel-priority: strict
auto-update-conda: true
use-only-tar-bz2: true

- name: Fix windows symlinks
# This is horrible, but the "git config core.symlinks true" didn't work.
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python: [3.7, 3.8, 3.9, "3.10", 3.11]
python: [3.8, 3.9, "3.10", 3.11]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python: [3.7, 3.8, 3.9, "3.10", 3.11]
python: [3.8, 3.9, "3.10", 3.11]
steps:
- name: Download wheels
uses: actions/download-artifact@v2
Expand All @@ -105,7 +105,7 @@ jobs:
needs: ['manylinux']
strategy:
matrix:
python: [3.7, 3.8, 3.9, "3.10", 3.11]
python: [3.8, 3.9, "3.10", 3.11]
steps:
- name: Download wheels
uses: actions/download-artifact@v2
Expand Down
12 changes: 6 additions & 6 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ queue_rules:
- "#approved-reviews-by>=1"
- status-success=Docs
- status-success=Lint
- status-success=Python (3.7, macos-latest)
- status-success=Python (3.8, macos-latest)
- status-success=Python (3.11, macos-latest)
- status-success=Python (3.7, ubuntu-latest)
- status-success=Python (3.8, ubuntu-latest)
- status-success=Python (3.11, ubuntu-latest)
- status-success=Python (3.7, windows-latest)
- status-success=Python (3.8, windows-latest)
- status-success=Python (3.11, windows-latest)
- "status-success=ci/circleci: build"
pull_request_rules:
Expand All @@ -20,11 +20,11 @@ pull_request_rules:
- label=AUTOMERGE-REQUESTED
- status-success=Docs
- status-success=Lint
- status-success=Python (3.7, macos-latest)
- status-success=Python (3.8, macos-latest)
- status-success=Python (3.11, macos-latest)
- status-success=Python (3.7, ubuntu-latest)
- status-success=Python (3.8, ubuntu-latest)
- status-success=Python (3.11, ubuntu-latest)
- status-success=Python (3.7, windows-latest)
- status-success=Python (3.8, windows-latest)
- status-success=Python (3.11, windows-latest)
- "status-success=ci/circleci: build"
#- status-success=codecov/patch
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@
{user}`GertjanBisschop`)

**Maintenance**:

- Automatically flush edges whenever an edge with a different parent is added to the edge buffer. ({issue}`2182`, {pr}`2183`, {user}`GertjanBisschop`)

**Breaking changes**:

- msprime no longer supports Python 3.7

## [1.2.0] - 2022-05-18

**New features**
Expand Down
1 change: 0 additions & 1 deletion benchmarks/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@


class LargeSimulationBenchmark:

# ASV is designed to accurately time functions that execute in a fraction
# of a second. But, we're interested in profiling large simulations that
# run in 10s of seconds (at least). We want to run the target function
Expand Down
2 changes: 2 additions & 0 deletions msprime/ancestry.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ def _parse_random_seed(seed):
"""
if seed is None:
seed = core.get_random_seed()
if isinstance(seed, np.ndarray):
seed = seed[0]
seed = int(seed)
return seed

Expand Down
1 change: 0 additions & 1 deletion msprime/demography.py
Original file line number Diff line number Diff line change
Expand Up @@ -2984,7 +2984,6 @@ class PopulationParametersChange(ParameterChangeEvent):
_type_str: ClassVar[str] = "Population parameter change"

def __post_init__(self):

if self.population_id is not None and self.population is not None:
raise ValueError(
"population_id and population are aliases; cannot supply both."
Expand Down
1 change: 0 additions & 1 deletion msprime/pedigrees.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ def parse_pedigree(


def write_pedigree(ts, out):

print("# id\tparent0\tparent1\ttime\tis_sample\tpopulation", file=out)
for ind in ts.individuals():
if len(ind.nodes) != 2:
Expand Down
24 changes: 10 additions & 14 deletions requirements/CI-complete/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
bintrees==2.2.0
daiquiri==3.0.1
demes==0.2.1
mypy==0.910
newick==1.3.2
numpy==1.21.6
pytest==6.2.5
pytest-cov==3.0.0
pytest-xdist==2.5.0
# https://github.com/tskit-dev/msprime/issues/1860
# Required by python_jsonschema_objects
jsonschema<4.0
python_jsonschema_objects==0.4.1
scipy==1.7.3
daiquiri==3.2.1
demes==0.2.3
mypy==1.6.0
newick==1.9.0
pytest==7.4.2
pytest-cov==4.1.0
pytest-xdist==3.3.1
python_jsonschema_objects==0.5.0
scipy==1.11.3
stdpopsim==0.1.2
tskit==0.5.3
tskit==0.5.6
kastore==0.3.2
8 changes: 4 additions & 4 deletions requirements/CI-docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ jupyter-book==0.15.1
sphinx-issues==3.0.1
sphinx-argparse==0.4.0
sphinx-book-theme # not pinned to enable easy updates
numpy==1.25.2
tskit==0.5.5
numpy==1.26.0
tskit==0.5.6
demes==0.2.3
matplotlib==3.7.2
matplotlib==3.8.0
networkx==3.1
scipy==1.11.1
scipy==1.11.3
daiquiri==3.2.1
demesdraw==0.4.0
newick==1.9.0
7 changes: 1 addition & 6 deletions requirements/CI-tests-conda/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# https://github.com/tskit-dev/msprime/issues/1860
# Version < 4 is required by python_jsonschema_objects,
# but demes will pull in the latest so we pin here.
jsonschema<4.0
gsl
tskit==0.5.3
stdpopsim==0.1.2
demes==0.2.1
demes==0.2.3
21 changes: 8 additions & 13 deletions requirements/CI-tests-pip/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
bintrees==2.2.0
daiquiri==3.0.1
newick==1.3.1
numpy==1.21.6; python_version < '3.11' # Held at 1.21.6 for Python 3.7 compatibility
numpy==1.24.1; python_version > '3.10'
pytest==6.2.5
pytest-xdist==2.4.0
# https://github.com/tskit-dev/msprime/issues/1860
# Required by python_jsonschema_objects
jsonschema<5.0
python_jsonschema_objects==0.4.1
scipy==1.7.3; python_version < '3.11'
scipy==1.9.3; python_version > '3.10'
tskit==0.5.3
daiquiri==3.2.1
newick==1.9.0
pytest==7.4.2
pytest-xdist==3.3.1
python_jsonschema_objects==0.5.0
scipy==1.11.3; python_version > '3.8'
scipy==1.10.1; python_version <= '3.8'
tskit==0.5.6
5 changes: 0 additions & 5 deletions requirements/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,5 @@ sphinx-argparse
sphinx-issues
jupyter-book
networkx

newick>=1.3.0
# https://github.com/tskit-dev/msprime/issues/1860
# Required by python_jsonschema_objects
jsonschema<4.0
# We use JSON-schema to test out metadata handling.
python_jsonschema_objects
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ classifiers =
Programming Language :: C
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand Down Expand Up @@ -45,7 +44,7 @@ platforms =

[options]
packages = msprime
python_requires = >=3.7
python_requires = >=3.8
include_package_data = True
install_requires =
numpy
Expand Down
1 change: 0 additions & 1 deletion tests/test_ancestry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,6 @@ def test_initial_state_errors(self):
msprime.sim_ancestry(initial_state=ts1, random_seed=2)

def test_initial_state(self):

ts = msprime.sim_ancestry(10, end_time=0.01, random_seed=2)
# Same if we use either the tables or tree sequence object.
sim = ancestry._parse_sim_ancestry(initial_state=ts, population_size=1)
Expand Down
1 change: 0 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,6 @@ def test_short_args(self, tmp_path):
assert tree_sequence.get_num_mutations() == 0

def test_run_yaml(self, tmp_path):

yaml = """\
time_units: generations
demes:
Expand Down
2 changes: 0 additions & 2 deletions tests/test_demography.py
Original file line number Diff line number Diff line change
Expand Up @@ -2597,7 +2597,6 @@ def test_full_arg_migration(self):

def test_full_arg_migration_smc(self):
for model in ["smc", "smc_prime"]:

population_configurations = [
msprime.PopulationConfiguration(10),
msprime.PopulationConfiguration(10),
Expand Down Expand Up @@ -4262,7 +4261,6 @@ def test_debug(self):
assert str(dbg1) == str(dbg2)

def test_population_name(self):

demography = msprime.Demography.isolated_model([1])
assert demography.populations[0].name == "pop_0"

Expand Down
2 changes: 0 additions & 2 deletions tests/test_lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,6 @@ def test_non_parametric_simulation_models(self):
assert sim.model == model

def test_dirac_simulation_model(self):

for bad_type in [None, str, "sdf"]:
model = get_simulation_model("dirac", psi=bad_type, c=1.0)
with pytest.raises(TypeError):
Expand Down Expand Up @@ -2453,7 +2452,6 @@ def test_seed_bounds(self):
gen.seed = overflow

def test_seed(self):

for s in [1, 10, 2**32 - 1]:
rng = _msprime.RandomGenerator()
rng.seed = s
Expand Down
12 changes: 6 additions & 6 deletions tests/test_mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ def validate_state_independent(self, method, **kwargs):

def verify_models_equivalent(self, model1, model2):
assert len(model1.alleles) == len(model2.alleles)
assert np.alltrue(np.equal(model1.root_distribution, model2.root_distribution))
assert np.alltrue(np.equal(model1.transition_matrix, model2.transition_matrix))
assert np.all(np.equal(model1.root_distribution, model2.root_distribution))
assert np.all(np.equal(model1.transition_matrix, model2.transition_matrix))

def test_bad_alleles(self):
for alleles, err in [
Expand Down Expand Up @@ -1519,7 +1519,6 @@ def test_layer_mutation_models(self):


class StatisticalTestMixin:

p_threshold = 0.001

def chisquare(self, observed, expected, p_th=p_threshold):
Expand Down Expand Up @@ -1604,7 +1603,6 @@ def run_mutate(
mutation_id=0,
slim_generation=1,
):

model = msprime.SLiMMutationModel(
type=mutation_type, next_id=mutation_id, slim_generation=slim_generation
)
Expand Down Expand Up @@ -1719,7 +1717,6 @@ def validate_unique_alleles(self, ts):
assert len(alleles) == len(set(alleles))

def run_mutate(self, ts, rate=1, random_seed=42, start_allele=0):

model = msprime.InfiniteAlleles(start_allele=start_allele)
mts1 = msprime.sim_mutations(
ts, rate=rate, random_seed=random_seed, model=model, discrete_genome=True
Expand Down Expand Up @@ -2132,7 +2129,10 @@ def populate_tables(self, tables):
mutation.derived_state,
parent=parent_id,
metadata=mutation.metadata,
time=mutation.time,
# Not sure why, but sometimes the time is a single-element array
time=mutation.time[0]
if isinstance(mutation.time, np.ndarray)
else mutation.time,
)
assert mutation_id > parent_id
mutation.id = mutation_id
Expand Down
2 changes: 0 additions & 2 deletions tests/test_pedigree.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ def test_two_pedigrees(self):
)

def test_three_pedigrees(self):

tables1 = simulate_pedigree(
num_founders=2,
num_generations=2,
Expand Down Expand Up @@ -778,7 +777,6 @@ class TestContinueSimulateThroughPedigree(TestSimulateThroughPedigree):
"""

def verify(self, input_tables, recombination_rate=0):

ts1 = msprime.sim_ancestry(
model="fixed_pedigree",
initial_state=input_tables,
Expand Down
5 changes: 4 additions & 1 deletion tests/test_provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ class TestBuildObjects:
"""

def decode(self, prov):
builder = pjs.ObjectBuilder(tskit.provenance.get_schema())
# Supress warnings about schemas here - it's no big deal and
# not easy to fix
with pytest.warns(UserWarning):
builder = pjs.ObjectBuilder(tskit.provenance.get_schema())
ns = builder.build_classes()
return ns.TskitProvenance.from_json(prov)

Expand Down
Loading

0 comments on commit 22d7199

Please sign in to comment.