Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

# Skip CI if 'skip ci' is contained in latest commit message
if: "!contains(github.event.head_commit.message, 'skip ci')"
Expand All @@ -34,7 +34,7 @@ jobs:

- name: Test with pytest
run: |
pytest --cov=SFC_Torch --cov-report=xml
pytest

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build packaging setuptools twine wheel
pip install build twine
- name: Build package
run: |
python -m build
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion SFC_Torch/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.5
0.3.0
53 changes: 41 additions & 12 deletions SFC_Torch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,49 @@
def getVersionNumber():
import pkg_resources
version = pkg_resources.require("SFcalculator_torch")[0].version
return version
try:
from importlib.metadata import version
except ImportError:
# Fallback for Python < 3.8
from importlib_metadata import version
return version("SFcalculator_torch")

__author__ = "Minhuan Li"
__email__ = "minhuanli@g.harvard.edu"
__email__ = "minhuanli41@gmail.com"
__version__ = getVersionNumber()

# Top level API
from .Fmodel import SFcalculator
from .io import PDBParser, fetch_pdb, fetch_pdbredo
from .symmetry import get_polar_axis
# Lazy loading to speed up imports while maintaining API compatibility
_LAZY_IMPORTS = {
'SFcalculator': 'Fmodel',
'PDBParser': 'io',
'fetch_pdb': 'io',
'fetch_pdbredo': 'io',
'get_polar_axis': 'symmetry',
'utils': 'utils',
'patterson': 'patterson',
'packingscore': 'packingscore',
}

# Submodules
from . import utils
from . import patterson
from . import packingscore
def __getattr__(name):
"""Lazy import mechanism for top-level API"""
if name in _LAZY_IMPORTS:
module_name = _LAZY_IMPORTS[name]
import importlib

# Import the module
if name in ['utils', 'patterson', 'packingscore']:
# These are submodule imports
module = importlib.import_module(f'.{module_name}', __name__)
globals()[name] = module
return module
else:
# These are specific objects from modules
module = importlib.import_module(f'.{module_name}', __name__)
obj = getattr(module, name)
globals()[name] = obj
return obj
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

def __dir__():
"""Support for dir() to show available lazy imports"""
return list(globals().keys()) + list(_LAZY_IMPORTS.keys())


70 changes: 70 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[build-system]
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "sfcalculator_torch"
dynamic = ["version"]
description = "A differentiable pipeline connecting molecule models and scattering data"
readme = "README.md"
requires-python = ">=3.9"
license = {text = "MIT"}
authors = [
{name = "Minhuan Li", email = "minhuanli@g.harvard.edu"}
]
keywords = ["pytorch", "structure-factors", "differentiable", "crystallography", "cryoEM"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

dependencies = [
"gemmi>=0.5.6,<=0.6.7",
"reciprocalspaceship>=0.9.18,<=1.0.3",
"numpy<2.0.0",
"tqdm",
"loguru",
]

[project.optional-dependencies]
test = ["pytest", "pytest-cov"]
dev = ["pytest", "pytest-cov", "build", "twine"]

[project.urls]
Homepage = "https://github.com/Hekstra-Lab/SFcalculator_torch"
Documentation = "https://hekstra-lab.github.io/SFcalculator_torch/"
Repository = "https://github.com/Hekstra-Lab/SFcalculator_torch"
"Bug Tracker" = "https://github.com/Hekstra-Lab/SFcalculator_torch/issues"

[tool.setuptools]
packages = ["SFC_Torch"]
include-package-data = true

[tool.setuptools.package-data]
SFC_Torch = ["VERSION"]

[tool.setuptools.dynamic]
version = {file = "SFC_Torch/VERSION"}

[tool.pytest.ini_options]
addopts = "--cov=SFC_Torch --cov-report xml --cov-report term-missing"
testpaths = ["tests"]

[tool.coverage.run]
source = ["SFC_Torch"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]

5 changes: 0 additions & 5 deletions setup.cfg

This file was deleted.

31 changes: 0 additions & 31 deletions setup.py

This file was deleted.