Skip to content

Commit

Permalink
Merge pull request #353 from sebp/drop-pkg_resources
Browse files Browse the repository at this point in the history
Drop use of pkg_resources and specify dependencies in pyproject.toml
  • Loading branch information
sebp committed Apr 14, 2023
2 parents 81a9fd5 + 0532799 commit b395a85
Show file tree
Hide file tree
Showing 31 changed files with 214 additions and 233 deletions.
32 changes: 10 additions & 22 deletions .github/workflows/tests-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ jobs:
id: dependencies
run: |
source ci/deps/${{ matrix.config }}.sh
echo "CONDA_PYTHON_VERSION=${CONDA_PYTHON_VERSION}" >> $GITHUB_ENV
echo "PANDAS_VERSION=${PANDAS_VERSION}" >> $GITHUB_ENV
echo "NUMPY_VERSION=${NUMPY_VERSION}" >> $GITHUB_ENV
echo "SKLEARN_VERSION=${SKLEARN_VERSION}" >> $GITHUB_ENV
echo "NO_SLOW=${NO_SLOW}" >> $GITHUB_ENV
echo "CI_PYTHON_VERSION=${CI_PYTHON_VERSION}" >> $GITHUB_ENV
echo "CI_PANDAS_VERSION=${CI_PANDAS_VERSION}" >> $GITHUB_ENV
echo "CI_NUMPY_VERSION=${CI_NUMPY_VERSION}" >> $GITHUB_ENV
echo "CI_SKLEARN_VERSION=${CI_SKLEARN_VERSION}" >> $GITHUB_ENV
echo "CI_NO_SLOW=${CI_NO_SLOW}" >> $GITHUB_ENV
echo "py_version=$(cut -d'.' -f 1-2 <<< ${CONDA_PYTHON_VERSION})" >> $GITHUB_OUTPUT
echo "requirements=ci/deps/${{ matrix.config }}.sh" >> $GITHUB_OUTPUT
echo "conda_pkgs=$(${CONDA}/bin/python -c "from conda.base.context import context; print(context.pkgs_dirs[0])")" >> $GITHUB_OUTPUT
Expand All @@ -51,11 +51,6 @@ jobs:
run: |
sudo chown -R $USER $CONDA
ci/setup_env.sh ${{ runner.os }}
- name: Install Dependencies
run: |
python3 ci/list-requirements.py requirements/dev.txt > /tmp/conda-req.txt
conda install --solver=libmamba -c sebp -n sksurv-test --file /tmp/conda-req.txt
conda list -n sksurv-test
- name: Configure Xcode
run: |
sudo xcode-select -s "/Applications/Xcode_13.2.1.app"
Expand Down Expand Up @@ -109,11 +104,11 @@ jobs:
DEPS_CONFIG: py310_pandas14_numpy121_sklearn12
run: |
source ci/deps/${DEPS_CONFIG}.sh
echo "CONDA_PYTHON_VERSION=${CONDA_PYTHON_VERSION}" >> $GITHUB_ENV
echo "PANDAS_VERSION=${PANDAS_VERSION}" >> $GITHUB_ENV
echo "NUMPY_VERSION=${NUMPY_VERSION}" >> $GITHUB_ENV
echo "SKLEARN_VERSION=${SKLEARN_VERSION}" >> $GITHUB_ENV
echo "NO_SLOW=${NO_SLOW}" >> $GITHUB_ENV
echo "CI_PYTHON_VERSION=${CI_PYTHON_VERSION}" >> $GITHUB_ENV
echo "CI_PANDAS_VERSION=${CI_PANDAS_VERSION}" >> $GITHUB_ENV
echo "CI_NUMPY_VERSION=${CI_NUMPY_VERSION}" >> $GITHUB_ENV
echo "CI_SKLEARN_VERSION=${CI_SKLEARN_VERSION}" >> $GITHUB_ENV
echo "CI_NO_SLOW=${CI_NO_SLOW}" >> $GITHUB_ENV
echo "requirements=ci/deps/${DEPS_CONFIG}.sh" >> $GITHUB_OUTPUT
echo "conda_pkgs=$(${CONDA}/bin/python -c "from conda.base.context import context; print(context.pkgs_dirs[0])")" >> $GITHUB_OUTPUT
- name: Cache downloaded packages
Expand All @@ -125,13 +120,6 @@ jobs:
run: |
sudo chown -R $USER $CONDA
ci/setup_env.sh ${{ runner.os }}
- name: Install Dependencies
run: |
python3 ci/list-requirements.py requirements/dev.txt > /tmp/conda-req.txt
conda install --solver=libmamba -c sebp -n sksurv-test --file /tmp/conda-req.txt
conda install --solver=libmamba -n sksurv-test ipykernel 'matplotlib==3.5.1' nbformat 'seaborn==0.11.2' 'ipython!=8.7.0'
conda run -n sksurv-test pip install 'nbval>=0.10.0'
conda list -n sksurv-test
- name: Configure matplotlib
run: |
mkdir -p ${XDG_CONFIG_HOME}/matplotlib
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tox-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
sudo apt-get install cmake libenchant-2-dev pandoc tox
- name: Run Tox
run: |
tox run -e py310-${{ matrix.tox_env }}
tox run -e ${{ matrix.tox_env }}
- name: Archive documentation
uses: actions/upload-artifact@v3
with:
name: documentation
path: doc/_build/html
if: ${{ matrix.tox_env == 'docs' }}
- name: Print debug information
run: cat .tox/py310-${{ matrix.tox_env }}/log/*.log
run: cat .tox/${{ matrix.tox_env }}/log/*.log
if: ${{ failure() }}
strategy:
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ version: 2

python:
install:
- requirements: doc/docs_requirements.txt
- requirements: requirements/prod.txt
- method: pip
path: .
extra_requirements:
- docs

build:
os: ubuntu-22.04
Expand Down
7 changes: 5 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ install:
- ps: conda init powershell
- ps: conda config --set always_yes yes --set changeps1 no
- ps: conda config --set auto_update_conda false
- ps: conda config --set notify_outdated_conda false
# - ps: conda update --yes --quiet conda
- ps: conda info -a

# Install the build and runtime dependencies of the project.
- cmd: conda env create -n sksurv-test --file ci\appveyor\requirements_%CONDA_PY%.yaml
- ps: $envScript=".\ci\appveyor\py$($env:CONDA_PY).ps1"
- ps: "& $envScript"
- ps: python "ci\render-requirements.py" "ci\deps\requirements.yaml.tmpl" > environment.yaml
- ps: conda env create -n sksurv-test --file environment.yaml
- cmd: call %CONDA_INSTALL_LOCN%\Scripts\activate.bat sksurv-test
- cmd: python -m pip install build
- cmd: conda list
# Initialize the submodules
- cmd: git submodule update --init --recursive
Expand Down
4 changes: 4 additions & 0 deletions ci/appveyor/py310.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$env:CI_PYTHON_VERSION="3.10.*"
$env:CI_PANDAS_VERSION="1.4.*"
$env:CI_NUMPY_VERSION="1.21.*"
$env:CI_SKLEARN_VERSION="1.2.*"
4 changes: 4 additions & 0 deletions ci/appveyor/py311.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$env:CI_PYTHON_VERSION="3.11.*"
$env:CI_PANDAS_VERSION="1.5.*"
$env:CI_NUMPY_VERSION="1.23.*"
$env:CI_SKLEARN_VERSION="1.2.*"
4 changes: 4 additions & 0 deletions ci/appveyor/py38.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$env:CI_PYTHON_VERSION="3.8.*"
$env:CI_PANDAS_VERSION="1.1.*"
$env:CI_NUMPY_VERSION="1.19.*"
$env:CI_SKLEARN_VERSION="1.2.*"
4 changes: 4 additions & 0 deletions ci/appveyor/py39.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$env:CI_PYTHON_VERSION="3.9.*"
$env:CI_PANDAS_VERSION="1.3.*"
$env:CI_NUMPY_VERSION="1.21.*"
$env:CI_SKLEARN_VERSION="1.2.*"
16 changes: 0 additions & 16 deletions ci/appveyor/requirements_310.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions ci/appveyor/requirements_311.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions ci/appveyor/requirements_38.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions ci/appveyor/requirements_39.yaml

This file was deleted.

10 changes: 5 additions & 5 deletions ci/deps/py310_pandas14_numpy121_sklearn12.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# shellcheck shell=sh
export CONDA_PYTHON_VERSION='3.10.*'
export PANDAS_VERSION='1.4.*'
export NUMPY_VERSION='1.21.*'
export SKLEARN_VERSION='1.2.*'
export NO_SLOW=true
export CI_PYTHON_VERSION='3.10.*'
export CI_PANDAS_VERSION='1.4.*'
export CI_NUMPY_VERSION='1.21.*'
export CI_SKLEARN_VERSION='1.2.*'
export CI_NO_SLOW=true
10 changes: 5 additions & 5 deletions ci/deps/py311_pandas15_numpy123_sklearn12.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# shellcheck shell=sh
export CONDA_PYTHON_VERSION='3.11.*'
export PANDAS_VERSION='1.5.* '
export NUMPY_VERSION='1.23.*'
export SKLEARN_VERSION='1.2.*'
export NO_SLOW=false
export CI_PYTHON_VERSION='3.11.*'
export CI_PANDAS_VERSION='1.5.*'
export CI_NUMPY_VERSION='1.23.*'
export CI_SKLEARN_VERSION='1.2.*'
export CI_NO_SLOW=false
10 changes: 5 additions & 5 deletions ci/deps/py38_pandas10_numpy119_sklearn12.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# shellcheck shell=sh
export CONDA_PYTHON_VERSION='3.8.*'
export PANDAS_VERSION='1.0.*'
export NUMPY_VERSION='1.19.*'
export SKLEARN_VERSION='1.2.*'
export NO_SLOW=false
export CI_PYTHON_VERSION='3.8.*'
export CI_PANDAS_VERSION='1.0.*'
export CI_NUMPY_VERSION='1.19.*'
export CI_SKLEARN_VERSION='1.2.*'
export CI_NO_SLOW=false
10 changes: 5 additions & 5 deletions ci/deps/py39_pandas13_numpy121_sklearn12.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# shellcheck shell=sh
export CONDA_PYTHON_VERSION='3.9.*'
export PANDAS_VERSION='1.3.*'
export NUMPY_VERSION='1.21.*'
export SKLEARN_VERSION='1.2.*'
export NO_SLOW=true
export CI_PYTHON_VERSION='3.9.*'
export CI_PANDAS_VERSION='1.3.*'
export CI_NUMPY_VERSION='1.21.*'
export CI_SKLEARN_VERSION='1.2.*'
export CI_NO_SLOW=true
31 changes: 31 additions & 0 deletions ci/deps/requirements.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: sksurv-test
channels:
- sebp
- defaults
dependencies:
- coverage
- cython>=0.29
- ecos
- ipykernel
- ipython!=8.7.0
- joblib
- matplotlib>=3.6.2,<3.7
- nbformat
- numexpr
- numpy={CI_NUMPY_VERSION}
- osqp!=0.6.0,!=0.6.1
- packaging
- pandas={CI_PANDAS_VERSION}
- pip
- pytest
- python={CI_PYTHON_VERSION}
- scikit-learn={CI_SKLEARN_VERSION}
- scipy>=1.3.2
- seaborn>=0.11.2,<0.12
- setuptools-scm
- wheel
- pip:
- build
- importlib-resources>=1.3
- nbval>=0.10.0
- tomli
53 changes: 0 additions & 53 deletions ci/list-requirements.py

This file was deleted.

38 changes: 38 additions & 0 deletions ci/render-requirements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import argparse
import os

parser = argparse.ArgumentParser()
parser.add_argument("yaml_file")


def get_pinned_packages():
pkgs = {
"NUMPY",
"PANDAS",
"SKLEARN",
"PYTHON",
}
pinned = {}
for env_name in pkgs:
key = f"CI_{env_name}_VERSION"
ver = os.environ.get(key, "*")
pinned[key] = ver
return pinned


def render_requirements(filename):
pinned = get_pinned_packages()
with open(filename) as fin:
contents = "".join(fin.readlines())

return contents.format(**pinned)


def main():
args = parser.parse_args()
req = render_requirements(args.yaml_file)
print(req)


if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export PYTHONWARNINGS="default"

pytest_opts=("")

if [ "x${NO_SLOW:-false}" != "xtrue" ]; then
if [ "x${CI_NO_SLOW:-false}" != "xtrue" ]; then
coverage erase
rm -f coverage.xml
else
Expand Down
Loading

0 comments on commit b395a85

Please sign in to comment.