Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: drop support for py 3.8 and update to poetry 2 in our CI #249

Merged
merged 36 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2ad50c7
try to update to poetry 2
aryarm Jan 16, 2025
8b5a69b
update dev-env.yml
aryarm Jan 18, 2025
a49d536
migrate pyproject for poetry 2
aryarm Jan 21, 2025
e04c98a
add poetry-plugin-shell to conda env
aryarm Jan 21, 2025
f1ee332
try to lock for py3.9
aryarm Jan 21, 2025
d2c66e9
Revert "try to lock for py3.9"
aryarm Jan 21, 2025
6de4fe8
upgrade to min pep517 and py3.9 compatible dependency versions
aryarm Jan 23, 2025
8a0fc10
revert to previous min dependency versions
aryarm Jan 23, 2025
f651f00
try to include both lowest versions and py3.9 versions
aryarm Jan 31, 2025
bbc0ad4
revert noxfile
aryarm Jan 31, 2025
a7dd884
manually edit lock file hash to sync with pyproject
aryarm Jan 31, 2025
6d58b11
continue to revert noxfile - fix typos
aryarm Jan 31, 2025
e26ffc8
try again to lock all versions
aryarm Jan 31, 2025
8962007
manually edit lock file hash to sync with pyproject
aryarm Jan 31, 2025
fb55dea
oops try again to lock all versions with correct py marker for scipy
aryarm Jan 31, 2025
a78be1b
manually edit lock file hash to sync with pyproject
aryarm Jan 31, 2025
95be676
revert macos-13 ci test to py3.8
aryarm Jan 31, 2025
08f2580
oops try latest for macos
aryarm Jan 31, 2025
5411879
use strategy in https://github.com/orgs/python-poetry/discussions/101…
aryarm Feb 4, 2025
1846334
also lock for 3.10+
aryarm Feb 4, 2025
44563cf
remove conda defaults from tests.yml
aryarm Feb 4, 2025
f416839
use locked dependencies in noxfile
aryarm Feb 4, 2025
27b95af
clarify how to lock dependencies now
aryarm Feb 4, 2025
3bb0173
lock at a version of cyvcf2 which is compatible with numpy 2
aryarm Feb 4, 2025
04ea60e
ensure proper venv is used in devcontainer
aryarm Feb 5, 2025
ba07b97
update to newest pysam in lock file
aryarm Feb 5, 2025
37c5dbc
add py3.13 ci test
aryarm Feb 5, 2025
5af870d
remove py3.13 ci test
aryarm Feb 5, 2025
44e4f9a
add use-only-tar-bz2 to make caching work better hopefully
aryarm Feb 5, 2025
f54b8e5
revert use-only-tar-bz2 bc it broke everything
aryarm Feb 5, 2025
27c43be
upgrade to newest poetry
aryarm Feb 15, 2025
aa8b064
relock with newest poetry
aryarm Feb 16, 2025
9d66e3b
explain the new locking strategy in the docs
aryarm Feb 16, 2025
3203542
docs: explain when to run poetry lock
aryarm Feb 16, 2025
2e8d57a
Update pyproject.toml
aarushi03 Feb 18, 2025
8b251ec
relock after changes to pyproject
aryarm Feb 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,41 @@
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/rocker-org/devcontainer-features/miniforge:2": {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "mamba env create -n trtools -f dev-env.yml && conda run -n trtools poetry install",
"postCreateCommand": "mamba env create -y -n trtools -f dev-env.yml && conda run -n trtools poetry config virtualenvs.in-project true && conda run -n trtools poetry install",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-vscode.live-server"
"ms-vscode.live-server",
"GitHub.vscode-github-actions"
],
"settings": {
"python.analysis.typeCheckingMode": "off",
"python.condaPath": "/opt/conda/condabin/conda",
"python.defaultInterpreterPath": "/opt/conda/envs/trtools/bin/python",
"python.terminal.activateEnvironment": true,
"python.terminal.activateEnvInCurrentTerminal": true,
"python.venvFolders": ["/home/vscode/.cache/pypoetry/virtualenvs"],
"python.venvPath": "/opt/conda/envs/trtools",
"python.defaultInterpreterPath": "/opt/conda/envs/trtools/bin/python",
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"terminal.integrated.environmentChangesRelaunch": true,
"terminal.integrated.hideOnStartup": "always"
"terminal.integrated.hideOnStartup": "always",
"files.eol": "\n",
"git.autofetch": true,
"git.enableSmartCommit": true,
"git.confirmSync": false
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
if: ${{ steps.release.outputs.release_created }}
uses: actions/setup-python@v4
with:
python-version: '3.8' # keep in sync with dev-env.yml
python-version: '3.9' # keep in sync with dev-env.yml

- name: Upgrade pip
if: ${{ steps.release.outputs.release_created }}
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Install Poetry
if: ${{ steps.release.outputs.release_created }}
run: |
pip install 'poetry==1.8.3' # keep version in sync with dev-env.yml
pip install 'poetry==2.1.0' # keep version in sync with dev-env.yml
poetry --version

- name: Build package
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ jobs:
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
- { python: "3.12", os: "ubuntu-latest", session: "tests" }
# - { python: "3.11", os: "windows-latest", session: "tests" }
- { python: "3.8", os: "macos-13", session: "tests" }
- { python: "3.9", os: "macos-latest", session: "tests" }
- { python: "3.8", os: "ubuntu-latest", session: "size" }
- { python: "3.8", os: "ubuntu-latest", session: "coverage" }
# - { python: "3.13", os: "ubuntu-latest", session: "tests" }
# - { python: "3.13", os: "windows-latest", session: "tests" }
- { python: "3.9", os: "macos-13", session: "tests" }
- { python: "3.12", os: "macos-latest", session: "tests" }
- { python: "3.9", os: "ubuntu-latest", session: "size" }
- { python: "3.9", os: "ubuntu-latest", session: "coverage" }

env:
NOXSESSION: ${{ matrix.session }}
Expand All @@ -38,7 +39,9 @@ jobs:
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
# use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
activate-environment: trtools
conda-remove-defaults: true
auto-activate-base: false
miniforge-version: latest
use-mamba: true
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: "ubuntu-22.04"
tools:
python: "3.8"
python: "3.9"
jobs:
post_create_environment:
# Install poetry
Expand Down
17 changes: 9 additions & 8 deletions dev-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ channels:
- bioconda
- nodefaults
dependencies:
- conda-forge::python=3.8 # the lowest version of python that we formally support
- conda-forge::pip==24.0
- bioconda::bcftools==1.20
- conda-forge::python=3.9 # the lowest version of python that we formally support; keep in sync with release.yml, tests.yml, .readthedocs.yaml, and noxfile.py
- conda-forge::pip==24.3.1
- bioconda::bcftools==1.21
- bioconda::art==2016.06.05
- conda-forge::poetry==1.8.3 # keep in sync with release.yml
- conda-forge::nox==2024.4.15
- conda-forge::poetry-plugin-export==1.8.0
- conda-forge::poetry==2.1.0 # keep in sync with release.yml
- conda-forge::nox==2024.10.9
- conda-forge::poetry-plugin-export==1.9.0
- pip:
- nox-poetry==1.0.3
- poetry-conda==0.1.1
- nox-poetry==1.1.0
- poetry-conda==0.1.4
- poetry-plugin-shell==1.0.1
7 changes: 4 additions & 3 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ If you use TRTools in your work, please cite: Nima Mousavi, Jonathan Margoliash,
Install
-------

Note: TRTools supports Python versions 3.8 and up. We do not officially support python version 3.7 as it is `end of life <https://devguide.python.org/versions/#status-of-python-versions>`_, but we believe TRTools likely works with it from previous testing results.
Note: TRTools supports Python versions 3.9 and up. We do not officially support python version 3.7 or 3.8 as they are `end of life <https://devguide.python.org/versions/#status-of-python-versions>`_, but we believe TRTools likely works with them from previous testing results.

With conda
^^^^^^^^^^
Expand Down Expand Up @@ -172,8 +172,9 @@ We appreciate contributions to TRTools. If you would like to contribute a fix or
#. Make your changes.
#. If you need to add a dependency or update the version of a dependency, you can use the :code:`poetry add` command.

* You should specify a `version constraint <https://python-poetry.org/docs/master/dependency-specification#version-constraints>`_ when adding a dependency. Use the oldest version compatible with your code. For example, to specify a version of :code:`numpy>=1.23.0`, you can run :code:`poetry add 'numpy>=1.23.0'`. Note: For most cases, a version constraint operator of :code:`>=` `is better than <https://iscinumpy.dev/post/bound-version-constraints>`_ poetry's default of :code:`^`.
* Afterward, double-check that the :code:`poetry.lock` file contains 1.23.0 in it. **All of our dependencies should be locked to their minimum versions at all times.** To downgrade to a specific version of :code:`numpy` in our lock file, you can explicitly add the version via :code:`poetry add 'numpy==1.23.0'`, manually edit the pyproject.toml file to use a :code:`>=` sign in front of the version number, and then run :code:`poetry lock --no-update`. The :code:`--no-update` is important because otherwise, poetry will try to update other dependencies in the lock file.
* You should specify a `version constraint <https://python-poetry.org/docs/master/dependency-specification#version-constraints>`_ when adding a dependency. Use the oldest version compatible with your code. For example, to specify a version of :code:`numpy>=1.23.0`, you can run :code:`poetry add 'numpy>=1.23.0'`.
* Afterward, double-check that the :code:`pyproject.toml` file has been changed appropriately. Our minimum version constraints should be listed in the `[project.dependencies]` section and the locked versions should appear in the `[tool.poetry.dependencies]` section. Ideally, the `[tool.poetry.dependencies]` section should contain at least the minimum supported version and the latest version of each dependency at all times. After making any changes to the :code:`pyproject.toml` file, you must run the :code:`poetry lock` command to sync with the :code:`poetry.lock` file.
* We try to keep the oldest version of python that is not `end-of-life <https://devguide.python.org/versions>`_ in our development environment (:code:`dev-env.yml` file), so that developers do not inadvertently make any changes that break support for that version of python. If, at any time, the minimum supported version of a dependency does not work with the version of python in our development environment, then you should also add the minimum working version of that dependency to our locked versions in the `[tool.poetry.dependencies]` section. See `this discussion thread <https://github.com/orgs/python-poetry/discussions/10142#discussioncomment-12050625>`_ for an example.
* Only PyPI packages can be added to our pyproject.toml file. So if a dependency is only available on conda, then you can add it to our :code:`dev-env.yml` file instead. Please note that anyone who installs TRTools from PyPI will not be guaranteed to have your dependency installed, so you should design your code accordingly.
* Any changes to our dependencies must also added to our bioconda recipe at the time of publication. See `PUBLISHING.rst <https://github.com/gymrek-lab/TRTools/blob/master/PUBLISHING.rst>`_ for more details.

Expand Down
20 changes: 3 additions & 17 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


package = "trtools"
python_versions = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python_versions = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
nox.needs_version = ">= 2022.11.21"
nox.options.sessions = (
"tests",
Expand All @@ -21,20 +21,6 @@
]


def install_handle_python(session):
"""
handle incompatibilities between python and other packages
see https://github.com/cjolowicz/nox-poetry/issues/1116
"""
# install the latest versions of all dependencies for py3.9+
# but install the locked versions for < py3.9 to ensure some stability in the CI and
# help us understand when we need to bump our version constraints
if session._session.python in ("3.9", "3.10", "3.11", "3.12"):
session._session.install(".")
else:
session.install(".")


# detect whether conda/mamba is installed
if os.getenv("CONDA_EXE"):
conda_cmd = "conda"
Expand All @@ -56,7 +42,7 @@ def tests(session: Session) -> None:
"pytest-cov",
channel="conda-forge",
)
install_handle_python(session)
session.install(".")
session.run(
"python", "-m", "pytest", *cov_cli_args, *session.posargs
)
Expand All @@ -68,7 +54,7 @@ def tests(session: Session) -> None:
def tests(session: Session) -> None:
"""Run the test suite."""
session.install("pytest", "pytest-cov")
install_handle_python_numpy(session)
session.install(".")
session.run(
"python", "-m", "pytest", *cov_cli_args, *session.posargs
)
Expand Down
Loading
Loading