-
Notifications
You must be signed in to change notification settings - Fork 17
updated build system and deprecated modules #76
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
Changes from 1 commit
c4730e1
053ee1c
029490d
021aa31
a4cd9fd
d256e97
e64382a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,4 @@ polychrom/_polymer_math.cpp | |
| *.dat | ||
| .idea | ||
| dist | ||
| polychrom/*.so | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,19 @@ | ||
| __version__ = "0.1.1" | ||
|
|
||
| # Check for OpenMM installation | ||
| try: | ||
| import openmm | ||
| except ImportError: | ||
| import warnings | ||
| warnings.warn( | ||
| "\n" | ||
| "OpenMM is not installed. Polychrom requires OpenMM for molecular dynamics simulations.\n" | ||
| "\n" | ||
| "Please install OpenMM with the appropriate backend for your system:\n" | ||
| " - For CUDA: pip install openmm[cuda13]\n" | ||
| " - For CPU: pip install openmm\n" | ||
| "\n" | ||
| "Visit https://openmm.org for more information.", | ||
| ImportWarning, | ||
| stacklevel=2 | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ | |
| #include <cmath> | ||
| #include <vector> | ||
| #include <ctime> | ||
| #include <omp.h> | ||
|
|
||
| using namespace std; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ import sys | |
| import tempfile | ||
| import textwrap | ||
|
|
||
| import joblib | ||
| import numpy as np | ||
|
|
||
| usage = """ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -31,9 +31,7 @@ | |||||
| import io | ||||||
| import os | ||||||
|
|
||||||
| import joblib | ||||||
| import numpy as np | ||||||
| import six | ||||||
|
|
||||||
| from polychrom.hdf5_format import load_URI | ||||||
|
|
||||||
|
|
@@ -49,8 +47,7 @@ def load(filename): | |||||
|
|
||||||
| New-style URIs (HDF5 based storage) | ||||||
|
|
||||||
| Text files in openmm-polymer format | ||||||
| joblib files in openmm-polymer format | ||||||
| Joblib and text files were deprecated. | ||||||
|
|
||||||
| Parameters | ||||||
| ---------- | ||||||
|
|
@@ -61,24 +58,10 @@ def load(filename): | |||||
| """ | ||||||
| if "::" in filename: | ||||||
| return hdf5_format.load_URI(filename)["pos"] | ||||||
|
|
||||||
| raise ValueError("Only URIs are supported in this version of polychrom") | ||||||
|
|
||||||
| if not os.path.exists(filename): | ||||||
| raise IOError("File not found :( \n %s" % filename) | ||||||
|
|
||||||
| try: # loading from a joblib file here | ||||||
| return dict(joblib.load(filename)).pop("data") | ||||||
| except Exception: # checking for a text file | ||||||
| data_file = open(filename) | ||||||
| line0 = data_file.readline() | ||||||
| try: | ||||||
| N = int(line0) | ||||||
| except (ValueError, UnicodeDecodeError): | ||||||
| raise TypeError("Could not read the file. Not text or joblib.") | ||||||
| data = [list(map(float, i.split())) for i in data_file.readlines()] | ||||||
|
|
||||||
| if len(data) != N: | ||||||
| raise ValueError("N does not correspond to the number of lines!") | ||||||
| return np.array(data) | ||||||
|
|
||||||
|
|
||||||
| def fetch_block(folder, ind, full_output=False): | ||||||
|
|
@@ -129,45 +112,25 @@ def fetch_block(folder, ind, full_output=False): | |||||
| pos = exists.index(True) | ||||||
| block = load_URI(blocksh5[pos] + f"::{ind}") | ||||||
| if not full_output: | ||||||
| block = block["pos"] | ||||||
| return block["pos"] | ||||||
|
|
||||||
|
||||||
| return block |
Outdated
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line will always raise a ValueError since the load() function no longer supports .dat files (line 62 raises ValueError for non-URI filenames). The function should either handle .dat files differently or remove this deprecated code path entirely. If .dat files are still expected to be supported for backward compatibility, the load() function needs to be updated, or this should call a different function.
Outdated
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error message is grammatically incorrect. 'use or pdb' should be 'use pdb' since pdb is now the only supported mode after removing txt and joblib modes.
| raise ValueError("Unknown mode : %s, use or pdb" % mode) | |
| raise ValueError("Unknown mode: %s. Only 'pdb' is supported." % mode) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,9 +1,59 @@ | ||||||
| [build-system] | ||||||
| requires = ["setuptools>=45", "wheel", "cython>=0.29", "numpy>=1.9"] | ||||||
| build-backend = "setuptools.build_meta" | ||||||
|
|
||||||
| [project] | ||||||
| name = "polychrom" | ||||||
| version = "0.1.1" | ||||||
| description = "A library for polymer simulations and their analyses." | ||||||
| readme = "README.md" | ||||||
| requires-python = ">=3.7" | ||||||
|
||||||
| requires-python = ">=3.7" | |
| requires-python = ">=3.13" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,6 @@ | ||
| six | ||
| cython | ||
| numpy>=1.9 | ||
| scipy>=0.16 | ||
| h5py>=2.5 | ||
| pandas>=0.19 | ||
| joblib | ||
| pyknotid | ||
| pytest |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,70 +1,16 @@ | ||||||||||||||||
| import io | ||||||||||||||||
| import os | ||||||||||||||||
| import re | ||||||||||||||||
| from setuptools import setup, Extension | ||||||||||||||||
| from Cython.Build import cythonize | ||||||||||||||||
| from Cython.Distutils import build_ext | ||||||||||||||||
| from setuptools import find_packages | ||||||||||||||||
| from distutils.core import setup | ||||||||||||||||
| from distutils.extension import Extension | ||||||||||||||||
|
|
||||||||||||||||
| cmdclass = {} | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def _read(*parts, **kwargs): | ||||||||||||||||
| filepath = os.path.join(os.path.dirname(__file__), *parts) | ||||||||||||||||
| encoding = kwargs.pop("encoding", "utf-8") | ||||||||||||||||
| with io.open(filepath, encoding=encoding) as fh: | ||||||||||||||||
| text = fh.read() | ||||||||||||||||
| return text | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def get_version(): | ||||||||||||||||
| version = re.search( | ||||||||||||||||
| r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', | ||||||||||||||||
| _read("polychrom", "__init__.py"), | ||||||||||||||||
| re.MULTILINE, | ||||||||||||||||
| ).group(1) | ||||||||||||||||
| return version | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def get_long_description(): | ||||||||||||||||
| return _read("README.md") | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def get_requirements(path): | ||||||||||||||||
| content = _read(path) | ||||||||||||||||
| return [req for req in content.split("\n") if req != "" and not req.startswith("#")] | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| cmdclass.update({"build_ext": build_ext}) | ||||||||||||||||
|
|
||||||||||||||||
| ext_modules = cythonize( | ||||||||||||||||
| [ | ||||||||||||||||
| Extension( | ||||||||||||||||
| "polychrom._polymer_math", | ||||||||||||||||
| ["polychrom/_polymer_math.pyx", "polychrom/__polymer_math.cpp"], | ||||||||||||||||
| ) | ||||||||||||||||
| ] | ||||||||||||||||
| ) | ||||||||||||||||
| import numpy | ||||||||||||||||
|
|
||||||||||||||||
| # Define Cython extensions | ||||||||||||||||
|
Comment on lines
+3
to
+5
|
||||||||||||||||
| import numpy | |
| # Define Cython extensions | |
| # Define Cython extensions | |
| import numpy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace after 'simtk.openmm'. Remove the extra spaces at the end of the line.