Skip to content

Commit

Permalink
Move build backend to 'hatch'
Browse files Browse the repository at this point in the history
  • Loading branch information
padix-key committed Jun 13, 2024
1 parent d9b826b commit 70bd461
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 108 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ htmlcov
.eggs
.cache

# Ignore version file created by hatch-vcs
/src/biotite/version.py

# Ignore autogenerated API reference
/doc/apidoc

Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

4 changes: 4 additions & 0 deletions doc/viewcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def _index_attributes(package_name, src_path):
]
for source_file in source_files:
module_name = f"{package_name}.{splitext(source_file)[0]}"
if module_name == "biotite.version":
# Autogenerated module from hatch-vcs
# It contains no '__all__' attribute on purpose
continue
module = import_module(module_name)

if not hasattr(module, "__all__"):
Expand Down
41 changes: 30 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ description = "A comprehensive library for computational molecular biology"
readme = "README.rst"
authors = [{name = "The Biotite contributors"}]
license = {"file" = "LICENSE.rst"}

classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
Expand All @@ -19,7 +18,6 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Bio-Informatics",
]

# Based on https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg
# When updating our minimum supported python version follow minimums set in this setup.cfg
# as of 2022-01 for 3.7 "numpy >= 1.14.5", for 3.8 "numpy >= 1.17.3", for 3.9 "numpy >= 1.19.3"
Expand All @@ -32,22 +30,43 @@ dependencies = [
]
dynamic = ["version"]

[project.optional-dependencies]
test = [
"pytest",
]

[project.urls]
homepage = "https://www.biotite-python.org"
repository = "https://github.com/biotite-dev/biotite"
documentation = "https://www.biotite-python.org"

[tool.hatch.build.targets.sdist]
exclude = [
"tests",
"doc",
"environment.yml",
"setup_ccd.py"
]

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/biotite/version.py"

[tool.hatch.build.targets.wheel.hooks.cython]
dependencies = ["hatch-cython"]

[tool.hatch.build.targets.wheel.hooks.cython.options]
include_numpy = true
compile_py = false

[build-system]
requires = [
"setuptools >= 0.30",
"wheel >= 0.30",
"hatchling",
"hatch-vcs == 0.4",
"hatch-cython == 0.5",
"oldest-supported-numpy",
"cython >= 3.0"
]
build-backend = "setuptools.build_meta"

[project.optional-dependencies]
test = [
"pytest",
"cython >= 3.0",
]
build-backend = "hatchling.build"
93 changes: 0 additions & 93 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/biotite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
modules.
"""

__version__ = "0.41.0"
__name__ = "biotite"
__author__ = "Patrick Kunzmann"

from .file import *
from .temp import *
from .copyable import *
from .visualize import *
from .version import __version__, __version_tuple__
4 changes: 4 additions & 0 deletions tests/test_modname.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ def test_module_name(module_name):
# to obtain the package name
package_name = ".".join(module_name.split(".")[:-1])
module = importlib.import_module(module_name)
if module.__name__ == "biotite.version":
# Autogenerated module from hatch-vcs
# # It contains no '__name__' attribute on purpose
return
assert module.__name__ == package_name
9 changes: 9 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from importlib.metadata import version
import biotite


def test_version():
"""
Check if version imported from version.py is correct.
"""
assert biotite.__version__ == version("biotite")

0 comments on commit 70bd461

Please sign in to comment.