From a197aa92cb70379db2e3100cec3ac084fbdf63b3 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Tue, 18 Jun 2024 11:59:23 -0700 Subject: [PATCH 01/10] Update pins --- setup.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 16620ea..c223916 100644 --- a/setup.py +++ b/setup.py @@ -108,23 +108,22 @@ def run(self): version=versioneer.get_version(), description='Balanced parentheses', author='Daniel McDonald', - author_email='d3mcdonald@eng.ucsd.edu', + author_email='damcdonald@ucsd.edu', maintainer='Daniel McDonald', - maintainer_email='d3mcdonald@eng.ucsd.edu', + maintainer_email='damcdonald@ucsd.edu', url='https://github.com/biocore/improved-octo-waddle', packages=['bp'], ext_modules=extensions, include_dirs=[np.get_include(), bitarr], setup_requires=['numpy >= 1.9.2'], - package_data={'bp': ['BitArray/*', - 'GPL/*']}, + package_data={'bp': ['BitArray/*', ]}, install_requires=[ 'numpy >= 1.9.2', 'nose >= 1.3.7', - 'cython >= 0.24.1', + 'cython >= 0.24.1, < 1.0.0', 'pandas', 'click', - 'scikit-bio >= 0.5.0, < 0.6.0'], + 'scikit-bio >= 0.5.0'], long_description=long_description, long_description_content_type='text/markdown', cmdclass=versioneer.get_cmdclass({'build_py': BitArrayBuild, From b9668c0c19c0f400fb13043c6b1b85778a1f388c Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Tue, 18 Jun 2024 12:19:47 -0700 Subject: [PATCH 02/10] bump pyversion and scope intel/mx osx systems --- .github/workflows/python-package-conda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 04a8ec7..bc714b5 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -10,8 +10,8 @@ jobs: strategy: max-parallel: 5 matrix: - python-version: ['3.7', '3.8', '3.9'] - os: [ubuntu-latest, macos-latest] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + os: [ubuntu-latest, macos-13, macos-14] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 From f6ec237b670705d8f1c86ab2c1394e91afb5e957 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Tue, 18 Jun 2024 12:33:16 -0700 Subject: [PATCH 03/10] more kicking --- .github/workflows/python-package-conda.yml | 45 +++++++++++++++------- ci/conda_host_env.yml | 6 +++ ci/conda_requirements.txt | 4 +- 3 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 ci/conda_host_env.yml diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index bc714b5..ee4a56a 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -5,39 +5,56 @@ on: branches: [ master ] pull_request: +env: + latest_python: "3.12" + supported_pythons: '["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]' + miniforge_version: "22.9.0-2" + miniforge_variant: "Mambaforge" + jobs: + conf: + # This job is needed to route the global environment variables into + # a context that's available for matrix (and name, but that's unimportant) + name: Prepare Test Plan + runs-on: "ubuntu-latest" + outputs: + latest_python: ${{ steps.set-vars.outputs.latest_python }} + supported_pythons: ${{ steps.set-vars.outputs.supported_pythons }} + steps: + - name: Report Plan + id: set-vars + run: | + echo "latest_python=$latest_python" >> $GITHUB_OUTPUT + echo "supported_pythons=$supported_pythons" >> $GITHUB_OUTPUT build-linux: strategy: max-parallel: 5 + fail-fast: true matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python_version: ${{ fromJSON(needs.conf.outputs.supported_pythons) }} os: [ubuntu-latest, macos-13, macos-14] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + - uses: conda-incubator/setup-miniconda@v2 with: - python-version: ${{ matrix.python-version }} - - name: Add conda to system path - run: | - # $CONDA is an environment variable pointing to the root of the miniconda directory - echo $CONDA/bin >> $GITHUB_PATH + auto-update-conda: true + python-version: ${{ matrix.python_version }} + miniforge-version: ${{ env.miniforge_version }} + miniforge-variant: ${{ env.miniforge_variant }} + environment-file: ci/conda_host_env.yml - name: Install dependencies + shell: bash -l {0} run: | - conda install python=${{ matrix.python-version }} cython scikit-bio numpy - pip install versioneer - pip install -e . + conda install --yes -c conda-forge --file ci/conda_requirements.txt - name: Lint with flake8 run: | - conda install flake8 # stop the build if there are Python syntax errors or undefined names flake8 bp --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 bp --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - conda install pytest pytest diff --git a/ci/conda_host_env.yml b/ci/conda_host_env.yml new file mode 100644 index 0000000..b2b1f1e --- /dev/null +++ b/ci/conda_host_env.yml @@ -0,0 +1,6 @@ +# directly adapted from +# https://github.com/biocore/scikit-bio/blob/31123c6471dc62f45a55bfdff59c61a4850be367/ci/conda_host_env.yml#LL1C1-L9C35 +name: testing +channels: + - conda-forge + - defaults diff --git a/ci/conda_requirements.txt b/ci/conda_requirements.txt index 8581916..e57f41f 100644 --- a/ci/conda_requirements.txt +++ b/ci/conda_requirements.txt @@ -1,5 +1,5 @@ -nose +pytest numpy flake8 -cython +cython < 1.0.0 scikit-bio From 2e498d3ea62418649bf45f809f9a3b83352af6c1 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Tue, 18 Jun 2024 12:37:23 -0700 Subject: [PATCH 04/10] more kick --- .github/workflows/python-package-conda.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index ee4a56a..98bd035 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -4,6 +4,7 @@ on: push: branches: [ master ] pull_request: + branches: [ master ] env: latest_python: "3.12" @@ -26,7 +27,8 @@ jobs: run: | echo "latest_python=$latest_python" >> $GITHUB_OUTPUT echo "supported_pythons=$supported_pythons" >> $GITHUB_OUTPUT - build-linux: + build-lint-test: + needs: conf strategy: max-parallel: 5 fail-fast: true From 52aa9080eccae5848b177a7f7e9350f6d3494fa9 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Tue, 18 Jun 2024 12:42:10 -0700 Subject: [PATCH 05/10] more kick --- .github/workflows/python-package-conda.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 98bd035..2cd404a 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -52,11 +52,13 @@ jobs: run: | conda install --yes -c conda-forge --file ci/conda_requirements.txt - name: Lint with flake8 + shell: bash -l {0} run: | # stop the build if there are Python syntax errors or undefined names flake8 bp --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 bp --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest + shell: bash -l {0} run: | pytest From e542bca0a75f84b5041ff5290a28c47036589a90 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Tue, 18 Jun 2024 12:52:12 -0700 Subject: [PATCH 06/10] actually install --- .github/workflows/python-package-conda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 2cd404a..ae270a2 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -51,6 +51,7 @@ jobs: shell: bash -l {0} run: | conda install --yes -c conda-forge --file ci/conda_requirements.txt + pip install . --no-deps - name: Lint with flake8 shell: bash -l {0} run: | From a4c08e2def954c90f0d896823ed439bbe37f8526 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Tue, 18 Jun 2024 13:06:38 -0700 Subject: [PATCH 07/10] confused --- .github/workflows/python-package-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index ae270a2..56243ff 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -51,7 +51,6 @@ jobs: shell: bash -l {0} run: | conda install --yes -c conda-forge --file ci/conda_requirements.txt - pip install . --no-deps - name: Lint with flake8 shell: bash -l {0} run: | @@ -62,4 +61,5 @@ jobs: - name: Test with pytest shell: bash -l {0} run: | + pip install . --no-deps pytest From aed4a7fe53f71314c41814be3e9581dd520c01f0 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Tue, 18 Jun 2024 13:29:35 -0700 Subject: [PATCH 08/10] confused --- .github/workflows/python-package-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 56243ff..d23c562 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -61,5 +61,5 @@ jobs: - name: Test with pytest shell: bash -l {0} run: | - pip install . --no-deps + pip install --no-deps -e . pytest From ca7ac23c73f6a6fdaa507db191a858e45aefd1c4 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Tue, 18 Jun 2024 21:35:27 -0700 Subject: [PATCH 09/10] no more 37 --- .github/workflows/python-package-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index d23c562..e1272aa 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -8,7 +8,7 @@ on: env: latest_python: "3.12" - supported_pythons: '["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]' + supported_pythons: '["3.8", "3.9", "3.10", "3.11", "3.12"]' miniforge_version: "22.9.0-2" miniforge_variant: "Mambaforge" From 06c4ac47bf2d8cecac9265a4b6340b597b22ae15 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Wed, 26 Jun 2024 16:07:55 -0700 Subject: [PATCH 10/10] use np sum --- bp/_conv.pyx | 8 ++++---- setup.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bp/_conv.pyx b/bp/_conv.pyx index 11b983c..5006be6 100644 --- a/bp/_conv.pyx +++ b/bp/_conv.pyx @@ -24,9 +24,9 @@ def to_skbio_treenode(BP bp): The tree represented as an skbio.TreeNode """ cdef int i - - nodes = [skbio.TreeNode() for i in range(sum(bp.B))] - + + nodes = [skbio.TreeNode() for i in range(bp.B.sum())] + # skbio.TreeNode.append makes a very expensive call to # invalidate_caches. Let's remove that from consideration # temporarily while constructing the tree @@ -41,7 +41,7 @@ def to_skbio_treenode(BP bp): root = nodes[0] - for i in range(sum(bp.B)): + for i in range(bp.B.sum()): node_idx = bp.preorderselect(i) nodes[i].name = bp.name(node_idx) nodes[i].length = bp.length(node_idx) diff --git a/setup.py b/setup.py index c223916..81e8ec1 100644 --- a/setup.py +++ b/setup.py @@ -101,7 +101,8 @@ def run(self): if USE_CYTHON: from Cython.Build import cythonize - extensions = cythonize(extensions) + extensions = cythonize(extensions, + language_level=3) setup(name='iow',