Skip to content

Consolidate project config under pyproject #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# auto generated by setuptools_scm and configured in pyproject.toml
bio2zarr/_version.py

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -152,9 +155,9 @@ dmypy.json
# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# IDE
.vscode
.idea

# Mac
.DS_Store
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
- id: check-case-conflict
- id: check-yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.7
rev: v0.4.2
hooks:
- id: ruff
args: [ --fix ]
Expand Down
6 changes: 3 additions & 3 deletions bio2zarr/vcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import shutil
import sys
import tempfile
from typing import Any, List
from typing import Any

import cyvcf2
import humanfriendly
Expand Down Expand Up @@ -746,9 +746,9 @@ class IcfFieldWriter:
transformer: VcfValueTransformer
compressor: Any
max_buffered_bytes: int
buff: List[Any] = dataclasses.field(default_factory=list)
buff: list[Any] = dataclasses.field(default_factory=list)
buffered_bytes: int = 0
chunk_index: List[int] = dataclasses.field(default_factory=lambda: [0])
chunk_index: list[int] = dataclasses.field(default_factory=lambda: [0])
num_records: int = 0

def append(self, val):
Expand Down
7 changes: 4 additions & 3 deletions bio2zarr/vcf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import os
import pathlib
import struct
from collections.abc import Sequence
from dataclasses import dataclass
from typing import IO, Any, Dict, Optional, Sequence, Union
from typing import IO, Any, Optional, Union

import cyvcf2
import humanfriendly
Expand Down Expand Up @@ -183,7 +184,7 @@ def get_first_locus_in_bin(csi: CSIIndex, bin: int) -> int:


def read_csi(
file: PathType, storage_options: Optional[Dict[str, str]] = None
file: PathType, storage_options: Optional[dict[str, str]] = None
) -> CSIIndex:
"""Parse a CSI file into a `CSIIndex` object.

Expand Down Expand Up @@ -297,7 +298,7 @@ def offsets(self) -> Any:


def read_tabix(
file: PathType, storage_options: Optional[Dict[str, str]] = None
file: PathType, storage_options: Optional[dict[str, str]] = None
) -> TabixIndex:
"""Parse a tabix file into a `TabixIndex` object.

Expand Down
78 changes: 74 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,85 @@
[build-system]
requires = ["setuptools >= 69", "setuptools_scm[toml] >= 8"]
build-backend = "setuptools.build_meta"

[project]
name = "bio2zarr"
description = "Convert bioinformatics data to Zarr"
readme = "README.md"
license = {file = "LICENSE"}
authors = [
{name = "sgkit Developers", email = "project@pystatgen.org"},
]
dependencies = [
"numpy",
"zarr >= 2.17",
"click",
"tabulate",
"tqdm",
"humanfriendly",
# cyvcf2 also pulls in coloredlogs and click",
# colouredlogs pulls in humanfriendly",
"cyvcf2",
"bed_reader",
]
requires-python = ">=3.9"
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: Apache, Software License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering"
]
dynamic = ["version"]

[project.urls]
repository = "https://github.com/sgkit-dev/bio2zarr"
documentation = "https://sgkit-dev.github.io/bio2zarr/intro.html"

[project.scripts]
vcf2zarr = "bio2zarr.cli:vcf2zarr"
plink2zarr = "bio2zarr.cli:plink2zarr"
vcf_partition = "bio2zarr.cli:vcf_partition"

[tool.setuptools]
packages = ["bio2zarr"]

[tool.setuptools_scm]
version_file = "bio2zarr/_version.py"

[tool.pytest.ini_options]
testpaths = "tests"
addopts = "--cov=bio2zarr --cov-report term-missing"

[tool.ruff]
# Assume Python 3.9
target-version = "py39"

# Same as Black.
line-length = 88
indent-width = 4

# Assume Python 3.8
target-version = "py38"

[tool.ruff.lint]
select = ["E", "F", "B", "W", "I", "N", "UP", "A", "RUF", "PT"]
#Allow uppercase names for e.g. call_AD
ignore = ["N806", "N802", "A001", "A002"]

fixable = ["ALL"]
unfixable = []
unfixable = []

[tool.ruff.lint.isort]
known-third-party = [
"hypothesis",
"msprime",
"numpy",
"pandas",
"pytest",
"setuptools",
"sgkit",
"zarr"
]
76 changes: 0 additions & 76 deletions setup.cfg

This file was deleted.

9 changes: 0 additions & 9 deletions setup.py

This file was deleted.

Loading