openconf 0.0.1__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.
- openconf-0.0.1/.coveragerc +23 -0
- openconf-0.0.1/.editorconfig +16 -0
- openconf-0.0.1/.envrc +2 -0
- openconf-0.0.1/.github/workflows/publish.yml +27 -0
- openconf-0.0.1/.github/workflows/test.yml +45 -0
- openconf-0.0.1/.gitignore +185 -0
- openconf-0.0.1/.pre-commit-config.yaml +43 -0
- openconf-0.0.1/AGENTS.md +288 -0
- openconf-0.0.1/LICENSE +21 -0
- openconf-0.0.1/PKG-INFO +440 -0
- openconf-0.0.1/README.md +426 -0
- openconf-0.0.1/SCIENCE.md +125 -0
- openconf-0.0.1/benchmarks/_api_check.py +40 -0
- openconf-0.0.1/benchmarks/perf_bench.py +164 -0
- openconf-0.0.1/benchmarks/profile_maraviroc.py +52 -0
- openconf-0.0.1/benchmarks/use_case_configs.py +174 -0
- openconf-0.0.1/conftest.py +3 -0
- openconf-0.0.1/docs/benchmark_report.md +219 -0
- openconf-0.0.1/docs/macrocycle_benchmark_report.md +197 -0
- openconf-0.0.1/openconf/__init__.py +53 -0
- openconf-0.0.1/openconf/api.py +209 -0
- openconf-0.0.1/openconf/config.py +225 -0
- openconf-0.0.1/openconf/data/__init__.py +1 -0
- openconf-0.0.1/openconf/data/torsion_library.json +5044 -0
- openconf-0.0.1/openconf/dedupe.py +79 -0
- openconf-0.0.1/openconf/io.py +212 -0
- openconf-0.0.1/openconf/perceive.py +413 -0
- openconf-0.0.1/openconf/pool.py +379 -0
- openconf-0.0.1/openconf/propose/__init__.py +5 -0
- openconf-0.0.1/openconf/propose/hybrid.py +670 -0
- openconf-0.0.1/openconf/relax.py +146 -0
- openconf-0.0.1/openconf/torsionlib.py +212 -0
- openconf-0.0.1/pyproject.toml +87 -0
- openconf-0.0.1/scripts/bench_utils.py +125 -0
- openconf-0.0.1/scripts/benchmark_analysis.py +351 -0
- openconf-0.0.1/scripts/benchmark_lib.py +526 -0
- openconf-0.0.1/scripts/blog_figures/openconf_advantage.pdf +0 -0
- openconf-0.0.1/scripts/blog_figures/openconf_advantage.png +0 -0
- openconf-0.0.1/scripts/blog_figures/pareto_quality_speed.pdf +0 -0
- openconf-0.0.1/scripts/blog_figures/pareto_quality_speed.png +0 -0
- openconf-0.0.1/scripts/blog_figures/recall_vs_budget.pdf +0 -0
- openconf-0.0.1/scripts/blog_figures/recall_vs_budget.png +0 -0
- openconf-0.0.1/scripts/blog_figures/rmsd_cdf_N200.pdf +0 -0
- openconf-0.0.1/scripts/blog_figures/rmsd_cdf_N200.png +0 -0
- openconf-0.0.1/scripts/blog_figures/rmsd_cdf_N50.pdf +0 -0
- openconf-0.0.1/scripts/blog_figures/rmsd_cdf_N50.png +0 -0
- openconf-0.0.1/scripts/blog_figures/rmsd_cdf_stratified_N50.pdf +0 -0
- openconf-0.0.1/scripts/blog_figures/rmsd_cdf_stratified_N50.png +0 -0
- openconf-0.0.1/scripts/blog_figures/runtime_vs_budget.pdf +0 -0
- openconf-0.0.1/scripts/blog_figures/runtime_vs_budget.png +0 -0
- openconf-0.0.1/scripts/blog_figures/stratified_recall_N200.pdf +0 -0
- openconf-0.0.1/scripts/blog_figures/stratified_recall_N200.png +0 -0
- openconf-0.0.1/scripts/blog_figures/stratified_recall_N50.pdf +0 -0
- openconf-0.0.1/scripts/blog_figures/stratified_recall_N50.png +0 -0
- openconf-0.0.1/scripts/comprehensive_benchmark.py +275 -0
- openconf-0.0.1/scripts/download_pdbbind.py +257 -0
- openconf-0.0.1/scripts/fair_benchmark.py +438 -0
- openconf-0.0.1/scripts/fair_benchmark_full_results.csv +5401 -0
- openconf-0.0.1/scripts/iridium_benchmark_results.csv +121 -0
- openconf-0.0.1/scripts/iridium_comprehensive_results.csv +121 -0
- openconf-0.0.1/scripts/iridium_comprehensive_results.tex +18 -0
- openconf-0.0.1/scripts/macrocycle_benchmark.py +558 -0
- openconf-0.0.1/scripts/macrocycle_benchmark_results.csv +235 -0
- openconf-0.0.1/scripts/make_blog_figures.py +361 -0
- openconf-0.0.1/scripts/scaling_benchmark.py +246 -0
- openconf-0.0.1/scripts/scaling_results.csv +31 -0
- openconf-0.0.1/tests/__init__.py +1 -0
- openconf-0.0.1/tests/test_basic.py +434 -0
- openconf-0.0.1/tests/test_stub.py +5 -0
- openconf-0.0.1/uv.lock +727 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[run]
|
|
2
|
+
source = openconf
|
|
3
|
+
omit = openconf/__main__.py
|
|
4
|
+
|
|
5
|
+
[report]
|
|
6
|
+
exclude_lines =
|
|
7
|
+
# Have to re-enable the standard pragma
|
|
8
|
+
pragma: no cover
|
|
9
|
+
|
|
10
|
+
# Don't complain about missing debug-only code:
|
|
11
|
+
def __repr__
|
|
12
|
+
if self\.debug
|
|
13
|
+
|
|
14
|
+
# Don't complain if tests don't hit defensive assertion code:
|
|
15
|
+
raise AssertionError
|
|
16
|
+
raise NotImplementedError
|
|
17
|
+
|
|
18
|
+
# Don't complain if non-runnable code isn't run:
|
|
19
|
+
if 0:
|
|
20
|
+
if __name__ == .__main__.:
|
|
21
|
+
|
|
22
|
+
# Don't complain if an ellipsis isn't run (typically in an abstractmethod):
|
|
23
|
+
^\s*\.\.\.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# http://editorconfig.org/#file-format-details
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
indent_size = 4
|
|
8
|
+
indent_style = space
|
|
9
|
+
insert_final_newline = true
|
|
10
|
+
trim_trailing_whitespace = true
|
|
11
|
+
|
|
12
|
+
[*.md]
|
|
13
|
+
trim_trailing_whitespace = false
|
|
14
|
+
|
|
15
|
+
[Makefile]
|
|
16
|
+
indent_style = tab
|
openconf-0.0.1/.envrc
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Upload Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
deploy:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v6
|
|
16
|
+
|
|
17
|
+
- name: Install the latest version of uv
|
|
18
|
+
uses: astral-sh/setup-uv@v7.4.0
|
|
19
|
+
|
|
20
|
+
- name: Build package
|
|
21
|
+
run: uv build
|
|
22
|
+
|
|
23
|
+
- name: Publish package
|
|
24
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
25
|
+
with:
|
|
26
|
+
user: __token__
|
|
27
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request: {}
|
|
5
|
+
push:
|
|
6
|
+
branches: master
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: '0 4 * * 1' # Mondays at 4am UTC
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ['3.13']
|
|
15
|
+
os: [ubuntu-latest]
|
|
16
|
+
|
|
17
|
+
name: Test openconf ${{ matrix.python-version }}
|
|
18
|
+
runs-on: ${{ matrix.os }}
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v6
|
|
22
|
+
|
|
23
|
+
- name: Install the latest version of uv
|
|
24
|
+
uses: astral-sh/setup-uv@v7.4.0
|
|
25
|
+
with:
|
|
26
|
+
enable-cache: true
|
|
27
|
+
- name: Install Python
|
|
28
|
+
run: uv python install ${{ matrix.python-version }}
|
|
29
|
+
|
|
30
|
+
- run: uv run ruff format .
|
|
31
|
+
- run: uv run ruff check .
|
|
32
|
+
- run: uv run ty check .
|
|
33
|
+
|
|
34
|
+
- name: Regular tests
|
|
35
|
+
if: github.event_name != 'schedule'
|
|
36
|
+
run: uv run pytest --cov --cov-report=xml
|
|
37
|
+
|
|
38
|
+
- name: Regression tests nightly
|
|
39
|
+
if: github.event_name == 'schedule'
|
|
40
|
+
run: uv run pytest -m 'regression or not regression' --cov --cov-report=xml
|
|
41
|
+
|
|
42
|
+
- name: Upload Coverage to Codecov
|
|
43
|
+
uses: codecov/codecov-action@v4
|
|
44
|
+
env:
|
|
45
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Created by https://www.toptal.com/developers/gitignore/api/python
|
|
2
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=python
|
|
3
|
+
|
|
4
|
+
### Python ###
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
share/python-wheels/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
MANIFEST
|
|
32
|
+
|
|
33
|
+
# PyInstaller
|
|
34
|
+
# Usually these files are written by a python script from a template
|
|
35
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
36
|
+
*.manifest
|
|
37
|
+
*.spec
|
|
38
|
+
|
|
39
|
+
# Installer logs
|
|
40
|
+
pip-log.txt
|
|
41
|
+
pip-delete-this-directory.txt
|
|
42
|
+
|
|
43
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.nox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*.cover
|
|
53
|
+
*.py,cover
|
|
54
|
+
.hypothesis/
|
|
55
|
+
.pytest_cache/
|
|
56
|
+
cover/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
# Django stuff:
|
|
63
|
+
*.log
|
|
64
|
+
local_settings.py
|
|
65
|
+
db.sqlite3
|
|
66
|
+
db.sqlite3-journal
|
|
67
|
+
|
|
68
|
+
# Flask stuff:
|
|
69
|
+
instance/
|
|
70
|
+
.webassets-cache
|
|
71
|
+
|
|
72
|
+
# Scrapy stuff:
|
|
73
|
+
.scrapy
|
|
74
|
+
|
|
75
|
+
# Sphinx documentation
|
|
76
|
+
docs/_build/
|
|
77
|
+
|
|
78
|
+
# PyBuilder
|
|
79
|
+
.pybuilder/
|
|
80
|
+
target/
|
|
81
|
+
|
|
82
|
+
# Jupyter Notebook
|
|
83
|
+
.ipynb_checkpoints
|
|
84
|
+
|
|
85
|
+
# IPython
|
|
86
|
+
profile_default/
|
|
87
|
+
ipython_config.py
|
|
88
|
+
|
|
89
|
+
# pyenv
|
|
90
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
91
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
92
|
+
# .python-version
|
|
93
|
+
|
|
94
|
+
# pipenv
|
|
95
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
96
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
97
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
98
|
+
# install all needed dependencies.
|
|
99
|
+
#Pipfile.lock
|
|
100
|
+
|
|
101
|
+
# poetry
|
|
102
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
103
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
104
|
+
# commonly ignored for libraries.
|
|
105
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
106
|
+
#poetry.lock
|
|
107
|
+
|
|
108
|
+
# pdm
|
|
109
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
110
|
+
#pdm.lock
|
|
111
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
112
|
+
# in version control.
|
|
113
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
114
|
+
.pdm.toml
|
|
115
|
+
|
|
116
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
117
|
+
__pypackages__/
|
|
118
|
+
|
|
119
|
+
# Celery stuff
|
|
120
|
+
celerybeat-schedule
|
|
121
|
+
celerybeat.pid
|
|
122
|
+
|
|
123
|
+
# SageMath parsed files
|
|
124
|
+
*.sage.py
|
|
125
|
+
|
|
126
|
+
# Environments
|
|
127
|
+
.env
|
|
128
|
+
.venv
|
|
129
|
+
env/
|
|
130
|
+
venv/
|
|
131
|
+
ENV/
|
|
132
|
+
env.bak/
|
|
133
|
+
venv.bak/
|
|
134
|
+
|
|
135
|
+
# Spyder project settings
|
|
136
|
+
.spyderproject
|
|
137
|
+
.spyproject
|
|
138
|
+
|
|
139
|
+
# Rope project settings
|
|
140
|
+
.ropeproject
|
|
141
|
+
|
|
142
|
+
# mkdocs documentation
|
|
143
|
+
/site
|
|
144
|
+
|
|
145
|
+
# mypy
|
|
146
|
+
.mypy_cache/
|
|
147
|
+
.dmypy.json
|
|
148
|
+
dmypy.json
|
|
149
|
+
|
|
150
|
+
# Pyre type checker
|
|
151
|
+
.pyre/
|
|
152
|
+
|
|
153
|
+
# pytype static type analyzer
|
|
154
|
+
.pytype/
|
|
155
|
+
|
|
156
|
+
# Cython debug symbols
|
|
157
|
+
cython_debug/
|
|
158
|
+
|
|
159
|
+
# PyCharm
|
|
160
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
161
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
162
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
163
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
164
|
+
#.idea/
|
|
165
|
+
|
|
166
|
+
### Python Patch ###
|
|
167
|
+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
|
168
|
+
poetry.toml
|
|
169
|
+
|
|
170
|
+
# ruff
|
|
171
|
+
.ruff_cache/
|
|
172
|
+
|
|
173
|
+
# LSP config files
|
|
174
|
+
pyrightconfig.json
|
|
175
|
+
|
|
176
|
+
# End of https://www.toptal.com/developers/gitignore/api/python
|
|
177
|
+
|
|
178
|
+
# Pixi
|
|
179
|
+
.pixi
|
|
180
|
+
|
|
181
|
+
# Benchmark scratch files
|
|
182
|
+
scripts/*.log
|
|
183
|
+
memory/
|
|
184
|
+
|
|
185
|
+
static/iridium
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
exclude: '.pixi/'
|
|
2
|
+
repos:
|
|
3
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
4
|
+
rev: v6.0.0
|
|
5
|
+
hooks:
|
|
6
|
+
- id: check-yaml
|
|
7
|
+
- id: check-toml
|
|
8
|
+
- id: end-of-file-fixer
|
|
9
|
+
- id: trailing-whitespace
|
|
10
|
+
|
|
11
|
+
- repo: local
|
|
12
|
+
hooks:
|
|
13
|
+
- id: ruff
|
|
14
|
+
name: ruff-format
|
|
15
|
+
stages: [pre-commit, pre-push]
|
|
16
|
+
language: system
|
|
17
|
+
entry: uv run ruff format .
|
|
18
|
+
types: [python]
|
|
19
|
+
pass_filenames: false
|
|
20
|
+
|
|
21
|
+
- id: ruff
|
|
22
|
+
name: ruff-check
|
|
23
|
+
stages: [pre-commit, pre-push]
|
|
24
|
+
language: system
|
|
25
|
+
entry: uv run ruff check . --fix
|
|
26
|
+
types: [python]
|
|
27
|
+
pass_filenames: false
|
|
28
|
+
|
|
29
|
+
- id: ty
|
|
30
|
+
name: ty
|
|
31
|
+
stages: [pre-commit, pre-push]
|
|
32
|
+
language: system
|
|
33
|
+
entry: uv run ty check
|
|
34
|
+
types: [python]
|
|
35
|
+
pass_filenames: false
|
|
36
|
+
|
|
37
|
+
- id: pytest
|
|
38
|
+
name: pytest
|
|
39
|
+
stages: [pre-commit, pre-push]
|
|
40
|
+
language: system
|
|
41
|
+
entry: uv run pytest
|
|
42
|
+
types: [python]
|
|
43
|
+
pass_filenames: false
|
openconf-0.0.1/AGENTS.md
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# AI Agent Development Guide
|
|
2
|
+
|
|
3
|
+
This document provides essential guidance for AI agents working on this repository. It covers tooling, conventions, and workflows needed to contribute effectively.
|
|
4
|
+
|
|
5
|
+
## How to use this document
|
|
6
|
+
|
|
7
|
+
### When to read this file
|
|
8
|
+
- First time working on this repository
|
|
9
|
+
- Before making any code changes or commits
|
|
10
|
+
- When unsure about code conventions or tooling
|
|
11
|
+
|
|
12
|
+
## Before every commit
|
|
13
|
+
- Ensure all code has type annotations
|
|
14
|
+
- Add Google-style docstrings (NO types, NO leading articles)
|
|
15
|
+
- Pre-commit hooks will run automatically and must pass
|
|
16
|
+
|
|
17
|
+
## When in doubt
|
|
18
|
+
- Check code conventions section below
|
|
19
|
+
- Run individual tools to identify issues
|
|
20
|
+
- Ask user for clarification on ambiguous requirements
|
|
21
|
+
|
|
22
|
+
## Code conventions
|
|
23
|
+
|
|
24
|
+
### Docstrings
|
|
25
|
+
|
|
26
|
+
Required for: all public modules, classes, functions, and methods
|
|
27
|
+
|
|
28
|
+
#### Format: Google-style
|
|
29
|
+
1. Do not place type information in docstrings - use type annotations only
|
|
30
|
+
2. Do not use leading articles in parameter, return, and error descriptions "a", "an", or "the"
|
|
31
|
+
|
|
32
|
+
##### Section order
|
|
33
|
+
1. Args
|
|
34
|
+
2. Returns
|
|
35
|
+
3. Raises
|
|
36
|
+
4. Yields
|
|
37
|
+
5. Examples
|
|
38
|
+
6. Note
|
|
39
|
+
7. Warning
|
|
40
|
+
|
|
41
|
+
#### Example
|
|
42
|
+
```python
|
|
43
|
+
def process_data(input_data: list[str], threshold: int = 10) -> dict[str, int]:
|
|
44
|
+
"""Process input data and return summary statistics.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
input_data: strings to process
|
|
48
|
+
threshold: minimum count threshold for inclusion
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
Mapping of categories to counts
|
|
52
|
+
|
|
53
|
+
Examples:
|
|
54
|
+
>>> process_data(["a", "b"], 5)
|
|
55
|
+
{"valid": 2}
|
|
56
|
+
"""
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Incorrect example (do not do this!)
|
|
60
|
+
```python
|
|
61
|
+
def process_data(input_data: list[str], threshold: int = 10) -> dict[str, int]:
|
|
62
|
+
"""Process input data and return summary statistics.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
input_data (list[str]): A list of strings to process. # ❌ Has type and article
|
|
66
|
+
threshold (int): A minimum count threshold. # ❌ Has type and article
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
dict[str, int]: A dictionary mapping categories. # ❌ Has type and article
|
|
70
|
+
"""
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Type annotations
|
|
74
|
+
|
|
75
|
+
Requirements
|
|
76
|
+
- All functions must have complete type annotations
|
|
77
|
+
- Use modern syntax: `list[str]`, `dict[str, int]` (not `List[str]`, `Dict[str, int]`)
|
|
78
|
+
- Use `|` for union types (Python 3.10+): `str | None`
|
|
79
|
+
- Import types from `typing` only when necessary (prefer built-ins)
|
|
80
|
+
|
|
81
|
+
#### Verification
|
|
82
|
+
```bash
|
|
83
|
+
pixi run types
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Code formatting
|
|
87
|
+
|
|
88
|
+
Via ruff
|
|
89
|
+
- Line length: 120
|
|
90
|
+
- Indentation: 4 spaces (no tabs except Makefiles)
|
|
91
|
+
- Encoding: UTF-8
|
|
92
|
+
- Line endings: LF (Unix-style)
|
|
93
|
+
- Trailing newline: required
|
|
94
|
+
- No trailing whitespace
|
|
95
|
+
|
|
96
|
+
### Naming conventions
|
|
97
|
+
- Functions/methods: snake_case
|
|
98
|
+
- Variables: snake_case
|
|
99
|
+
- Constants: UPPER_SNAKE_CASE
|
|
100
|
+
- Classes: PascalCase
|
|
101
|
+
- Modules: snake_case
|
|
102
|
+
- Private attributes/methods: _leading_underscore
|
|
103
|
+
|
|
104
|
+
### Imports
|
|
105
|
+
- Absolute imports preferred
|
|
106
|
+
- Group imports: standard library, third-party, local
|
|
107
|
+
- No wildcard imports (`from module import *`) except in `__init__.py`
|
|
108
|
+
- Import sorting handled by ruff (isort)
|
|
109
|
+
|
|
110
|
+
### Error handling
|
|
111
|
+
- Use specific exceptions (ValueError, OSError, etc.) rather than generic Exception
|
|
112
|
+
- Avoid bare `except:` clauses; catch specific exceptions
|
|
113
|
+
- Use context managers (`with` statements) for resource management
|
|
114
|
+
- Log errors appropriately using the `logging` module
|
|
115
|
+
- Raise custom exceptions for domain-specific errors
|
|
116
|
+
|
|
117
|
+
### General style
|
|
118
|
+
- Use f-strings for string formatting (Python 3.6+)
|
|
119
|
+
- Prefer list/dict comprehensions over loops when appropriate
|
|
120
|
+
- Use `pathlib.Path` for file operations instead of `os.path`
|
|
121
|
+
- Avoid global variables; use dependency injection
|
|
122
|
+
- Write readable code; prefer explicit over implicit
|
|
123
|
+
|
|
124
|
+
## Essential commands
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Setup
|
|
128
|
+
pixi install # Install dependencies
|
|
129
|
+
|
|
130
|
+
# Code quality
|
|
131
|
+
pixi run fmt # Format code
|
|
132
|
+
pixi run lint # Lint code
|
|
133
|
+
pixi run types # Type check
|
|
134
|
+
|
|
135
|
+
# Testing
|
|
136
|
+
pixi run test # Run tests
|
|
137
|
+
pixi run test --cov # Run tests with coverage
|
|
138
|
+
pixi run test -k "pattern" # Run test matching pattern
|
|
139
|
+
pixi run test -v # Verbose output
|
|
140
|
+
|
|
141
|
+
# Git workflow
|
|
142
|
+
git add .
|
|
143
|
+
git commit -m "feat: message" # Hooks run automatically
|
|
144
|
+
|
|
145
|
+
# Package management
|
|
146
|
+
pixi add <package> # Add a package
|
|
147
|
+
pixi add --dev <package> # Add a package to dev
|
|
148
|
+
pixi lock # Check the lockfile matches the pyproject.toml (and update if different)
|
|
149
|
+
pixi update # Update all packges in the lockfile
|
|
150
|
+
pixi tree # Print the dependencies tree
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Code quality tools
|
|
154
|
+
|
|
155
|
+
### Ruff (formatting & linting)
|
|
156
|
+
|
|
157
|
+
Enabled rule categories:
|
|
158
|
+
- `B` - bugbear (common bugs and design problems)
|
|
159
|
+
- `D` - pydocstyle (docstring conventions)
|
|
160
|
+
- `E`/`W` - pycodestyle (PEP 8 style errors and warnings)
|
|
161
|
+
- `F` - pyflakes (logical errors)
|
|
162
|
+
- `I` - isort (import sorting)
|
|
163
|
+
- `N` - pep8-naming (naming conventions)
|
|
164
|
+
- `C4` - comprehensions (list/dict/set comprehension improvements)
|
|
165
|
+
- `PL` - pylint (code quality and error detection)
|
|
166
|
+
- `PT` - pytest-style (pytest best practices)
|
|
167
|
+
- `PIE` - misc lints (miscellaneous improvements)
|
|
168
|
+
- `PYI` - flake8-pyi (stub file best practices)
|
|
169
|
+
- `TID` - tidy imports (import hygiene)
|
|
170
|
+
- `TCH` - type-checking imports (TYPE_CHECKING block enforcement)
|
|
171
|
+
- `RUF` - Ruff-specific rules
|
|
172
|
+
- `RSE` - flake8-raise (exception raising improvements)
|
|
173
|
+
- `ICN001` - unconventional import aliases
|
|
174
|
+
|
|
175
|
+
Ignored rules (globally):
|
|
176
|
+
- `N806` - Non-lowercase variable in function (allows PascalCase variables)
|
|
177
|
+
- `PLR0911` - Too many return statements
|
|
178
|
+
- `PLR0912` - Too many branches
|
|
179
|
+
- `PLR0913` - Too many arguments to function call
|
|
180
|
+
- `PLR0914` - Too many local variables
|
|
181
|
+
- `PLR0915` - Too many statements
|
|
182
|
+
- `PLR1702` - Too many nested blocks
|
|
183
|
+
|
|
184
|
+
Per-file ignores:
|
|
185
|
+
- `__init__.py`:
|
|
186
|
+
- `F401` - Unused imports (common for `__all__` exports)
|
|
187
|
+
- `F403` - `from module import *` (acceptable in `__init__.py`)
|
|
188
|
+
|
|
189
|
+
Configuration: `pyproject.toml` under `[tool.ruff]` and `[tool.ruff.lint]`
|
|
190
|
+
|
|
191
|
+
### Ty (type checking)
|
|
192
|
+
|
|
193
|
+
Requirements:
|
|
194
|
+
- All functions must have complete type annotations
|
|
195
|
+
- Modern syntax required (e.g., `list[str]` not `List[str]`)
|
|
196
|
+
|
|
197
|
+
### Pytest (testing)
|
|
198
|
+
|
|
199
|
+
Configuration:
|
|
200
|
+
- Test paths:
|
|
201
|
+
- `tests/` - Unit and integration tests
|
|
202
|
+
- `{{cookiecutter.package_name}}` - Source code (for doctests)
|
|
203
|
+
- Doctests: Enabled automatically via `--doctest-modules` flag
|
|
204
|
+
- Doctest normalization: `NORMALIZE_WHITESPACE` applied to all doctests (allows flexible spacing in examples)
|
|
205
|
+
|
|
206
|
+
Both test files in `tests/` and docstring examples in source code are automatically discovered and run
|
|
207
|
+
|
|
208
|
+
## Testing
|
|
209
|
+
|
|
210
|
+
### Test structure
|
|
211
|
+
|
|
212
|
+
- Location: `tests/` directory
|
|
213
|
+
- Naming: test files must start with `test_`
|
|
214
|
+
- Doctests: automatically discovered in source code
|
|
215
|
+
|
|
216
|
+
### Doctests
|
|
217
|
+
|
|
218
|
+
Include examples in docstrings:
|
|
219
|
+
```python
|
|
220
|
+
def add(a: int, b: int) -> int:
|
|
221
|
+
"""Add two integers.
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
a: first integer
|
|
225
|
+
b: second integer
|
|
226
|
+
|
|
227
|
+
Returns:
|
|
228
|
+
Sum of a and b
|
|
229
|
+
|
|
230
|
+
Examples:
|
|
231
|
+
>>> add(2, 3)
|
|
232
|
+
5
|
|
233
|
+
>>> add(-1, 1)
|
|
234
|
+
0
|
|
235
|
+
"""
|
|
236
|
+
return a + b
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
## Troubleshooting
|
|
241
|
+
|
|
242
|
+
### Pre-commit hook failures
|
|
243
|
+
|
|
244
|
+
Formatting issues:
|
|
245
|
+
- Usually auto-fixed by ruff
|
|
246
|
+
- Re-stage files: `git add .`
|
|
247
|
+
- Try committing again
|
|
248
|
+
|
|
249
|
+
Lint issues:
|
|
250
|
+
- Read error message for specific rule
|
|
251
|
+
- Fix; if `# noqa: <rule>` if absolutely necessary, ask before adding
|
|
252
|
+
|
|
253
|
+
Type issues:
|
|
254
|
+
- Add missing type annotations
|
|
255
|
+
- Fix type mismatches
|
|
256
|
+
- Use `pixi run types` to verify locally
|
|
257
|
+
|
|
258
|
+
Test failures:
|
|
259
|
+
- Fix failing tests or code
|
|
260
|
+
- Run `pixi run test -v` for detailed output
|
|
261
|
+
- Run specific test: `pixi run test hooks/test_file.py::test_name`
|
|
262
|
+
|
|
263
|
+
## Commit guidelines
|
|
264
|
+
|
|
265
|
+
Format: conventional commits recommended
|
|
266
|
+
- `feat:` - new features
|
|
267
|
+
- `fix:` - bug fixes
|
|
268
|
+
- `docs:` - documentation changes
|
|
269
|
+
- `test:` - test changes
|
|
270
|
+
- `refactor:` - code refactoring
|
|
271
|
+
- `chore:` - maintenance tasks
|
|
272
|
+
|
|
273
|
+
### Example
|
|
274
|
+
```bash
|
|
275
|
+
git commit -m "feat: add user authentication
|
|
276
|
+
|
|
277
|
+
- Implement JWT token generation
|
|
278
|
+
- Add login/logout endpoints
|
|
279
|
+
- Include comprehensive tests"
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Additional resources
|
|
283
|
+
|
|
284
|
+
- pixi documentation: https://pixi.sh
|
|
285
|
+
- ruff documentation: https://docs.astral.sh/ruff
|
|
286
|
+
- ty documentation: https://github.com/astral-sh/ty
|
|
287
|
+
- pytest documentation: https://docs.pytest.org
|
|
288
|
+
- Google docstring style: https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings
|
openconf-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Corin Wagen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|