From 45eddc08e64478ae0b52d1fe32c3a9529879c68b Mon Sep 17 00:00:00 2001
From: Ryan Dale <ryan.dale@nih.gov>
Date: Mon, 24 Jan 2022 08:42:25 -0500
Subject: [PATCH] Move to MIT license, v0.9 (fix #286) (#360)

* switch to MIT license, following bedtools lead

* update version and changelog

* rm remaining travis-ci config and script

* include py3.9 in tests
---
 .github/workflows/main.yml      |   2 +-
 .travis.yml                     |  40 ------------
 LICENSE.txt                     |  31 +++++----
 condatest.sh                    | 112 --------------------------------
 docs/source/changes.rst         |  29 +++++++++
 docs/source/index.rst           |   5 +-
 pybedtools/include/bedFile.cpp  |   2 +-
 pybedtools/include/bedFile.h    |   2 +-
 pybedtools/include/fileType.cpp |   2 +-
 pybedtools/include/fileType.h   |   2 +-
 setup.py                        |   4 +-
 11 files changed, 56 insertions(+), 175 deletions(-)
 delete mode 100644 .travis.yml
 delete mode 100755 condatest.sh

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 31fb63b4..b6512445 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -5,7 +5,7 @@ jobs:
   build-and-test:
     strategy:
       matrix:
-        python-version: [3.6, 3.7, 3.8]
+        python-version: [3.6, 3.7, 3.8, 3.9]
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@v2
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 145fe76f..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,40 +0,0 @@
-# os:
-#   - linux
-#   - osx
-
-# make edits to this line to trigger a new travis build.
-# (sometimes it errors out trying to download from PyPI)
-language: python
-
-# see https://github.com/travis-ci/travis-ci/issues/9815 for py3.7 support
-matrix:
-  include:
-    - python: 3.6
-    - python: 3.7
-    - python: 3.8
-      dist: xenial
-      sudo: true
-
-notifications:
-    email:
-        recipients:
-            - ryankdale@gmail.com
-            - dalerr@niddk.nih.gov
-        on_success: always
-        on_failure: always
-
-services:
-  - xvfb
-
-# Most of this is from http://conda.pydata.org/docs/travis.html
-install:
-    - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
-    - bash miniconda.sh -b -p $HOME/miniconda
-    - export PATH="$HOME/miniconda/bin:$PATH"
-    - hash -r
-    - conda config --set always_yes yes --set changeps1 no
-    - conda update -q conda
-    - conda info -a
-
-script:
-    - ./condatest.sh "$TRAVIS_PYTHON_VERSION"
diff --git a/LICENSE.txt b/LICENSE.txt
index 2429d351..5b47eb98 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,19 +1,22 @@
-Wrapper for Aaron Quinlan's BEDtools, plus other useful methods for working
-with BED, BAM, GFF, and VCF files
+Wrapper -- and more -- for BEDtools
 
-Copyright (c) 2010-2015 Ryan Dale
+Copyright (c) 2010-2022 Ryan Dale
 All rights reserved.
 
-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 the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
 
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc., 51
-Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/condatest.sh b/condatest.sh
deleted file mode 100755
index 416cbf0e..00000000
--- a/condatest.sh
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/bin/bash
-
-set -e
-
-PY_VERSION=$1
-
-usage="Usage: $0 py_version[2|3]"
-: ${PY_VERSION:?$usage}
-
-
-log () {
-    echo
-    echo "[`date`] TEST HARNESS: $1"
-    echo
-}
-
-
-eval "$(conda shell.bash hook)"
-
-# ----------------------------------------------------------------------------
-# sdist and pip install tests
-# ----------------------------------------------------------------------------
-# Build an environment with just Python and Cython. We do this fresh each time.
-log "building fresh environment with just python and cython"
-with_cy="pbtpy${PY_VERSION}_sdist_cython"
-if conda env list | grep -q $with_cy; then
-    conda env remove -y -n $with_cy
-fi
-conda create -n $with_cy -y --channel conda-forge --channel bioconda python=${PY_VERSION} cython
-conda activate $with_cy
-
-# Clone the repo -- so we're only catching things committed to git -- into
-# a temp dir
-log "cloning into temp dir"
-HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-TMP=/tmp/pybedtools-deploy
-rm -rf $TMP
-git clone $HERE $TMP
-cd $TMP
-
-log "cythonizing source files and building source package"
-# Cythonize the .pyx filex to .cpp, and build a source package
-python setup.py clean cythonize sdist
-
-log "installing source package with pip"
-# Install into the environment to verify that everything works (just an import
-# test)
-(cd dist && pip install pybedtools-*.tar.gz && python -c 'import pybedtools; print(pybedtools.__file__)')
-
-
-# ----------------------------------------------------------------------------
-# Unit tests
-# ----------------------------------------------------------------------------
-# Deactivate that env, and build another one with all requirements that we'll
-# use for unit tests.
-conda deactivate
-no_cy="pbtpy${PY_VERSION}_conda_no_cython"
-if ! conda env list | grep -q $no_cy; then
-    log "creating environment"
-
-    # conflicts with pysam in bioconda for py37 or py38 so remove it from
-    # conda requirements; allow to install from pip
-    TMPREQS=$(tempfile)
-    REQS=requirements.txt
-    if [[ "$PY_VERSION" == "3.7" ]]; then
-        grep -v pysam requirements.txt > $TMPREQS
-        REQS=$TMPREQS
-    fi
-
-    if [[ "$PY_VERSION" == "3.8" ]]; then
-        grep -v pysam requirements.txt > $TMPREQS
-        REQS=$TMPREQS
-    fi
-
-    OPTREQS=optional-requirements.txt
-
-    conda create -n $no_cy -y \
-        --channel conda-forge \
-        --channel bioconda \
-        python=${PY_VERSION} \
-        --file $REQS \
-        --file test-requirements.txt \
-        --file $OPTREQS
-else
-    echo "Using existing environment '${no_cy}'"
-fi
-source activate $no_cy
-
-log "unpacking source package and install with pip install -e into $no_cy env"
-mkdir -p /tmp/pybedtools-uncompressed
-cd /tmp/pybedtools-uncompressed
-tar -xf $TMP/dist/pybedtools-*.tar.gz
-cd pybedtools-*
-pip install -e .
-
-# The import manipulation in genomepy tests conflicts with the import
-# manipulation in test_helpers and test_issues. So run in its own separate
-# pytests process.
-log "Unit tests"
-pytest -v --doctest-modules
-pytest -v pybedtools/test/genomepy_integration.py
-
-# ----------------------------------------------------------------------------
-# sphinx doctests
-# ----------------------------------------------------------------------------
-# Since the docs aren't included in the MANIFEST and therefore aren't included
-# in the source distribution, we copy them over from the repo we checked out.
-log "copying over docs directory from repo"
-cp -r $TMP/docs .
-
-log "sphinx doctests"
-(cd docs && make clean doctest)
diff --git a/docs/source/changes.rst b/docs/source/changes.rst
index 5ffe8257..06a19db2 100644
--- a/docs/source/changes.rst
+++ b/docs/source/changes.rst
@@ -3,6 +3,35 @@
 Changelog
 =========
 
+Changes in v0.9
+---------------
+
+2022-01-23
+
+The biggest change is that pybedtools is now under the MIT license, following
+the lead of BEDTools itself.
+
+Bugfixes:
+
+* Bugfix: `Interval` objects representing VCF lines now have their `start`
+  attribute correctly zero-based, as indicated in the docs and consistent with
+  other 1-based formats. See `#355 <https://github.com/daler/pybedtools/issues/355>`_.
+* Bugfix: Manually creating `Interval` objects using the `otherfields` argument
+  now correctly converts to C++ strings. See `#348
+  <https://github.com/daler/pybedtools/issues/348>`_.
+* Bugfix: Workaround for `BedTool.intersect` which in some versions of BEDTools
+  requires a specific order of arguments. Fixes `#345
+  <https://github.com/daler/pybedtools/issues/345>`_ and also is a better way
+  of addressing `#81 <https://github.com/daler/pybedtools/issues/81>`_.
+
+Code cleanup:
+
+* Removed some remnants of Python 2.7 support (thanks @DavidCain)
+* Updates to setup.py classifiers to better reflect state of code (thanks @DavidCain)
+* Sorted filenames in setup.py to improve reproducibility of build (thanks @lamby)
+* Tests converted to run on GitHub Actions (see `#339
+  <https://github.com/daler/pybedtools/pull/339>`_).
+
 Changes in v0.8.2
 -----------------
 
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 7dc2ba8a..29ec082c 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -12,8 +12,9 @@
 
 
 
-`pybedtools` is released under the GPLv2 license; see LICENSE.txt for more
-info.
+As of 2022, `pybedtools` is released under the MIT license; see LICENSE.txt for
+more info.
+
 
 .. note::
 
diff --git a/pybedtools/include/bedFile.cpp b/pybedtools/include/bedFile.cpp
index 65693629..b53dcdb2 100644
--- a/pybedtools/include/bedFile.cpp
+++ b/pybedtools/include/bedFile.cpp
@@ -7,7 +7,7 @@ Department of Biochemistry and Molecular Genetics
 University of Virginia
 aaronquinlan@gmail.com
 
-Licensed under the GNU General Public License 2.0 license.
+Licensed under the MIT license (as of Jan 2022)
 ******************************************************************************/
 #include "bedFile.h"
 
diff --git a/pybedtools/include/bedFile.h b/pybedtools/include/bedFile.h
index 38dcf6d2..888e2bb8 100644
--- a/pybedtools/include/bedFile.h
+++ b/pybedtools/include/bedFile.h
@@ -7,7 +7,7 @@
   University of Virginia
   aaronquinlan@gmail.com
 
-  Licensed under the GNU General Public License 2.0 license.
+  Licensed under the MIT license (as of Jan 2022)
 ******************************************************************************/
 #ifndef BEDFILE_H
 #define BEDFILE_H
diff --git a/pybedtools/include/fileType.cpp b/pybedtools/include/fileType.cpp
index ce41e728..b47dbacc 100644
--- a/pybedtools/include/fileType.cpp
+++ b/pybedtools/include/fileType.cpp
@@ -7,7 +7,7 @@
   University of Virginia
   aaronquinlan@gmail.com
 
-  Licensed under the GNU General Public License 2.0 license.
+  Licensed under the MIT license (as of Jan 2022)
 ******************************************************************************/
 
 #include "fileType.h"
diff --git a/pybedtools/include/fileType.h b/pybedtools/include/fileType.h
index 3642a4ba..fe2c8145 100644
--- a/pybedtools/include/fileType.h
+++ b/pybedtools/include/fileType.h
@@ -7,7 +7,7 @@
   University of Virginia
   aaronquinlan@gmail.com
 
-  Licensed under the GNU General Public License 2.0 license.
+  Licensed under the MIT license (as of Jan 2022)
 ******************************************************************************/
 #ifndef FILETYPE_H
 #define FILETYPE_H
diff --git a/setup.py b/setup.py
index 1de81fe5..ea25993b 100644
--- a/setup.py
+++ b/setup.py
@@ -76,8 +76,8 @@
 
 
 MAJ = 0
-MIN = 8
-REV = 2
+MIN = 9
+REV = 0
 VERSION = '%d.%d.%d' % (MAJ, MIN, REV)