Skip to content

Commit

Permalink
Merge pull request #4 from LBC-LNBio/build
Browse files Browse the repository at this point in the history
[ENH]: Migrating to PEP 518 (pyproject.toml)
  • Loading branch information
helder-ribeiro authored Nov 2, 2024
2 parents 4f2d9bb + 0f1534d commit 45b2577
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 103 deletions.
8 changes: 2 additions & 6 deletions SERD/SERD.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,8 @@ def interface(
& (atominfo[:, 1] != "N")
& (atominfo[:, 1] != "O")
)
atominfo = atominfo[
mask[0],
]
xyzr = xyzr[
mask[0],
]
atominfo = atominfo[mask[0],]
xyzr = xyzr[mask[0],]

# Prepare atominfo
atominfo = atominfo[:, 0].tolist()
Expand Down
9 changes: 2 additions & 7 deletions SERD/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
"""

__name__ = "SERD"
__version__ = "0.1.2"
__version__ = "0.2.0"
__license__ = "GNU GPL-3.0 License"

try:
from .SERD import *
except SyntaxError:
pass
except ModuleNotFoundError:
pass
from .SERD import *
59 changes: 59 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[build-system]
requires = [
"setuptools>=62.0",
"wheel>=0.37.1",
"Cython>=0.29",
"numpy>=1.21.5",
]
build-backend = "setuptools.build_meta"

[project]
name = "SERD"
description = "A Python package to detect solvent-exposed residues of a target biomolecule."
readme = { file = "README.rst", content-type = "text/x-rst" }
requires-python = ">=3.10, <4"
license = { file = "LICENSE" }
authors = [
{ name = "João V. S. Guerra", email = "[email protected]" },
{ name = "Gabriel E. Jara" },
{ name = "José G. C. Pereira" },
{ name = "Helder V. Ribeiro-Filho" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Chemistry",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
]
dependencies = [
"networkx~=3.4.2",
"numpy~=2.1.2",
"pyKVFinder~=0.7.1",
"scipy~=1.14.1",
]
dynamic = ["version"]
keywords = [
"structural biology",
"proteins",
"biomolecular surface",
"solvent-exposed residues",
]

[project.urls]
homepage = "https://github.com/LBC-LNBio/SERD"
source = "https://github.com/LBC-LNBio/SERD/"
issues = "https://github.com/LBC-LNBio/SERD/issues"

[tool.setuptools]
packages = ["SERD"]
include-package-data = true
py-modules = ["_SERD"]

[tool.setuptools.dynamic]
version = { attr = "SERD.__version__" }
4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

102 changes: 16 additions & 86 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,94 +1,24 @@
#!/usr/bin/env python

# System imports
import sys
import pathlib
from setuptools import setup, Extension, dist

# SERD information
from SERD import __name__, __version__
from setuptools import Extension, setup

# Prepare reqs from requirements.txt
with open("requirements.txt") as f:
reqs = f.read().splitlines()

# Get the long description from the README file
long_description = (pathlib.Path(__file__).parent.resolve() / "README.rst").read_text(
encoding="utf-8"
)
class get_numpy_include(object):
def __str__(self):
import numpy

# Third-party modules - we depend on numpy for everything
np_req = [req for req in reqs if req.find("numpy") != -1]
dist.Distribution().fetch_build_eggs(np_req)
import numpy
return numpy.get_include()

# Obtain the numpy include directory. This logic works across numpy versions.
try:
numpy_include = numpy.get_include()
except AttributeError:
numpy_include = numpy.get_numpy_include()

# Extension modules
_SERD = Extension(
name="_SERD",
sources=["C/SERD.i", "C/SERD.c"],
include_dirs=[numpy_include, "C"],
extra_compile_args=["-fopenmp", "-Ofast", "-lm"],
extra_link_args=["-lgomp", "-static"] if sys.platform != 'linux' else ["-lgomp"],
)

# Setup
setup(
name=__name__,
version=__version__,
description="A Python package to detect solvent-exposed residues of a target biomolecule.",
# This is an optional longer description of your project that represents
# the body of text which users will see when they visit PyPI.
long_description=long_description,
long_description_content_type="text/x-rst",
# This field corresponds to the "Home-Page" metadata field:
url="https://github.com/jvsguerra/SERD",
# Authors information
author="João Victor da Silva Guerra, Gabriel Ernesto Jara, José Geraldo de Carvalho Pereira", # Optional
author_email="[email protected]",
# Classifiers help users find your project by categorizing it.
classifiers=[ # Optional
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 4 - Beta",
# Indicate who your project is intended for
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Chemistry",
# Pick your license as you wish
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
# Specify the Python versions you support here. In particular, ensure
# that you indicate you support Python 3. These classifiers are *not*
# checked by 'pip install'. See instead 'python_requires' below.
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
],
# Keywords
keywords="structural biology, proteins, biomolecular surface, solvent-exposed residues",
# Extension C modules
ext_modules=[_SERD],
# Python package configuration
packages=["SERD"],
# Python versions support
python_requires=">=3.8, <4",
# This field lists other packages that your project depends on to run.
install_requires=reqs,
# If there are data files included in your packages that need to be
# installed, specify them here.
include_package_data=True,
# List additional URLs that are relevant to your project as a dict.
project_urls={ # Optional
"Source": "https://github.com/jvsguerra/SERD/",
"Issues": "https://github.com/jvsguerra/SERD/issues",
},
ext_modules=[
Extension(
name="_SERD",
sources=["C/SERD.i", "C/SERD.c"],
include_dirs=[get_numpy_include(), "C"],
extra_compile_args=["-fopenmp", "-Ofast", "-lm"],
extra_link_args=(
["-lgomp", "-static"] if sys.platform != "linux" else ["-lgomp"]
),
),
]
)

0 comments on commit 45b2577

Please sign in to comment.