Skip to content

Commit

Permalink
update docs and tests (#8)
Browse files Browse the repository at this point in the history
* update all refs to Bloom lab webpage to go to new lab website

* test w GitHub Actions rather than Travis

* lint w `ruff` rather than `flake8`

* format w black

* increment version and CHANGELOG

* fix bug introduced when linting
  • Loading branch information
jbloom authored Sep 20, 2024
1 parent c255e80 commit cf00195
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 72 deletions.
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

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:
- main
pull_request:
branches:
- main

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

- name: install python
uses: actions/setup-python@v5
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.*
~*

!.gitignore
!.travis.yml
!.git*

!.flake8
!.nojekyll

Expand Down
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

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

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

0.7
---
- Test with GitHub Actions rather than Travis, lint with ``ruff`` rather than ``flake8``.

0.6
---
- Allow negative site numbers.
Expand Down
22 changes: 5 additions & 17 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,19 @@ If these are not installed, install them with::

pip install -r test_requirements.txt

Then use flake8_ to `lint the code <https://en.wikipedia.org/wiki/Lint_%28software%29>`_ by running::
Then use `ruff <https://github.com/astral-sh/ruff>`_ to `lint the code <https://en.wikipedia.org/wiki/Lint_%28software%29>`_ by running::

flake8

If you need to change the flake8_ configuration, edit the `.flake8 <.flake8>`_ file.
ruff check .

Then run the tests with pytest_ by running::

pytest

If you need to change the pytest_ configuration, edit the `pytest.ini <pytest.ini>`_ file.

Automated testing on Travis
+++++++++++++++++++++++++++
The aforementioned flake8_ and pytest_ tests will be run automatically by the Travis_ continuous integration system as specified in the `.travis.yml <.travis.yml>`_ file.
Note that running the Travis_ tests requires you to register the project with Travis_.

If the tests are passing, you will see this on the Travis_ badge on GitHub repo main page.

Slack notifications of test results
+++++++++++++++++++++++++++++++++++++
You can configure Travis_ to provide automatic Slack notifications of the test results.
To do that, follow the `instructions here <https://docs.travis-ci.com/user/notifications/#configuring-slack-notifications>`_.
Automated testing Github Actions
+++++++++++++++++++++++++++++++++
The aforementioned tests are run automatically by Github actions as specified in `.github/workflows/test.yml <.github/workflows/test.yml>`_.


Building documentation
Expand All @@ -125,8 +115,6 @@ Finally, upload to PyPI_ with twine_ as `described here <https://github.com/pypa
Note that this requires you to have registered the package on PyPI_ if this is the first version of the package there.

.. _pytest: https://docs.pytest.org
.. _flake8: http://flake8.pycqa.org
.. _Travis: https://docs.travis-ci.com
.. _PyPI: https://pypi.org/
.. _pip: https://pip.pypa.io
.. _sphinx: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

binary representation of protein or nucleotide sequences
Copyright (C) 2021 `the Bloom lab <https://research.fhcrc.org/bloom/en.html>`_
Copyright (C) 2021 `the Bloom lab <https://jbloomlab.org/>`_

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
11 changes: 7 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ binarymap

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

.. image:: https://app.travis-ci.com/jbloomlab/binarymap.svg
:target: https://app.travis-ci.com/github/jbloomlab/binarymap
.. image:: https://github.com/jbloomlab/binarymap/actions/workflows/test.yml/badge.svg
:target: https://github.com/jbloomlab/binarymap/actions/workflows/test.yml
.. 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

Bbinary representation of protein or nucleotide sequences.

``binarymap`` is a Python package written by `the Bloom lab <https://research.fhcrc.org/bloom/en.html>`_.
``binarymap`` is a Python package written by `the Bloom lab <https://jbloomlab.org>`_.

The source code is `on GitHub <https://github.com/jbloomlab/binarymap>`_.

Expand Down
4 changes: 2 additions & 2 deletions binarymap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"""

__author__ = "`the Bloom lab <https://research.fhcrc.org/bloom/en.html>`_"
__author__ = "`the Bloom lab <https://jbloomlab.org>`_"
__email__ = "[email protected]"
__version__ = "0.6"
__version__ = "0.7"
__url__ = "https://github.com/jbloomlab/binarymap"

from binarymap.binarymap import BinaryMap # noqa: F401
5 changes: 2 additions & 3 deletions binarymap/binarymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""


import collections
import re

Expand Down Expand Up @@ -383,14 +382,14 @@ def __eq__(self, other):
"""
# following here: https://stackoverflow.com/a/390640
if type(other) != type(self):
if type(other) is not type(self):
return False
elif self.__dict__.keys() != other.__dict__.keys():
return False
else:
for key, val in self.__dict__.items():
val2 = getattr(other, key)
if type(val) != type(val2):
if type(val) is not type(val2):
return False
elif isinstance(val, numpy.ndarray):
if not numpy.array_equal(val, val2):
Expand Down
2 changes: 1 addition & 1 deletion docs/acknowledgments.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Acknowledgements
-----------------
``binarymap`` is written by `the Bloom lab <https://research.fhcrc.org/bloom/en.html>`_.
``binarymap`` is written by `the Bloom lab <https://jbloomlab.org>`_.

See https://github.com/jbloomlab/binarymap/graphs/contributors for the full list of contributors.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
# General information about the project.
project = "binarymap"
copyright = f"2019--{datetime.datetime.now().year}" # noqa: A001
author = "`the Bloom lab <https://research.fhcrc.org/bloom/en.html>`_"
author = "`the Bloom lab <https://jbloomlab.org>`_"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -193,7 +193,7 @@
master_doc,
"binarymap.tex",
"binarymap Documentation",
"`the Bloom lab <https://research.fhcrc.org/bloom/en.html>`_",
"`the Bloom lab <https://jbloomlab.org/>`_",
"manual",
),
]
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
``binarymap`` documentation
===================================================

``binarymap`` is a Python package written by `the Bloom lab <https://research.fhcrc.org/bloom/en.html>`_.
``binarymap`` is a Python package written by `the Bloom lab <https://jbloomlab.org>`_.

The package is designed to convert protein / nucleotide sequences into binary representations.

Expand Down
8 changes: 7 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
[pytest]
addopts = binarymap docs --nbval --ignore setup.py --ignore docs/_build --doctest-modules
addopts =
binarymap
docs
--nbval
--ignore setup.py
--ignore docs/_build
--doctest-modules
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Setup script for ``binarymap``."""


import re
import sys

Expand Down
9 changes: 1 addition & 8 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
pytest
flake8
black
flake8-docstrings
flake8-rst-docstrings
flake8-builtins
flake8-import-order
flake8-comprehensions
flake8-bugbear
flake8-print
ruff
nbval

0 comments on commit cf00195

Please sign in to comment.