Skip to content

Commit

Permalink
update package (#36)
Browse files Browse the repository at this point in the history
* update minimum Python to 3.8

* stop document Excel parsing and Rachel-style neutralization

* `black` formatting

* `black` formatting

* `ruff` linting

* move examples to notebooks

* run tests through GitHub actions

* remove Travis testing

* add GitHub actions to repo

* update version to 0.6.0

* `black` formatting

* sanitize `RuntimeWarning` in fitting

* fix `nbval` sanitize specs
  • Loading branch information
jbloom authored Dec 3, 2023
1 parent de8ef8c commit 34c7325
Show file tree
Hide file tree
Showing 32 changed files with 4,567 additions and 2,146 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
name: Run tests
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: checkout
uses: actions/checkout@v3

- name: install python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: install package and dependencies
run: pip install -e . && pip install -r test_requirements.txt

- name: lint code with ruff
run: ruff check .

- name: check code format with black
run: black --check .

- name: test code with `pytest`
run: pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.*
~*
!.github
!.gitignore
!.travis.yml
!.flake8
Expand Down
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

15 changes: 15 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ All notable changes to this project will be documented in this file.

The format is based on `Keep a Changelog <https://keepachangelog.com>`_.

0.6.0
------

Fixed
+++++
- Code format with ``black``
- Lint with ``ruff``
- Test with GitHub Actions rather than Travis
- Move examples in docs to notebooks so they can be tested with ``nbval`` and added to docs with ``nbsphinx``
- Update minimum Python to 3.8 and test on 3.11

Removed
+++++++
- Stop document the "Rachel-style neutralization" and parsing from Excel as these may be deprecated eventually.

0.5.7
------

Expand Down
11 changes: 9 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
======================================
neutcurve
======================================
.. image:: https://travis-ci.org/jbloomlab/neutcurve.svg
:target: https://travis-ci.org/jbloomlab/neutcurve.svg

.. image:: https://img.shields.io/pypi/v/neutcurve.svg
:target: https://pypi.python.org/pypi/neutcurve

.. image:: https://github.com/jbloomlab/neutcurve/actions/workflows/test.yaml/badge.svg
:target: https://github.com/jbloomlab/neutcurve/actions/workflows/test.yaml

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black

.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff

``neutcurve`` is a Python package written by the `Bloom lab <https://research.fhcrc.org/bloom/en.html>`_ for plotting neutralization curves.

See the `neutcurve documentation <https://jbloomlab.github.io/neutcurve/>`_ for details on how to install and use ``neutcurve``.
121 changes: 62 additions & 59 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# neutcurve documentation build configuration file.
#
# This file is execfile()d with the current directory set to its
Expand All @@ -21,7 +19,7 @@
import re
import sys

sys.path.insert(0, '{0}/..'.format(os.path.abspath('.')))
sys.path.insert(0, "{}/..".format(os.path.abspath(".")))


# -- General configuration ------------------------------------------------
Expand All @@ -36,52 +34,54 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.mathjax',
'sphinx.ext.githubpages',
'sphinx.ext.viewcode',
'nb2plots',
]
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.mathjax",
"sphinx.ext.githubpages",
"sphinx.ext.viewcode",
"nb2plots",
"nbsphinx",
"nbsphinx_link",
]

# avoid cropping of plots included using nbplot
# directive along lines described here:
# https://github.com/matplotlib/matplotlib/issues/4563#issuecomment-381366101
nbplot_rcparams = {'savefig.bbox': 'tight'}
nbplot_rcparams = {"savefig.bbox": "tight"}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'neutcurve'
project = "neutcurve"
copyright = f"2019--{datetime.datetime.now().year}, Bloom lab" # noqa: A001
author = u'the Bloom lab'
author = "the Bloom lab"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
# Read in the version from file
versionfile = os.path.abspath(os.path.join(
os.path.dirname(__file__), '../neutcurve/__init__.py'))
versionfile = os.path.abspath(
os.path.join(os.path.dirname(__file__), "../neutcurve/__init__.py")
)
with open(versionfile) as f:
versiontext = f.read()
versionmatches = re.findall(
r'__version__\s+=\s+[\'"]([^\'"]+)[\'"]',
versiontext)
versionmatches = re.findall(r'__version__\s+=\s+[\'"]([^\'"]+)[\'"]', versiontext)
if len(versionmatches) != 1:
raise ValueError(f"found {len(versionmatches)} matches for version "
f"in {versionfile}")
raise ValueError(
f"found {len(versionmatches)} matches for version " f"in {versionfile}"
)
else:
versionstring = versionmatches[0]
# The full version, including alpha/beta/rc tags.
Expand All @@ -92,16 +92,21 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.rst',
'examples/README.rst']
exclude_patterns = [
"_build",
"Thumbs.db",
".DS_Store",
"README.rst",
"examples/README.rst",
]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand All @@ -112,49 +117,48 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = "alabaster"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
'logo': 'BloomLogo.jpg',
'logo_name': 'true',
'description': 'Fit and plot neutralization curves',
'github_button': 'true',
'github_user': 'jbloomlab',
'github_repo': 'neutcurve',
'github_banner': 'true',
'travis_button': 'true',
'sidebar_width': '250px',
}
"logo": "BloomLogo.jpg",
"logo_name": "true",
"description": "Fit and plot neutralization curves",
"github_button": "true",
"github_user": "jbloomlab",
"github_repo": "neutcurve",
"github_banner": "true",
"sidebar_width": "250px",
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
"**": [
"about.html",
"navigation.html",
"relations.html", # needs 'show_related': True theme option to display
"searchbox.html",
"donate.html",
]
}


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'neutcurvedoc'
htmlhelp_basename = "neutcurvedoc"


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -163,15 +167,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -181,19 +182,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'neutcurve.tex', u'neutcurve Documentation',
u'the Bloom lab', 'manual'),
(master_doc, "neutcurve.tex", "neutcurve Documentation", "the Bloom lab", "manual"),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'neutcurve', u'neutcurve Documentation',
[author], 1)
]
man_pages = [(master_doc, "neutcurve", "neutcurve Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -202,7 +199,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'neutcurve', u'neutcurve Documentation',
author, 'neutcurve', 'Fit and plot neutralization curves',
'Miscellaneous'),
]
(
master_doc,
"neutcurve",
"neutcurve Documentation",
author,
"neutcurve",
"Fit and plot neutralization curves",
"Miscellaneous",
),
]
3 changes: 3 additions & 0 deletions docs/curvefits_example.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "../notebooks/curvefits_example.ipynb"
}
Loading

0 comments on commit 34c7325

Please sign in to comment.