pybgzf 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pybgzf-0.1.0/.gitignore +174 -0
- pybgzf-0.1.0/CONTRIBUTING.md +71 -0
- pybgzf-0.1.0/Cargo.lock +749 -0
- pybgzf-0.1.0/Cargo.toml +52 -0
- pybgzf-0.1.0/LICENSE +21 -0
- pybgzf-0.1.0/NOTICE +28 -0
- pybgzf-0.1.0/PKG-INFO +128 -0
- pybgzf-0.1.0/README.md +97 -0
- pybgzf-0.1.0/benchmarks/benchmark.py +146 -0
- pybgzf-0.1.0/pyproject.toml +245 -0
- pybgzf-0.1.0/python/pybgzf/__init__.py +35 -0
- pybgzf-0.1.0/python/pybgzf/_columns.py +149 -0
- pybgzf-0.1.0/python/pybgzf/_pybgzf.pyi +105 -0
- pybgzf-0.1.0/python/pybgzf/_reader.py +250 -0
- pybgzf-0.1.0/python/pybgzf/_writer.py +272 -0
- pybgzf-0.1.0/python/pybgzf/py.typed +0 -0
- pybgzf-0.1.0/src/block.rs +519 -0
- pybgzf-0.1.0/src/columns.rs +854 -0
- pybgzf-0.1.0/src/index.rs +431 -0
- pybgzf-0.1.0/src/khash.rs +190 -0
- pybgzf-0.1.0/src/lib.rs +42 -0
- pybgzf-0.1.0/src/python.rs +855 -0
- pybgzf-0.1.0/src/reader.rs +819 -0
- pybgzf-0.1.0/src/sniff.rs +203 -0
- pybgzf-0.1.0/src/writer.rs +844 -0
- pybgzf-0.1.0/tests/__init__.py +0 -0
- pybgzf-0.1.0/tests/conftest.py +9 -0
- pybgzf-0.1.0/tests/helpers.py +52 -0
- pybgzf-0.1.0/tests/indexes.py +83 -0
- pybgzf-0.1.0/tests/test_columns.py +97 -0
- pybgzf-0.1.0/tests/test_htslib.py +633 -0
- pybgzf-0.1.0/tests/test_packaging.py +31 -0
- pybgzf-0.1.0/tests/test_reader.py +669 -0
- pybgzf-0.1.0/tests/test_threads.py +495 -0
- pybgzf-0.1.0/tests/test_writer.py +648 -0
- pybgzf-0.1.0/uv.lock +888 -0
pybgzf-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
*$py.class
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
build/
|
|
14
|
+
develop-eggs/
|
|
15
|
+
dist/
|
|
16
|
+
downloads/
|
|
17
|
+
eggs/
|
|
18
|
+
.eggs/
|
|
19
|
+
lib/
|
|
20
|
+
lib64/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
share/python-wheels/
|
|
26
|
+
*.egg-info/
|
|
27
|
+
.installed.cfg
|
|
28
|
+
*.egg
|
|
29
|
+
MANIFEST
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py,cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
cover/
|
|
55
|
+
|
|
56
|
+
# Translations
|
|
57
|
+
*.mo
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
# Django stuff:
|
|
61
|
+
*.log
|
|
62
|
+
local_settings.py
|
|
63
|
+
db.sqlite3
|
|
64
|
+
db.sqlite3-journal
|
|
65
|
+
|
|
66
|
+
# Flask stuff:
|
|
67
|
+
instance/
|
|
68
|
+
.webassets-cache
|
|
69
|
+
|
|
70
|
+
# Scrapy stuff:
|
|
71
|
+
.scrapy
|
|
72
|
+
|
|
73
|
+
# Sphinx documentation
|
|
74
|
+
docs/_build/
|
|
75
|
+
|
|
76
|
+
# PyBuilder
|
|
77
|
+
.pybuilder/
|
|
78
|
+
target/
|
|
79
|
+
|
|
80
|
+
# Jupyter Notebook
|
|
81
|
+
.ipynb_checkpoints
|
|
82
|
+
|
|
83
|
+
# IPython
|
|
84
|
+
profile_default/
|
|
85
|
+
ipython_config.py
|
|
86
|
+
|
|
87
|
+
# pyenv
|
|
88
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
89
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
90
|
+
.python-version
|
|
91
|
+
|
|
92
|
+
# pipenv
|
|
93
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
94
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
95
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
96
|
+
# install all needed dependencies.
|
|
97
|
+
#Pipfile.lock
|
|
98
|
+
|
|
99
|
+
# poetry
|
|
100
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
101
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
102
|
+
# commonly ignored for libraries.
|
|
103
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
104
|
+
#poetry.lock
|
|
105
|
+
|
|
106
|
+
# pdm
|
|
107
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
108
|
+
#pdm.lock
|
|
109
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
110
|
+
# in version control.
|
|
111
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
112
|
+
.pdm.toml
|
|
113
|
+
|
|
114
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
115
|
+
__pypackages__/
|
|
116
|
+
|
|
117
|
+
# Celery stuff
|
|
118
|
+
celerybeat-schedule
|
|
119
|
+
celerybeat.pid
|
|
120
|
+
|
|
121
|
+
# SageMath parsed files
|
|
122
|
+
*.sage.py
|
|
123
|
+
|
|
124
|
+
# Environments
|
|
125
|
+
.env
|
|
126
|
+
.venv
|
|
127
|
+
env/
|
|
128
|
+
venv/
|
|
129
|
+
ENV/
|
|
130
|
+
env.bak/
|
|
131
|
+
venv.bak/
|
|
132
|
+
|
|
133
|
+
# Spyder project settings
|
|
134
|
+
.spyderproject
|
|
135
|
+
.spyproject
|
|
136
|
+
|
|
137
|
+
# Rope project settings
|
|
138
|
+
.ropeproject
|
|
139
|
+
|
|
140
|
+
# mkdocs documentation
|
|
141
|
+
/site
|
|
142
|
+
|
|
143
|
+
# mypy
|
|
144
|
+
.mypy_cache/
|
|
145
|
+
.dmypy.json
|
|
146
|
+
dmypy.json
|
|
147
|
+
|
|
148
|
+
# Pyre type checker
|
|
149
|
+
.pyre/
|
|
150
|
+
|
|
151
|
+
# pytype static type analyzer
|
|
152
|
+
.pytype/
|
|
153
|
+
|
|
154
|
+
# Cython debug symbols
|
|
155
|
+
cython_debug/
|
|
156
|
+
|
|
157
|
+
# PyCharm
|
|
158
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
159
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
160
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
161
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
162
|
+
.idea/
|
|
163
|
+
|
|
164
|
+
# VS Code
|
|
165
|
+
.vscode/
|
|
166
|
+
|
|
167
|
+
# Jupyter notebook files
|
|
168
|
+
*.ipynb
|
|
169
|
+
|
|
170
|
+
# Rust
|
|
171
|
+
target/
|
|
172
|
+
|
|
173
|
+
# Benchmark scratch files
|
|
174
|
+
benchmarks/out/
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Developer Documentation
|
|
2
|
+
|
|
3
|
+
## Local Compilation
|
|
4
|
+
|
|
5
|
+
Install [uv](https://docs.astral.sh/uv/) and a [Rust toolchain](https://rustup.rs), then build the extension and install the development environment with:
|
|
6
|
+
|
|
7
|
+
```console
|
|
8
|
+
uv sync --locked
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The extension is built with [maturin](https://www.maturin.rs), and `uv sync` rebuilds it whenever the Rust sources change.
|
|
12
|
+
|
|
13
|
+
## Local Testing
|
|
14
|
+
|
|
15
|
+
To ensure all tests pass, run:
|
|
16
|
+
|
|
17
|
+
```console
|
|
18
|
+
uv run poe check-tests
|
|
19
|
+
cargo test --no-default-features
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Tests that compare output against htslib run only when `bgzip` and `tabix` are on the `PATH`, for example after `brew install htslib` or `sudo apt-get install tabix`.
|
|
23
|
+
The VCF comparisons also need htslib 1.23 or newer, whose rules for the end of a VCF record `pybgzf` follows.
|
|
24
|
+
The randomized comparisons draw new files with [Hypothesis](https://hypothesis.readthedocs.io) on every run, except when `CI` is set, where they draw the same files each time.
|
|
25
|
+
|
|
26
|
+
## Fuzzing
|
|
27
|
+
|
|
28
|
+
The [cargo-fuzz](https://rust-fuzz.github.io/book/cargo-fuzz.html) targets in `fuzz/` parse and index arbitrary lines, and the [`fuzz.yml`](.github/workflows/fuzz.yml) workflow runs each for ten minutes every week.
|
|
29
|
+
To run one locally, install a nightly toolchain and `cargo install cargo-fuzz`, then run:
|
|
30
|
+
|
|
31
|
+
```console
|
|
32
|
+
cargo +nightly fuzz run parse_columns -- -dict=fuzz/columns.dict
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Local Linting and Formatting
|
|
36
|
+
|
|
37
|
+
To check the format, lint, and types of all the code, and run every test, run:
|
|
38
|
+
|
|
39
|
+
```console
|
|
40
|
+
uv run poe check-all
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
To fix what can be fixed automatically, run:
|
|
44
|
+
|
|
45
|
+
```console
|
|
46
|
+
uv run poe fix-all
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Benchmarks
|
|
50
|
+
|
|
51
|
+
Compare against the standard library's `gzip` and, if installed, `bgzip` and `tabix` with:
|
|
52
|
+
|
|
53
|
+
```console
|
|
54
|
+
uv run python benchmarks/benchmark.py 200
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Releasing
|
|
58
|
+
|
|
59
|
+
Releases are published to PyPI by the [`publish_pybgzf.yml`](.github/workflows/publish_pybgzf.yml) workflow with PyPI Trusted Publishing, so no API token is stored in GitHub.
|
|
60
|
+
|
|
61
|
+
To release:
|
|
62
|
+
|
|
63
|
+
1. Bump the version in `Cargo.toml`, the only place it is set, since `pyproject.toml` reads it from there, run `cargo update --workspace` to update `Cargo.lock`, and merge a pull request titled `chore(release): bump to X.Y.Z` into `main`.
|
|
64
|
+
2. Tag the merge commit on `main` and push the tag:
|
|
65
|
+
|
|
66
|
+
```console
|
|
67
|
+
git tag X.Y.Z
|
|
68
|
+
git push origin X.Y.Z
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
3. The workflow checks that the tag matches the version, runs the tests, builds the sdist and wheels for every platform, checks that each wheel installs and imports, publishes to PyPI, and creates a GitHub release with notes generated by git-cliff.
|