From 5d2de9994494f601c2d0c4a450407745fbb5ebd7 Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Tue, 19 Dec 2023 23:23:01 +0000 Subject: [PATCH] FIx CI (#112) * FIx CI * Fixes codecov failing cron CI because of being called too many times * Adds 3.11 CI * Adds 3.12 to upstream CI * Update and rename readthedocs.yml to .readthedocs.yml * switch to importlib * Drop py3.8, add py3.12 * fix CI * remove as_posix calls * fix relative path issues * pin to <7 sphinx * try fixing rtd * fix path * add sphinx theme to req * upgrade mambaforge * fix header * missing init file? * switch to micromamba action --------- Co-authored-by: Lily Wang --- .github/workflows/CI.yaml | 31 ++++++++++++++------------- .readthedocs.yaml | 19 ++++++++++++++++ docs/conf.py | 1 - docs/requirements.yaml | 3 ++- membrane_curvature/data/__init__.py | 1 + membrane_curvature/tests/datafiles.py | 26 +++++++++++----------- readthedocs.yml | 15 ------------- setup.py | 4 ++-- 8 files changed, 54 insertions(+), 46 deletions(-) create mode 100644 .readthedocs.yaml create mode 100644 membrane_curvature/data/__init__.py delete mode 100644 readthedocs.yml diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 3ae20bf..1f6283c 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -24,16 +24,16 @@ jobs: fail-fast: false matrix: os: [macOS-latest, ubuntu-latest, windows-latest] - python-version: [3.8, 3.9, "3.10"] + python-version: ["3.9", "3.10", "3.11"] env_file: [env, ] include: - name: minimum_requirements os: ubuntu-latest - python-version: 3.8 + python-version: 3.9 env_file: min steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Additional info about the build shell: bash @@ -44,22 +44,21 @@ jobs: # More info on options: https://github.com/conda-incubator/setup-miniconda # An environment for the minimum versions - - uses: conda-incubator/setup-miniconda@v2 + - name: setup micromamba + uses: mamba-org/setup-micromamba@v1 with: - python-version: ${{ matrix.python-version }} environment-file: devtools/conda-envs/test_${{ matrix.env_file }}.yaml - channels: conda-forge, defaults - activate-environment: test - auto-update-conda: false - auto-activate-base: false - show-channel-urls: true - + environment-name: test + create-args: >- + python=${{ matrix.python-version }} + - name: Install package # conda setup requires this special shell shell: bash -l {0} run: | python -m pip install . --no-deps - conda list + pip list + micromamba list - name: Run tests # conda setup requires this special shell @@ -68,7 +67,9 @@ jobs: pytest -v --cov=membrane_curvature --cov-report=xml --color=yes membrane_curvature/tests/ - name: CodeCov - uses: codecov/codecov-action@v2 + if: ${{ github.repository == 'MDAnalysis/membrane-curvature' + && github.event_name == 'pull_request' }} + uses: codecov/codecov-action@v3 with: file: ./coverage.xml flags: unittests @@ -80,10 +81,10 @@ jobs: strategy: fail-fast: false matrix: - latest-python : ["3.10", "3.11"] + latest-python : ["3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: ${{ matrix.latest-python }} diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..31adaf0 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,19 @@ +# readthedocs.yml + +version: 2 + +sphinx: + configuration: docs/conf.py + +build: + os: ubuntu-22.04 + tools: + python: "mambaforge-22.9" + +python: + install: + - method: setuptools + path: . + +conda: + environment: docs/requirements.yaml diff --git a/docs/conf.py b/docs/conf.py index 5367ce8..3d36894 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,7 +13,6 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # Incase the project was not installed -import membrane_curvature import os import sys sys.path.insert(0, os.path.abspath('..')) diff --git a/docs/requirements.yaml b/docs/requirements.yaml index 2b3f044..97295e2 100644 --- a/docs/requirements.yaml +++ b/docs/requirements.yaml @@ -10,8 +10,9 @@ dependencies: - MDAnalysis - ipython - MDAnalysisTests + - sphinx_rtd_theme # Pip-only installs - pip: - nbsphinx - ipywidgets - - nglview \ No newline at end of file + - nglview diff --git a/membrane_curvature/data/__init__.py b/membrane_curvature/data/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/membrane_curvature/data/__init__.py @@ -0,0 +1 @@ + diff --git a/membrane_curvature/tests/datafiles.py b/membrane_curvature/tests/datafiles.py index 67912c2..4efeb3d 100644 --- a/membrane_curvature/tests/datafiles.py +++ b/membrane_curvature/tests/datafiles.py @@ -23,22 +23,24 @@ "GRO_MEMBPROT_FIT" # Gromacs coordinates to load trajectory with fit ] -from pkg_resources import resource_filename +from importlib import resources + +_data_ref = resources.files('membrane_curvature.data') # Membrane protein systems -GRO_MEMBRANE_PROTEIN = resource_filename(__name__, '../data/test_curvature_abca1.gro') -XTC_MEMBRANE_PROTEIN = resource_filename(__name__, '../data/test_curvature_abca1.xtc') +GRO_MEMBRANE_PROTEIN = (_data_ref / 'test_curvature_abca1.gro') +XTC_MEMBRANE_PROTEIN = (_data_ref / 'test_curvature_abca1.xtc') # PO4 beads only -GRO_PO4 = resource_filename(__name__, '../data/test_curvature_po4_only.gro') -XTC_PO4 = resource_filename(__name__, '../data/test_curvature_po4_only.xtc') +GRO_PO4 = (_data_ref / 'test_curvature_po4_only.gro') +XTC_PO4 = (_data_ref / 'test_curvature_po4_only.xtc') # big systems -GRO_PO4_SMALL = resource_filename(__name__, '../data/test_po4_small.gro') -XTC_PO4_SMALL = resource_filename(__name__, '../data/test_po4_small.xtc') +GRO_PO4_SMALL = (_data_ref / 'test_po4_small.gro') +XTC_PO4_SMALL = (_data_ref / 'test_po4_small.xtc') # membrane-only -MEMB_GRO = resource_filename(__name__, '../data/MEMB_traj_short.gro') -MEMB_XTC = resource_filename(__name__, '../data/MEMB_traj_short.xtc') +MEMB_GRO = (_data_ref / 'MEMB_traj_short.gro') +MEMB_XTC = (_data_ref / 'MEMB_traj_short.xtc') # membrane-protein -GRO_MEMBPROT_FIT = resource_filename(__name__, '../data/Membrane_protein_fit.gro') -XTC_MEMBPROT_FIT = resource_filename(__name__, '../data/Membrane_protein_fit.xtc') +GRO_MEMBPROT_FIT = (_data_ref / 'Membrane_protein_fit.gro') +XTC_MEMBPROT_FIT = (_data_ref / 'Membrane_protein_fit.xtc') -del resource_filename +del resources diff --git a/readthedocs.yml b/readthedocs.yml deleted file mode 100644 index 69d6db5..0000000 --- a/readthedocs.yml +++ /dev/null @@ -1,15 +0,0 @@ -# readthedocs.yml - -version: 2 - -build: - image: latest - -python: - version: 3.8 - install: - - method: pip - path: . - -conda: - environment: docs/requirements.yaml \ No newline at end of file diff --git a/setup.py b/setup.py index d8cb529..e4e8d2e 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,7 @@ # 'Mac OS-X', # 'Unix', # 'Windows'], # Valid platforms your code works on, adjust to your flavor - python_requires=">=3.8", # Python version restrictions + python_requires=">=3.9", # Python version restrictions classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -70,10 +70,10 @@ 'Operating System :: POSIX', 'Topic :: Scientific/Engineering ', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ] # Manual control if final package is compressible or not, set False to prevent the .egg from being made # zip_safe=False,