Skip to content

Commit

Permalink
Merge pull request #315 from bashtage/remove-distutils
Browse files Browse the repository at this point in the history
Remove distutils
  • Loading branch information
bashtage authored May 24, 2022
2 parents 3015e67 + 597faa7 commit 2d25646
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ build/
**/Random123
settings.json
*.so
randomgen/_version.py
randomgen/bounded_integers.pyx
randomgen/bounded_integers.pxd
randomgen/*.c
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This package contains additional bit generators for NumPy's
[![Build Status](https://dev.azure.com/kevinksheppard0207/kevinksheppard/_apis/build/status/bashtage.randomgen?branchName=main)](https://dev.azure.com/kevinksheppard0207/kevinksheppard/_build/latest?definitionId=2&branchName=main)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/46r9xsmuwi8bxsbj/branch/main?svg=true)](https://ci.appveyor.com/project/bashtage/randomgen/branch/main)
[![Build Status](https://cloud.drone.io/api/badges/bashtage/randomgen/status.svg)](https://cloud.drone.io/bashtage/randomgen)
[![FreeBSD Status on Cirrus](https://api.cirrus-ci.com/github/bashtage/randomgen.svg)](https://cirrus-ci.com/github/bashtage/randomgen)
[![FreeBSD Status on Cirrus](https://api.cirrus-ci.com/github/bashtage/randomgen.svg?branch=main)](https://cirrus-ci.com/github/bashtage/randomgen)

**Coverage**

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"packaging>=21.0; platform_machine=='arm64'",
"packaging>=21.0",
"setuptools",
"wheel",
"Cython>=0.29.24,<3.0",
Expand Down
2 changes: 1 addition & 1 deletion randomgen/examples/cython/setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# python setup.py build_ext -i
from setuptools import setup
from setuptools.extension import Extension

from distutils.core import setup
from os.path import join

from Cython.Build import cythonize
Expand Down
7 changes: 3 additions & 4 deletions randomgen/tests/test_against_numpy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from distutils.version import LooseVersion

import numpy as np
import numpy.random
from numpy.testing import (
Expand All @@ -8,15 +6,16 @@
assert_equal,
suppress_warnings,
)
from packaging.version import parse
import pytest

import randomgen
from randomgen import MT19937, Generator
import randomgen.generator
from randomgen.mtrand import RandomState

NP_VERSION = LooseVersion(np.__version__)
NP_118 = LooseVersion("1.18") <= NP_VERSION < LooseVersion("1.19")
NP_VERSION = parse(np.__version__)
NP_118 = parse("1.18") <= NP_VERSION < parse("1.19")


def compare_0_input(f1, f2):
Expand Down
5 changes: 2 additions & 3 deletions randomgen/tests/test_bit_generators_against_numpy.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from distutils.version import LooseVersion

import numpy as np
from packaging.version import parse
import pytest

import randomgen
from randomgen import PCG64, SFC64, Philox, SeedSequence

NP_LT_119 = LooseVersion(np.__version__) < LooseVersion("1.19.0")
NP_LT_119 = parse(np.__version__) < parse("1.19.0")

pytestmark = pytest.mark.skipif(NP_LT_119, reason="Only test Numpy 1.19+")

Expand Down
4 changes: 2 additions & 2 deletions randomgen/tests/test_extended_generator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import copy
from distutils.version import LooseVersion
import pickle

import numpy as np
Expand All @@ -13,6 +12,7 @@
assert_warns,
suppress_warnings,
)
from packaging.version import parse
import pytest

from randomgen import MT19937, PCG64, ExtendedGenerator
Expand Down Expand Up @@ -57,7 +57,7 @@ def extended_gen_legacy():
_mt19937 = MT19937(SEED, mode="legacy")
random = ExtendedGenerator(_mt19937)

NP_LT_118 = LooseVersion(np.__version__) < LooseVersion("1.18.0")
NP_LT_118 = parse(np.__version__) < parse("1.18.0")


@pytest.mark.skipif(NP_LT_118, reason="Can only test with NumPy >= 1.18")
Expand Down
10 changes: 5 additions & 5 deletions randomgen/tests/test_generator_117.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from distutils.version import LooseVersion
from itertools import product
from typing import cast

import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
from packaging.version import parse
import pytest

from randomgen import Generator
Expand All @@ -20,10 +20,10 @@
from randomgen import PCG64 # type: ignore[misc]


NP_LT_1174 = LooseVersion(np.__version__) < LooseVersion("1.17.4")
NP_GTE_118 = LooseVersion(np.__version__) >= LooseVersion("1.18")
NP_GTE_120 = LooseVersion(np.__version__) >= LooseVersion("1.20")
NP_GTE_121 = LooseVersion(np.__version__) >= LooseVersion("1.21")
NP_LT_1174 = parse(np.__version__) < parse("1.17.4")
NP_GTE_118 = parse(np.__version__) >= parse("1.18")
NP_GTE_120 = parse(np.__version__) >= parse("1.20")
NP_GTE_121 = parse(np.__version__) >= parse("1.21")

pytestmark = pytest.mark.skipif(NP_LT_1174, reason="Only test 1.17.4+")

Expand Down
4 changes: 2 additions & 2 deletions randomgen/tests/test_generator_mt19937.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from distutils.version import LooseVersion
import hashlib
import sys
import warnings
Expand All @@ -16,14 +15,15 @@
assert_warns,
suppress_warnings,
)
from packaging.version import parse
import pytest

from randomgen import MT19937, Generator
from randomgen.tests.test_direct import assert_state_equal

random = Generator(MT19937(mode="legacy"))

NP_LT_118 = LooseVersion(np.__version__) < LooseVersion("1.18.0")
NP_LT_118 = parse(np.__version__) < parse("1.18.0")

JUMP_TEST_DATA = {
("_jump_tester", (0,), 10): {
Expand Down
6 changes: 3 additions & 3 deletions randomgen/tests/test_recent_numpy_changes.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from distutils.version import LooseVersion
from typing import cast

import numpy as np
from numpy.testing import assert_equal
from packaging.version import parse
import pytest

from randomgen import Generator

v119 = LooseVersion("1.19")
NP_LT_119 = LooseVersion(np.__version__) < v119
v119 = parse("1.19")
NP_LT_119 = parse(np.__version__) < v119


pytestmark = pytest.mark.skipif(NP_LT_119, reason="Only test NumPy 1.19+")
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pytest-cov
scipy>=1.3.2
setuptools_scm[toml]>=6.4.2,<7.0.0
oldest_supported_numpy
packaging>=21.0

0 comments on commit 2d25646

Please sign in to comment.