Skip to content

Commit

Permalink
Merge pull request #635 from biotite-dev/next-major-release
Browse files Browse the repository at this point in the history
Release Biotite 1.0
  • Loading branch information
padix-key authored Aug 27, 2024
2 parents 0404084 + 96bdf32 commit e77f8c4
Show file tree
Hide file tree
Showing 395 changed files with 23,194 additions and 15,005 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ env:


jobs:
lint:
name: Check code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install ruff
run: pip install ruff==0.5.2
- name: Check code formatting
run: ruff format --diff
- name: Lint code base
run: ruff check


generate-wheels-matrix:
name: "Generate wheels matrix"
runs-on: "ubuntu-latest"
Expand Down Expand Up @@ -211,6 +227,10 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
# Make sure to fetch the latest tag, so 'switcher.py' works correctly
fetch-depth: 0
fetch-tags: true
- uses: conda-incubator/setup-miniconda@v2
with:
environment-file: environment.yml
Expand Down Expand Up @@ -245,6 +265,7 @@ jobs:
permissions:
contents: write
needs:
- lint
- test-and-build
- make-sdist
- test-interfaces
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ htmlcov
# Ignore all compiled python files (e.g. from running the unit tests)
*.pyc
*.pyo
*.py{}
*.py-e

# Ignore potential directory created during install
Expand Down
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This package bundles popular tasks in computational molecular biology
into a uniform *Python* library.
It can handle a major part of the typical workflow
for sequence and biomolecular structure data:

- Searching and fetching data from biological databases
- Reading and writing popular sequence/structure file formats
- Analyzing and editing sequence/structure data
Expand Down Expand Up @@ -57,7 +57,6 @@ Installation

Some functions require some extra packages:

- **mdtraj** - Required for trajetory file I/O operations.
- **matplotlib** - Required for plotting purposes.

*Biotite* can be installed via *Conda*...
Expand Down
12 changes: 1 addition & 11 deletions doc/apidoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
"File",
"TextFile"
],
"Temporary files" : [
"temp_dir",
"temp_file"
],
"Visualization utilities":[
"set_font_size_in_coord",
"AdaptiveFancyArrow"
Expand Down Expand Up @@ -260,16 +256,14 @@
"superimpose",
"superimpose_homologs",
"superimpose_without_outliers",
"AffineTransformation",
"superimpose_apply"
"AffineTransformation"
],
"Filters" : [
"filter_canonical_nucleotides",
"filter_nucleotides",
"filter_canonical_amino_acids",
"filter_amino_acids",
"filter_carbohydrates",
"filter_backbone",
"filter_peptide_backbone",
"filter_phosphate_backbone",
"filter_linear_bond_continuity",
Expand All @@ -281,17 +275,13 @@
"filter_highest_occupancy_altloc"
],
"Checks" : [
"check_id_continuity",
"check_atom_id_continuity",
"check_res_id_continuity",
"check_backbone_continuity",
"check_duplicate_atoms",
"check_bond_continuity",
"check_linear_continuity"
],
"Repair" : [
"renumber_atom_ids",
"renumber_res_ids",
"create_continuous_res_ids",
"infer_elements",
"create_atom_names"
Expand Down
123 changes: 63 additions & 60 deletions doc/apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
# information.

__author__ = "Patrick Kunzmann"
__all__ = ["create_api_doc", "skip_non_methods"]
__all__ = ["create_api_doc", "skip_nonrelevant"]

from os.path import join, isdir
from os import listdir, makedirs
from importlib import import_module
import types
import json
import enum
from textwrap import dedent
import json
import types
from collections import OrderedDict

from importlib import import_module
from os import listdir, makedirs
from os.path import isdir, join
from textwrap import dedent

_INDENT = " " * 4

Expand All @@ -24,7 +23,6 @@
_pck_categories = json.load(file, object_pairs_hook=OrderedDict)



def create_api_doc(src_path, doc_path):
"""
Create *.rst files for API documentation.
Expand All @@ -40,11 +38,7 @@ def create_api_doc(src_path, doc_path):
# Create directory to store apidoc
if not isdir(doc_path):
makedirs(doc_path)
package_list = _create_package_doc(
"biotite",
join(src_path, "biotite"),
doc_path
)
package_list = _create_package_doc("biotite", join(src_path, "biotite"), doc_path)
_create_package_index(doc_path, package_list)


Expand All @@ -67,31 +61,35 @@ def _create_package_doc(pck, src_path, doc_path):
module = import_module(pck)
attr_list = dir(module)
# Classify attribute names into classes and functions
class_list = [attr for attr in attr_list
# Do not document private classes
if attr[0] != "_"
# Check if object is a class
and isinstance(getattr(module, attr), type)]
func_list = [attr for attr in attr_list
# Do not document private classes
if attr[0] != "_"
# All functions are callable...
and callable(getattr(module, attr))
# ...but classes are also callable
and attr not in class_list
]
class_list = [
attr
for attr in attr_list
# Do not document private classes
if attr[0] != "_"
# Check if object is a class
and isinstance(getattr(module, attr), type)
]
func_list = [
attr
for attr in attr_list
# Do not document private classes
if attr[0] != "_"
# All functions are callable...
and callable(getattr(module, attr))
# ...but classes are also callable
and attr not in class_list
]
# Create *.rst files
_create_package_page(doc_path, pck, class_list, func_list, sub_pck)
for class_name in class_list:
_create_class_page(doc_path, pck, class_name)
for function_name in func_list:
_create_function_page(doc_path, pck, function_name)

return([pck] + sub_pck)
return [pck] + sub_pck


def _create_package_page(doc_path, package_name,
classes, functions, subpackages):
def _create_package_page(doc_path, package_name, classes, functions, subpackages):
attributes = classes + functions

# Get categories for this package
Expand All @@ -114,7 +112,6 @@ def _create_package_page(doc_path, package_name,
misc_category_name = "Miscellaneous" if categories else "Content"
categories[misc_category_name] = misc_attributes


# String for categorized class and function enumeration
category_strings = []
for category, attrs in categories.items():
Expand All @@ -135,12 +132,11 @@ def _create_package_page(doc_path, package_name,
attributes_string = "\n".join(category_strings)

# String for subpackage enumeration
subpackages_string = "\n".join(
[_INDENT + pck for pck in subpackages]
)
subpackages_string = "\n".join([_INDENT + pck for pck in subpackages])

# Assemble page
file_content = dedent(f"""
file_content = (
dedent(f"""
``{package_name}``
{"=" * (len(package_name) + 4)}
Expand All @@ -150,16 +146,21 @@ def _create_package_page(doc_path, package_name,
.. currentmodule:: {package_name}
""") + attributes_string
""")
+ attributes_string
)
if len(subpackages) > 0:
file_content += dedent(f"""
file_content += (
dedent("""
Subpackages
-----------
.. autosummary::
""") + subpackages_string
""")
+ subpackages_string
)
with open(join(doc_path, f"{package_name}.rst"), "w") as f:
f.write(file_content)

Expand Down Expand Up @@ -201,18 +202,19 @@ def _create_function_page(doc_path, package_name, function_name):

def _create_package_index(doc_path, package_list):
# String for package enumeration
packages_string = "\n".join(
[_INDENT + pck for pck in sorted(package_list)]
)
packages_string = "\n".join([_INDENT + pck for pck in sorted(package_list)])

file_content = dedent(f"""
file_content = (
dedent("""
API Reference
=============
.. autosummary::
:toctree:
""") + packages_string
""")
+ packages_string
)
with open(join(doc_path, "index.rst"), "w") as f:
f.write(file_content)

Expand Down Expand Up @@ -249,20 +251,21 @@ def _is_relevant_type(obj):
# These are some special built-in Python methods
return False
return (
# Functions
type(obj) in [
types.FunctionType, types.BuiltinFunctionType, types.MethodType
]
) | (
# Functions from C-extensions
type(obj).__name__ in [
"cython_function_or_method",
"fused_cython_function"
]
) | (
# Enum instance
isinstance(obj, enum.Enum)
) | (
# Inner class
isinstance(obj, type)
)
(
# Functions
type(obj)
in [types.FunctionType, types.BuiltinFunctionType, types.MethodType]
)
| (
# Functions from C-extensions
type(obj).__name__ in ["cython_function_or_method", "fused_cython_function"]
)
| (
# Enum instance
isinstance(obj, enum.Enum)
)
| (
# Inner class
isinstance(obj, type)
)
)
Loading

0 comments on commit e77f8c4

Please sign in to comment.