Skip to content

Commit 1a63f75

Browse files
Fix Parameters, Tests and Freezing UI on large PDB files (#23)
* Add async loop for large PDB files * Fix the progress bar on the PDB structure * Adding descriptors for atom and interactions * Cleaning docs and badges * Fixing the release notes * Refactoring tests - moving in unit test, integration test, performance test, and e2e * Enabled Codecov generation and upload for Github Action
1 parent 1d4a35d commit 1a63f75

54 files changed

Lines changed: 8227 additions & 3789 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,21 +419,28 @@ jobs:
419419
- `hbat_${{ needs.generate-version.outputs.version }}_amd64.deb` - Debian package
420420
421421
### Conda Package
422-
- `hbat-${{ needs.generate-version.outputs.version }}.tar.bz2` or `.conda`
422+
- `hbat-${{ needs.generate-version.outputs.version }}-py0.conda`
423423
424424
### Documentation
425425
- `hbat-docs-${{ needs.generate-version.outputs.version }}.zip` - Full HTML documentation
426426
427427
## Installation
428428
429-
**pip:**
429+
**PIP:**
430430
```bash
431431
pip install https://github.com/${{ github.repository }}/releases/download/${{ needs.generate-version.outputs.github_tag }}/hbat-${{ needs.generate-version.outputs.version }}-py3-none-any.whl
432432
```
433433
434-
${{ needs.generate-version.outputs.is_prerelease == 'false' && '**PyPI:**\n```bash\npip install hbat\n```' || '' }}
434+
${{ needs.generate-version.outputs.is_prerelease == 'false' && '**PyPI:**
435+
```bash
436+
pip install hbat
437+
```' || '' }}
435438
436-
${{ needs.generate-version.outputs.is_prerelease == 'false' && '**Conda:**\n```bash\nconda install -c ${{ secrets.ANACONDA_ORG }} hbat\n```' || '**Conda:** Download the package and install locally' }}
439+
${{ needs.generate-version.outputs.is_prerelease == 'false' && '**Conda:**
440+
```bash
441+
conda install -c ${{ secrets.ANACONDA_ORG }} hbat
442+
```' || '**Conda:**
443+
Download the package and install locally' }}
437444
prerelease: ${{ needs.generate-version.outputs.is_prerelease == 'true' }}
438445
draft: false
439446

.github/workflows/test.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,19 @@ jobs:
3838

3939
- name: Run coverage
4040
run: make test-coverage
41-
if: matrix.python-version == '3.9'
41+
if: matrix.python-version == '3.10'
4242

4343
- name: Upload coverage to Codecov
44-
uses: codecov/codecov-action@v3
45-
if: matrix.python-version == '3.9'
44+
uses: codecov/codecov-action@v5
45+
if: matrix.python-version == '3.10'
4646
with:
47-
file: ./tests/htmlcov/coverage.xml
48-
fail_ci_if_error: false
47+
fail_ci_if_error: false
48+
files: ./coverage.xml
49+
token: ${{ secrets.CODECOV_TOKEN }}
50+
51+
- name: Upload test results to Codecov
52+
if: ${{ !cancelled() }}
53+
uses: codecov/test-results-action@v1
54+
with:
55+
files: ./junit.xml
56+
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,11 @@ experiments/*
240240
# CCD
241241
ccd-data/*
242242
!ccd-data/.gitkeep
243-
!ccd-data/README.md
243+
!ccd-data/README.md
244+
245+
# Ignore config files
246+
hbat/config/*
247+
248+
# XML files
249+
junit.xml
250+
coverage.xml

Makefile

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# HBAT Development Makefile
22

3-
.PHONY: help install install-dev test test-fast test-legacy test-pytest test-core test-cli test-gui test-coverage test-ccd clean lint format type-check docs generate-ccd-bonds
3+
.PHONY: help install install-dev test test-all test-fast test-legacy test-pytest test-unit test-integration test-e2e test-performance test-cli test-gui test-coverage test-ccd clean lint format type-check docs generate-ccd-bonds
44

55
# Default target
66
help:
@@ -9,11 +9,15 @@ help:
99
@echo " install-dev Install with development dependencies"
1010
@echo ""
1111
@echo "Testing:"
12-
@echo " test Run comprehensive test suite (recommended)"
12+
@echo " test Run comprehensive test suite (excludes slow tests)"
13+
@echo " test-all Run ALL tests including slow performance tests"
1314
@echo " test-fast Run fast tests only (skip slow integration tests)"
1415
@echo " test-legacy Run legacy test runner"
1516
@echo " test-pytest Run tests with pytest (if available)"
16-
@echo " test-core Run core module tests only"
17+
@echo " test-unit Run unit tests only (fast, isolated)"
18+
@echo " test-integration Run integration tests only (component interactions)"
19+
@echo " test-e2e Run end-to-end workflow tests only"
20+
@echo " test-performance Run performance benchmark tests only"
1721
@echo " test-cli Run CLI tests only"
1822
@echo " test-gui Run GUI tests only (requires display)"
1923
@echo " test-coverage Generate test coverage report"
@@ -32,6 +36,7 @@ help:
3236
@echo "Development:"
3337
@echo " clean Clean build artifacts"
3438
@echo " docs Build documentation"
39+
@echo " docs-watch Build docs with auto-reload and open browser"
3540
@echo " run-gui Launch GUI application"
3641
@echo " run-cli Run CLI with test file"
3742
@echo " generate-ccd-bonds Generate residue bond constants from CCD files"
@@ -46,36 +51,52 @@ install-dev:
4651

4752
# Testing
4853
test:
49-
@echo "Running additional pytest tests if available..."
50-
-pytest tests/ -v
54+
@echo "Running all tests except slow ones..."
55+
pytest tests/ -v -m "not slow"
5156

5257
test-fast:
5358
@echo "Running fast tests only..."
5459
cd tests && python run_tests.py --fast
5560

61+
test-all:
62+
@echo "Running ALL tests including slow ones..."
63+
pytest tests/ -v
64+
5665
test-pytest:
5766
@echo "Running tests with pytest..."
5867
pytest tests/ -v
5968

6069
test-cli:
6170
@echo "Running CLI tests..."
62-
cd tests && python run_tests.py --cli --fast
63-
64-
test-core:
65-
@echo "Running core tests..."
66-
cd tests && python run_tests.py --core --fast
71+
pytest tests/cli/ -v -m "cli"
6772

6873
test-coverage:
69-
@echo "Running tests with coverage..."
70-
cd tests && python run_tests.py --coverage
74+
@echo "Running tests with coverage...(excludes slow tests)"
75+
pytest tests/ -v -m "not slow" --cov --cov-branch --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
7176

7277
test-gui:
7378
@echo "Running GUI tests..."
74-
cd tests && python run_tests.py --gui --fast
79+
pytest tests/gui/ -v -m "gui"
80+
81+
test-unit:
82+
@echo "Running unit tests..."
83+
pytest tests/unit/ -v -m "unit"
84+
85+
test-integration:
86+
@echo "Running integration tests..."
87+
pytest tests/integration/ -v -m "integration"
88+
89+
test-e2e:
90+
@echo "Running end-to-end tests..."
91+
pytest tests/e2e/ -v -m "e2e"
92+
93+
test-performance:
94+
@echo "Running performance tests..."
95+
pytest tests/performance/ -v -m "performance"
7596

7697
test-ccd:
7798
@echo "Running CCD performance tests..."
78-
pytest tests/core/test_ccd_performance.py -v -m "ccd"
99+
pytest tests/performance/test_ccd_performance.py -v -m "ccd"
79100

80101
# Code quality
81102
lint:
@@ -125,6 +146,10 @@ docs-serve:
125146
echo "Documentation not built. Run 'make docs' first."; \
126147
fi
127148

149+
docs-watch:
150+
@echo "Building and watching documentation with auto-reload (requires sphinx-autobuild)..."
151+
sphinx-autobuild docs/source/ docs/build/html/ --open-browser
152+
128153
# Development runners
129154
run-gui:
130155
python hbat_gui.py

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ A Python package to automate the analysis of potential hydrogen bonds and simila
1515
![License](https://img.shields.io/github/license/abhishektiwari/hbat)
1616
![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/abhishektiwari/hbat/total?label=GitHub%20Downloads)
1717
![SourceForge Downloads](https://img.shields.io/sourceforge/dt/hbat?label=SourceForge%20Downloads)
18-
19-
18+
![PyPI Downloads](https://img.shields.io/pypi/dm/hbat?label=PyPI%20Downloads)
19+
[![codecov](https://codecov.io/gh/abhishektiwari/hbat/graph/badge.svg?token=QSKYLB3M1V)](https://codecov.io/gh/abhishektiwari/hbat)
2020

2121
## Background
2222

build_standalone_linux.py

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ def install_dependencies():
3838
def clean_build():
3939
"""Clean previous build artifacts."""
4040
print("Cleaning previous builds...")
41-
paths_to_clean = ["build", "dist", "__pycache__", "appimagetool-extracted", "squashfs-root"]
41+
paths_to_clean = [
42+
"build",
43+
"dist",
44+
"__pycache__",
45+
"appimagetool-extracted",
46+
"squashfs-root",
47+
]
4248

4349
for path in paths_to_clean:
4450
if os.path.exists(path):
@@ -129,9 +135,9 @@ def build_cli():
129135
def create_appimage():
130136
"""Create AppImage for better Linux distribution."""
131137
print("\nCreating AppImage...")
132-
138+
133139
# Get version from environment or use default
134-
version = os.environ.get('HBAT_VERSION', '2.0.0')
140+
version = os.environ.get("HBAT_VERSION", "2.0.0")
135141

136142
# Create AppDir structure
137143
appdir = Path("HBAT.AppDir")
@@ -183,7 +189,7 @@ def create_appimage():
183189

184190
with open(appdir / "usr" / "share" / "applications" / "hbat.desktop", "w") as f:
185191
f.write(desktop_content)
186-
192+
187193
# Also create desktop file at root for appimagetool
188194
with open(appdir / "hbat.desktop", "w") as f:
189195
f.write(desktop_content)
@@ -209,7 +215,7 @@ def create_appimage():
209215
# Download and extract appimagetool if not present
210216
appimagetool = "appimagetool-x86_64.AppImage"
211217
appimagetool_dir = "appimagetool-extracted"
212-
218+
213219
if not os.path.exists(appimagetool_dir):
214220
if not os.path.exists(appimagetool):
215221
print("Downloading appimagetool...")
@@ -222,13 +228,16 @@ def create_appimage():
222228
except Exception as e:
223229
print(f"Failed to download appimagetool: {e}")
224230
return False
225-
231+
226232
# Extract appimagetool to avoid FUSE requirement
227233
print("Extracting appimagetool...")
228234
try:
229235
# Extract quietly to avoid verbose output
230-
result = subprocess.run([f"./{appimagetool}", "--appimage-extract"],
231-
capture_output=True, text=True)
236+
result = subprocess.run(
237+
[f"./{appimagetool}", "--appimage-extract"],
238+
capture_output=True,
239+
text=True,
240+
)
232241
if result.returncode != 0 and "squashfs-root" not in result.stdout:
233242
print(f"Failed to extract appimagetool: {result.stderr}")
234243
return False
@@ -246,13 +255,13 @@ def create_appimage():
246255
env = os.environ.copy()
247256
env["ARCH"] = "x86_64"
248257
appimage_name = f"dist/HBAT-{version}-x86_64.AppImage"
249-
258+
250259
# Check if desktop file exists at root (required by appimagetool)
251260
desktop_file = appdir / "hbat.desktop"
252261
if not desktop_file.exists():
253262
print(f"Error: Desktop file not found at {desktop_file}")
254263
return False
255-
264+
256265
# Use the extracted AppRun instead of the AppImage
257266
print(f"Building AppImage with {appimagetool_dir}/AppRun...")
258267
result = subprocess.run(
@@ -261,12 +270,12 @@ def create_appimage():
261270
text=True,
262271
env=env,
263272
)
264-
273+
265274
if result.returncode != 0:
266275
print(f"AppImage build failed: {result.stderr}")
267276
print(f"stdout: {result.stdout}")
268277
return False
269-
278+
270279
shutil.rmtree(appdir)
271280
print(f"✓ AppImage created successfully: HBAT-{version}-x86_64.AppImage")
272281
return True
@@ -278,9 +287,9 @@ def create_appimage():
278287
def create_deb_package():
279288
"""Create .deb package for Debian/Ubuntu."""
280289
print("\nCreating .deb package...")
281-
290+
282291
# Get version from environment or use default
283-
version = os.environ.get('HBAT_VERSION', '2.0.0')
292+
version = os.environ.get("HBAT_VERSION", "2.0.0")
284293

285294
# Create debian package structure
286295
debdir = Path("hbat-deb")
@@ -349,7 +358,8 @@ def create_deb_package():
349358
# Build .deb package
350359
try:
351360
subprocess.run(
352-
["dpkg-deb", "--build", "hbat-deb", f"dist/hbat_{version}_amd64.deb"], check=True
361+
["dpkg-deb", "--build", "hbat-deb", f"dist/hbat_{version}_amd64.deb"],
362+
check=True,
353363
)
354364
shutil.rmtree(debdir)
355365
print(f"✓ .deb package created successfully: hbat_{version}_amd64.deb")
@@ -365,9 +375,9 @@ def main():
365375
"""Main build function."""
366376
print("HBAT Linux Build Script")
367377
print("=" * 40)
368-
378+
369379
# Get version from environment or use default
370-
version = os.environ.get('HBAT_VERSION', '2.0.0')
380+
version = os.environ.get("HBAT_VERSION", "2.0.0")
371381
print(f"Building version: {version}")
372382

373383
# Check we're in the right directory

docs/source/conf.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
'sphinx.ext.githubpages',
3636
'sphinx_toolbox.shields',
3737
'sphinx_sitemap',
38+
'sphinx_copybutton',
3839
]
3940

4041
# Mock imports for modules that might not be available in CI
@@ -56,7 +57,7 @@
5657
# -- Options for HTML output -------------------------------------------------
5758

5859
# The theme to use for HTML and HTML Help pages.
59-
html_theme = 'sphinx_rtd_theme'
60+
html_theme = 'sphinx_book_theme'
6061

6162
# Add any paths that contain custom static files (such as style sheets) here,
6263
# relative to this directory. They are copied after the builtin static files,
@@ -107,6 +108,7 @@
107108
html_theme_options = {
108109
'canonical_url': '',
109110
'analytics_id': '',
111+
'google_analytics_id': 'G-PLZNCJY1B7',
110112
'logo_only': False,
111113
'prev_next_buttons_location': 'bottom',
112114
'style_external_links': False,
@@ -116,7 +118,39 @@
116118
'sticky_navigation': True,
117119
'navigation_depth': 4,
118120
'includehidden': True,
119-
'titles_only': False
121+
'titles_only': False,
122+
"repository_url": "https://github.com/abhishektiwari/hbat",
123+
"repository_provider": "github",
124+
"repository_branch": "main",
125+
"path_to_docs": "docs/source",
126+
"use_issues_button": True,
127+
"use_repository_button": True,
128+
"use_edit_page_button": True,
129+
"use_download_button": False,
130+
"use_fullscreen_button": True,
131+
"use_search_button": True,
132+
"use_sidenotes": True,
133+
"icon_links_label": "Quick Links",
134+
"icon_links": [
135+
{
136+
"name": "GitHub",
137+
"url": "https://github.com/abhishektiwari/hbat",
138+
"icon": "fa-brands fa-square-github",
139+
"type": "fontawesome",
140+
},
141+
{
142+
"name": "Abhishek Tiwari",
143+
"url": "https://www.abhishek-tiwari.com",
144+
"icon": "https://www.abhishek-tiwari.com/images/logo.svg",
145+
"type": "local",
146+
},
147+
{
148+
"name": "PyPI",
149+
"url": "https://pypi.org/project/hbat/",
150+
"icon": "fa-brands fa-python",
151+
"type": "fontawesome",
152+
},
153+
]
120154
}
121155

122156
# The version info for the project you're documenting, acts as replacement for

0 commit comments

Comments
 (0)