Skip to content

Commit

Permalink
Merge pull request #695 from AlexVCaron/feat/frozen_requirements
Browse files Browse the repository at this point in the history
[ENH] Upload frozen python requirements aside of release assets
  • Loading branch information
arnaudbore authored Mar 20, 2023
2 parents 5845eb2 + e1a9a78 commit fda392c
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .github/workflows/freeze_requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name : Freeze release requirements

on:
push:
tags:
- '*'

jobs:
freeze_requirements:
runs-on: ubuntu-latest
steps:
-
name: Checkout scilpy
uses: actions/checkout@v3
-
name: Install python
uses: actions/setup-python@v4
with:
python-version-file: '.python-version'
cache: 'pip'
-
name: Freeze requirements
id: requirements-freezer
run: |
pip install pip-tools
pip-compile --no-upgrade --allow-unsafe -o requirements.${{ github.ref_name }}.frozen
echo "requirements=$PWD/requirements.${{ github.ref_name }}.frozen" >> $GITHUB_OUTPUT
-
name: Upload frozen requirements to release
uses: softprops/action-gh-release@v1
with:
files : ${{ steps.requirements-freezer.outputs.requirements }}
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pytest-mock==3.10.*
python-dateutil==2.8.*
pytz==2022.6.*
requests==2.28.*
setuptools==64.0.*
scikit-learn==1.2.*
scipy==1.9.*
six==1.16.*
Expand Down
18 changes: 18 additions & 0 deletions scilpy/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@
"Programming Language :: Python",
"Topic :: Scientific/Engineering"]

PYTHON_VERSION = ""
with open('.python-version') as f:
py_version = f.readline().strip("\n").split(".")
py_major = py_version[0]
py_minor = py_version[1]
py_micro = "*"
py_extra = None
if len(py_version) > 2:
py_micro = py_version[2]
if len(py_version) > 3:
py_extra = py_version[3]

PYTHON_VERSION = ".".join([py_major, py_minor, py_micro])
if py_extra:
PYTHON_VERSION = ".".join([PYTHON_VERSION, py_extra])

PYTHON_VERSION = "".join(["==", PYTHON_VERSION])

# Description should be a one-liner:
description = "Scilpy: diffusion MRI tools and utilities"
# Long description will go up on the pypi page
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def run(self):
packages=find_packages(),
cmdclass={'build_ext': CustomBuildExtCommand},
ext_modules=get_extensions(),
python_requires=PYTHON_VERSION,
setup_requires=['cython', 'numpy'],
install_requires=external_dependencies,
entry_points={
Expand Down

0 comments on commit fda392c

Please sign in to comment.