diff --git a/.circleci/config.yml b/.circleci/config.yml index 1cbed9e..1f8ae89 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,8 @@ -version: 2 +version: 2.1 + +orbs: + codecov: codecov/codecov@3.2.4 + jobs: build: docker: @@ -27,9 +31,11 @@ jobs: # Run setup.py so that the version is defined python3 setup.py build python3 -m pytest --cov=tszip --cov-report=xml --cov-branch -n 2 tests - codecov rm .coverage + - codecov/upload: + token: CODECOV_TOKEN + - run: name: Build Python package command: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ec0a901..7c6f59f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,22 +8,22 @@ on: jobs: pre-commit: name: Lint - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.6.0 with: access_token: ${{ github.token }} - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.0 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 test: name: Python runs-on: ${{ matrix.os }} strategy: matrix: - python: [ 3.7, 3.9 ] + python: [ 3.8, "3.10" ] os: [ macos-latest, ubuntu-latest, windows-latest ] defaults: run: @@ -48,7 +48,7 @@ jobs: /usr/share/miniconda/envs/anaconda-client-env ~/osx-conda ~/.profile - key: ${{ runner.os }}-${{ matrix.python}}-conda-v10-${{ hashFiles('requirements/CI-tests-conda.txt') }} + key: ${{ runner.os }}-${{ matrix.python}}-conda-v12-${{ hashFiles('requirements/CI-tests-conda.txt') }} - name: Install Conda uses: conda-incubator/setup-miniconda@v2 diff --git a/.mergify.yml b/.mergify.yml index 2408c9b..018c8fa 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -31,7 +31,6 @@ pull_request_rules: queue: name: default method: rebase - rebase_fallback: none update_method: rebase - name: Remove label after merge diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d7c1e3f..23de13e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.4.0 hooks: - id: check-merge-conflict - id: debug-statements @@ -8,21 +8,21 @@ repos: - id: check-case-conflict - id: check-yaml - repo: https://github.com/asottile/reorder_python_imports - rev: v2.4.0 + rev: v3.9.0 hooks: - id: reorder-python-imports - repo: https://github.com/asottile/pyupgrade - rev: v2.12.0 + rev: v3.3.1 hooks: - id: pyupgrade args: [--py3-plus, --py36-plus] - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 23.3.0 hooks: - id: black language_version: python3 - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.1 + - repo: https://github.com/pycqa/flake8 + rev: 6.0.0 hooks: - id: flake8 args: [--config=.flake8] diff --git a/requirements/CI-tests-conda.txt b/requirements/CI-tests-conda.txt index cf109c0..7b8e8cf 100644 --- a/requirements/CI-tests-conda.txt +++ b/requirements/CI-tests-conda.txt @@ -4,5 +4,5 @@ msprime==1.1.0 pytest==6.2.5 pytest-cov==3.0.0 pytest-xdist==2.5.0 -tskit==0.4.1 +tskit==0.5.4 zarr==2.10.3 diff --git a/requirements/development.txt b/requirements/development.txt index f801ebe..8e77e2b 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -1,4 +1,3 @@ -codecov coverage flake8 h5py diff --git a/tests/test_cli.py b/tests/test_cli.py index a2917d4..971186d 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -288,11 +288,10 @@ def test_bad_file_format(self): with self.assertRaises(TestException): self.run_tszip([str(self.trees_path)]) mocked_exit.assert_called_once_with( - f"Error loading '{self.trees_path}': File not in kastore format. If this" - f" file was generated by msprime < 0.6.0 (June 2018) it uses the old" - f" HDF5-based format which can no longer be read directly. Please" - f" convert to the new kastore format using the ``tskit upgrade``" - f" command." + f"Error loading '{self.trees_path}': File not in kastore format. Either" + f" the file is corrupt or it is not a tskit tree sequence file. It may" + f" be a legacy HDF file upgradable with `tskit upgrade` or a compressed" + f" tree sequence file that can be decompressed with `tszip`." ) def test_compress_stdout_keep(self): diff --git a/tests/test_compression.py b/tests/test_compression.py index 8975042..b336074 100644 --- a/tests/test_compression.py +++ b/tests/test_compression.py @@ -57,36 +57,36 @@ def test_int16(self): self.verify( np.int16, np.array( - [2 ** 15 - 1, -(2 ** 15) + 1, 2 ** 7 + 1, -(2 ** 7) - 1], dtype=np.int64 + [2**15 - 1, -(2**15) + 1, 2**7 + 1, -(2**7) - 1], dtype=np.int64 ), ) def test_uint16(self): - self.verify(np.uint16, np.array([256, 2 ** 16 - 1], dtype=np.uint64)) + self.verify(np.uint16, np.array([256, 2**16 - 1], dtype=np.uint64)) def test_int32(self): self.verify( np.int32, np.array( - [2 ** 31 - 1, -(2 ** 31) + 1, 2 ** 15 + 1, -(2 ** 15) - 1], + [2**31 - 1, -(2**31) + 1, 2**15 + 1, -(2**15) - 1], dtype=np.int64, ), ) def test_uint32(self): - self.verify(np.uint32, np.array([2 ** 16 + 1, 2 ** 32 - 1], dtype=np.uint64)) + self.verify(np.uint32, np.array([2**16 + 1, 2**32 - 1], dtype=np.uint64)) def test_int64(self): self.verify( np.int64, np.array( - [2 ** 63 - 1, -(2 ** 63) + 1, 2 ** 31 + 1, -(2 ** 31) - 1], + [2**63 - 1, -(2**63) + 1, 2**31 + 1, -(2**31) - 1], dtype=np.int64, ), ) def test_uint64(self): - self.verify(np.uint64, np.array([2 ** 32 + 1, 2 ** 64 - 1], dtype=np.uint64)) + self.verify(np.uint64, np.array([2**32 + 1, 2**64 - 1], dtype=np.uint64)) def test_float32(self): self.verify(np.float32, np.array([0.1, 1e-3], dtype=np.float32)) diff --git a/tszip/compression.py b/tszip/compression.py index 4b7f764..89c01ca 100644 --- a/tszip/compression.py +++ b/tszip/compression.py @@ -107,7 +107,7 @@ def compress(ts, destination, variants_only=False): else: # Assume that destination is a file-like object open in "wb" mode. with open(filename, "rb") as source: - chunk_size = 2 ** 10 # 1MiB + chunk_size = 2**10 # 1MiB for chunk in iter(functools.partial(source.read, chunk_size), b""): destination.write(chunk) @@ -167,7 +167,6 @@ def compress(self, root, compressor): def compress_zarr(ts, root, variants_only=False): - provenance_dict = provenance.get_provenance_dict({"variants_only": variants_only}) if variants_only: