Skip to content
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

benchmark performance of import #653

Merged
merged 7 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@ jobs:
python-version: ${{ matrix.python-version }}
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: uv pip install --system .[amber,ase,pymatgen] coverage ./tests/plugin rdkit openbabel-wheel
run: uv pip install --system .[amber,ase,pymatgen,test] coverage ./tests/plugin rdkit openbabel-wheel
- name: Test
run: cd tests && coverage run --source=../dpdata -m unittest && cd .. && coverage combine tests/.coverage && coverage report
- name: Run codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest benchmark/ --codspeed
pass:
needs: [build]
runs-on: ubuntu-latest
Expand Down
Empty file added benchmark/__init__.py
Empty file.
18 changes: 18 additions & 0 deletions benchmark/test_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import subprocess
import sys

import pytest


@pytest.mark.benchmark
def test_import():
"""Test import dpdata."""
subprocess.check_output(
[sys.executable, "-c", "'from dpdata import LabeledSystem'"]
).decode("ascii")


@pytest.mark.benchmark
def test_cli():
"""Test dpdata command."""
subprocess.check_output([sys.executable, "-m", "dpdata", "-h"]).decode("ascii")
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ docs = [
'jupyterlite-sphinx',
'jupyterlite-xeus',
]
test = [
'pytest',
'pytest-codspeed',
]

[tool.setuptools.packages.find]
include = ["dpdata*"]
Expand Down