pydreg 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.
Files changed (43) hide show
  1. pydreg-0.1.0/.gitattributes +2 -0
  2. pydreg-0.1.0/.github/workflows/ci.yml +70 -0
  3. pydreg-0.1.0/.github/workflows/publish.yml +39 -0
  4. pydreg-0.1.0/.gitignore +186 -0
  5. pydreg-0.1.0/CONTRIBUTING.md +52 -0
  6. pydreg-0.1.0/LICENSE +674 -0
  7. pydreg-0.1.0/PKG-INFO +144 -0
  8. pydreg-0.1.0/README.md +109 -0
  9. pydreg-0.1.0/docs/METHODS.md +117 -0
  10. pydreg-0.1.0/docs/OPTIMIZATION.md +132 -0
  11. pydreg-0.1.0/docs/PERF_LOG.md +1055 -0
  12. pydreg-0.1.0/docs/PLANNING.md +216 -0
  13. pydreg-0.1.0/pyproject.toml +86 -0
  14. pydreg-0.1.0/scripts/_safetensors_io.py +32 -0
  15. pydreg-0.1.0/scripts/bench_backends.py +105 -0
  16. pydreg-0.1.0/scripts/dreg_model.py +136 -0
  17. pydreg-0.1.0/scripts/dreg_rf_model.py +125 -0
  18. pydreg-0.1.0/scripts/export_dreg_model.R +87 -0
  19. pydreg-0.1.0/scripts/export_dreg_rf_model.R +91 -0
  20. pydreg-0.1.0/scripts/pack_safetensors.py +85 -0
  21. pydreg-0.1.0/src/pydreg/__init__.py +0 -0
  22. pydreg-0.1.0/src/pydreg/_safetensors_io.py +31 -0
  23. pydreg-0.1.0/src/pydreg/backend.py +163 -0
  24. pydreg-0.1.0/src/pydreg/cli.py +108 -0
  25. pydreg-0.1.0/src/pydreg/features.py +192 -0
  26. pydreg-0.1.0/src/pydreg/infp.py +116 -0
  27. pydreg-0.1.0/src/pydreg/io.py +103 -0
  28. pydreg-0.1.0/src/pydreg/models.py +227 -0
  29. pydreg-0.1.0/src/pydreg/peaks.py +577 -0
  30. pydreg-0.1.0/src/pydreg/pipeline.py +169 -0
  31. pydreg-0.1.0/src/pydreg/rfsplit.py +300 -0
  32. pydreg-0.1.0/src/pydreg/smoothing.py +104 -0
  33. pydreg-0.1.0/src/pydreg/stats.py +452 -0
  34. pydreg-0.1.0/tests/conftest.py +65 -0
  35. pydreg-0.1.0/tests/test_backend.py +116 -0
  36. pydreg-0.1.0/tests/test_features.py +129 -0
  37. pydreg-0.1.0/tests/test_io.py +55 -0
  38. pydreg-0.1.0/tests/test_peaks.py +136 -0
  39. pydreg-0.1.0/tests/test_pipeline.py +33 -0
  40. pydreg-0.1.0/tests/test_rfsplit.py +44 -0
  41. pydreg-0.1.0/tests/test_smoothing.py +21 -0
  42. pydreg-0.1.0/tests/test_stats.py +251 -0
  43. pydreg-0.1.0/uv.lock +1594 -0
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,70 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+ workflow_dispatch:
9
+
10
+ concurrency:
11
+ group: ci-${{ github.workflow }}-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ test:
16
+ name: Python ${{ matrix.python-version }}
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ python-version:
22
+ - "3.11"
23
+ - "3.12"
24
+
25
+ steps:
26
+ - name: Check out repository
27
+ uses: actions/checkout@v4
28
+
29
+ - name: Install uv
30
+ uses: astral-sh/setup-uv@v6
31
+ with:
32
+ enable-cache: true
33
+
34
+ - name: Set up Python
35
+ uses: actions/setup-python@v5
36
+ with:
37
+ python-version: ${{ matrix.python-version }}
38
+
39
+ - name: Install dependencies
40
+ run: uv sync --locked --group dev
41
+
42
+ - name: Run tests
43
+ run: uv run pytest tests/ -q
44
+
45
+ build:
46
+ name: Build distribution
47
+ runs-on: ubuntu-latest
48
+
49
+ steps:
50
+ - name: Check out repository
51
+ uses: actions/checkout@v4
52
+
53
+ - name: Install uv
54
+ uses: astral-sh/setup-uv@v6
55
+ with:
56
+ enable-cache: true
57
+
58
+ - name: Set up Python
59
+ uses: actions/setup-python@v5
60
+ with:
61
+ python-version: "3.11"
62
+
63
+ - name: Build package
64
+ run: uv build
65
+
66
+ - name: Upload distribution artifacts
67
+ uses: actions/upload-artifact@v4
68
+ with:
69
+ name: dist
70
+ path: dist/*
@@ -0,0 +1,39 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types:
6
+ - published
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+ id-token: write
12
+
13
+ jobs:
14
+ publish:
15
+ name: Publish to PyPI
16
+ runs-on: ubuntu-latest
17
+ environment:
18
+ name: pypi
19
+ url: https://pypi.org/p/pydreg
20
+
21
+ steps:
22
+ - name: Check out repository
23
+ uses: actions/checkout@v4
24
+
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@v6
27
+ with:
28
+ enable-cache: true
29
+
30
+ - name: Set up Python
31
+ uses: actions/setup-python@v5
32
+ with:
33
+ python-version: "3.11"
34
+
35
+ - name: Build package
36
+ run: uv build
37
+
38
+ - name: Publish package
39
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,186 @@
1
+ **/.DS_Store
2
+ **/.vscode
3
+ _reference/
4
+ _models/
5
+
6
+ # Byte-compiled / optimized / DLL files
7
+ __pycache__/
8
+ *.py[cod]
9
+ *$py.class
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ downloads/
20
+ eggs/
21
+ .eggs/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ sdist/
26
+ var/
27
+ wheels/
28
+ share/python-wheels/
29
+ *.egg-info/
30
+ .installed.cfg
31
+ *.egg
32
+ MANIFEST
33
+
34
+ # PyInstaller
35
+ # Usually these files are written by a python script from a template
36
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
37
+ *.manifest
38
+ *.spec
39
+
40
+ # Installer logs
41
+ pip-log.txt
42
+ pip-delete-this-directory.txt
43
+
44
+ # Unit test / coverage reports
45
+ htmlcov/
46
+ .tox/
47
+ .nox/
48
+ .coverage
49
+ .coverage.*
50
+ .cache
51
+ nosetests.xml
52
+ coverage.xml
53
+ *.cover
54
+ *.py,cover
55
+ .hypothesis/
56
+ .pytest_cache/
57
+ cover/
58
+
59
+ # Translations
60
+ *.mo
61
+ *.pot
62
+
63
+ # Django stuff:
64
+ *.log
65
+ local_settings.py
66
+ db.sqlite3
67
+ db.sqlite3-journal
68
+
69
+ # Flask stuff:
70
+ instance/
71
+ .webassets-cache
72
+
73
+ # Scrapy stuff:
74
+ .scrapy
75
+
76
+ # Sphinx documentation
77
+ docs/_build/
78
+
79
+ # PyBuilder
80
+ .pybuilder/
81
+ target/
82
+
83
+ # Jupyter Notebook
84
+ .ipynb_checkpoints
85
+
86
+ # IPython
87
+ profile_default/
88
+ ipython_config.py
89
+
90
+ # pyenv
91
+ # For a library or package, you might want to ignore these files since the code is
92
+ # intended to run in multiple environments; otherwise, check them in:
93
+ # .python-version
94
+
95
+ # pipenv
96
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
97
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
98
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
99
+ # install all needed dependencies.
100
+ #Pipfile.lock
101
+
102
+ # UV
103
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
104
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
105
+ # commonly ignored for libraries.
106
+ #uv.lock
107
+
108
+ # poetry
109
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
110
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
111
+ # commonly ignored for libraries.
112
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
113
+ #poetry.lock
114
+
115
+ # pdm
116
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
117
+ #pdm.lock
118
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
119
+ # in version control.
120
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
121
+ .pdm.toml
122
+ .pdm-python
123
+ .pdm-build/
124
+
125
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
126
+ __pypackages__/
127
+
128
+ # Celery stuff
129
+ celerybeat-schedule
130
+ celerybeat.pid
131
+
132
+ # SageMath parsed files
133
+ *.sage.py
134
+
135
+ # Environments
136
+ .env
137
+ .venv
138
+ env/
139
+ venv/
140
+ ENV/
141
+ env.bak/
142
+ venv.bak/
143
+
144
+ # Spyder project settings
145
+ .spyderproject
146
+ .spyproject
147
+
148
+ # Rope project settings
149
+ .ropeproject
150
+
151
+ # mkdocs documentation
152
+ /site
153
+
154
+ # mypy
155
+ .mypy_cache/
156
+ .dmypy.json
157
+ dmypy.json
158
+
159
+ # Pyre type checker
160
+ .pyre/
161
+
162
+ # pytype static type analyzer
163
+ .pytype/
164
+
165
+ # Cython debug symbols
166
+ cython_debug/
167
+
168
+ # PyCharm
169
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
170
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
171
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
172
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
173
+ #.idea/
174
+
175
+ # Ruff stuff:
176
+ .ruff_cache/
177
+
178
+ # PyPI configuration file
179
+ .pypirc
180
+
181
+ # Cursor
182
+ # Cursor is an AI-powered code editor.`.cursorignore` specifies files/directories to
183
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
184
+ # refer to https://docs.cursor.com/context/ignore-files
185
+ .cursorignore
186
+ .cursorindexingignore
@@ -0,0 +1,52 @@
1
+ # Contributing to pydreg
2
+
3
+ ## Setup
4
+
5
+ ```bash
6
+ git clone https://github.com/adamyhe/pydreg.git
7
+ cd pydreg
8
+ uv sync --extra gpu --group dev
9
+ uv run pytest tests/ -q
10
+ ```
11
+
12
+ `uv sync --extra gpu` is safe on any platform: the `gpu` extra (cuML) only
13
+ resolves on Linux with a matching architecture, and is a no-op elsewhere
14
+ rather than a failure.
15
+
16
+ ## Tests
17
+
18
+ ```bash
19
+ uv run pytest tests/ -q
20
+ ```
21
+
22
+ The suite (40 tests as of this writing) covers each module in isolation
23
+ plus a full synthetic end-to-end pipeline run. Model-dependent tests are
24
+ skipped (not failed) if the Hugging Face repo hosting the pretrained
25
+ weights is unreachable.
26
+
27
+ ## Before making changes
28
+
29
+ - **Algorithmic/structural changes**: read `docs/PLANNING.md` first. It's
30
+ the comprehensive design record — module boundaries, exact algorithm
31
+ specs, and, importantly, a full list of upstream R quirks that are
32
+ reproduced deliberately rather than "fixed," because the pretrained
33
+ model's expected output depends on them. Breaking one of those
34
+ intentionally-kept quirks is a correctness regression, not a cleanup.
35
+ - **Performance changes**: read `docs/PERF_LOG.md` first, and append a new
36
+ dated entry for any change you make. Its ground rule applies to any PR
37
+ touching performance: a change must not alter the pipeline's output
38
+ (same scores, same peaks), verified against the test suite and, ideally,
39
+ a full CLI diff — "looks right" isn't sufficient. `docs/OPTIMIZATION.md`
40
+ has the plain-language summary of the design choices already in place if
41
+ you want the short version first.
42
+ - For a plain-language overview of the algorithm itself (not the
43
+ implementation), see `docs/METHODS.md`.
44
+
45
+ ## Pull requests
46
+
47
+ Keep changes scoped and include tests for new behavior. If a change
48
+ affects scores or peak calls in any way, say so explicitly and explain why
49
+ (e.g. a genuine bug fix vs. an intentional behavior change) — silent output
50
+ changes are the one thing this project can't tolerate, given how much of
51
+ it exists specifically to match a pretrained model's expected input/output
52
+ distribution.