Skip to content

Commit

Permalink
Merge pull request #58 from MannLabs/remove_setup_py
Browse files Browse the repository at this point in the history
substitute setup.py with pyproject.toml
  • Loading branch information
mschwoer authored Jan 16, 2025
2 parents b4e4c5b + ef8b37a commit 1b62dff
Show file tree
Hide file tree
Showing 22 changed files with 289 additions and 205 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/nbdev_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ jobs:
python-version: ${{ matrix.python-version }}
miniconda-version: latest
- name: Conda info
shell: bash -l {0}
shell: bash -le {0}
run: conda info
- name: Test pip installation with all loose dependencies
shell: bash -l {0}
shell: bash -le {0}
run: |
cd misc
. ./loose_pip_install.sh
- name: Unittests
shell: bash -l {0}
shell: bash -le {0}
run: |
conda activate directlfq
nbdev_test
Expand Down
22 changes: 16 additions & 6 deletions .github/workflows/quick_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,20 @@ jobs:
python-version: ${{ matrix.python-version }}
miniconda-version: latest
- name: Conda info
shell: bash -l {0}
shell: bash -le {0}
run: conda info
- name: Pytest tests
shell: bash -le {0}
run: |
pip install pytest
pytest tests/pytest
- name: Test pip installation with all stable dependencies
shell: bash -l {0}
shell: bash -le {0}
run: |
cd misc
. ./stable_pip_install.sh
- name: Run pipeline
shell: bash -l {0}
shell: bash -le {0}
run: |
cd tests
. ./run_quicktests.sh
Expand All @@ -47,15 +52,20 @@ jobs:
python-version: ${{ matrix.python-version }}
miniconda-version: latest
- name: Conda info
shell: bash -l {0}
shell: bash -le {0}
run: conda info
- name: Pytest tests
shell: bash -le {0}
run: |
pip install pytest
pytest tests/pytest
- name: Test pip installation with all loose dependencies
shell: bash -l {0}
shell: bash -le {0}
run: |
cd misc
. ./loose_pip_install.sh
- name: Run pipeline
shell: bash -l {0}
shell: bash -le {0}
run: |
cd tests
. ./run_quicktests.sh
6 changes: 3 additions & 3 deletions .github/workflows/quick_tests_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ jobs:
python-version: ${{ matrix.python-version }}
miniconda-version: latest
- name: Conda info
shell: bash -l {0}
shell: bash -le {0}
run: conda info
- name: Test pip installation with stable dependencies
shell: bash -l {0}
shell: bash -le {0}
run: |
cd misc
. ./stable_pip_install.sh
- name: Unittests
shell: bash -l {0}
shell: bash -le {0}
run: |
cd tests
. ./run_quicktests.sh
6 changes: 3 additions & 3 deletions .github/workflows/ratio_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
python-version: ${{ matrix.python-version }}
miniconda-version: latest
- name: Conda info
shell: bash -l {0}
shell: bash -le {0}
run: conda info
- name: Test pip installation with stable dependencies
shell: bash -l {0}
shell: bash -le {0}
run: |
cd misc
. ./stable_pip_install.sh
- name: Ratio tests
shell: bash -l {0}
shell: bash -le {0}
run: |
cd tests
. ./run_ratio_tests.sh
6 changes: 3 additions & 3 deletions .github/workflows/unused/all_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ jobs:
python-version: ${{ matrix.python-version }}
miniconda-version: latest
- name: Conda info
shell: bash -l {0}
shell: bash -le {0}
run: conda info
- name: Test pip installation with all loose dependencies
shell: bash -l {0}
shell: bash -le {0}
run: |
cd misc
. ./loose_pip_install.sh
- name: Unittests
shell: bash -l {0}
shell: bash -le {0}
run: |
cd tests
. ./run_tests.sh
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ pip install "directlfq[stable]"

NOTE: You might need to run `pip install pip==21.0` before installing directlfq like this. Also note the double quotes `"`.

For those who are really adventurous, it is also possible to directly install any branch (e.g. `@development`) with any extras (e.g. `#egg=directlfq[stable,development-stable]`) from GitHub with e.g.
For those who are really adventurous, it is also possible to directly install any branch (e.g. `@development`) with any extras (e.g. `#egg=directlfq[stable,development]`) from GitHub with e.g.

```bash
pip install "git+https://github.com/MannLabs/directlfq.git@development#egg=directlfq[stable,development-stable]"
pip install "git+https://github.com/MannLabs/directlfq.git@development#egg=directlfq[stable,development]"
```

### Developer
Expand Down Expand Up @@ -122,7 +122,7 @@ Finally, directlfq and all its [dependencies](requirements) need to be installed
pip install -e "./directlfq[development,gui]"
```

By default this installs loose dependencies (no explicit versioning), although it is also possible to use stable dependencies (e.g. `pip install -e "./directlfq[stable,development-stable]"`).
By default this installs loose dependencies (no explicit versioning), although it is also possible to use stable dependencies (e.g. `pip install -e "./directlfq[stable,development]"`).

***By using the editable flag `-e`, all modifications to the [directlfq source code folder](directlfq) are directly reflected when running directlfq. Note that the directlfq folder cannot be moved and/or renamed if an editable version is installed. In case of confusion, you can always retrieve the location of any Python module with e.g. the command `import module` followed by `module.__file__`.***

Expand Down
46 changes: 1 addition & 45 deletions directlfq/__init__.py
Original file line number Diff line number Diff line change
@@ -1,45 +1 @@
#!python


__project__ = "directlfq"
__version__ = "0.3.1-dev0"
__license__ = "Apache"
__description__ = "An open-source Python package of the AlphaPept ecosystem"
__author__ = "Mann Labs"
__author_email__ = "opensource@alphapept.com"
__github__ = "https://github.com/MannLabs/directlfq"
__keywords__ = [
"bioinformatics",
"software",
"AlphaPept ecosystem",
]
__python_version__ = ">=3.9"
__classifiers__ = [
# "Development Status :: 1 - Planning",
# "Development Status :: 2 - Pre-Alpha",
# "Development Status :: 3 - Alpha",
# "Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
# "Development Status :: 6 - Mature",
# "Development Status :: 7 - Inactive"
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Bio-Informatics",
]
__console_scripts__ = [
"directlfq=directlfq.cli:run",
]
__urls__ = {
"Mann Labs at MPIB": "https://www.biochem.mpg.de/mann",
"Mann Labs at CPR": "https://www.cpr.ku.dk/research/proteomics/mann/",
"GitHub": __github__,
# "ReadTheDocs": None,
# "PyPi": None,
# "Scientific paper": None,
}
__extra_requirements__ = {
"development": "requirements_development.txt",
"gui": "requirements_gui.txt"
}
__version__ = "0.3.1-dev0"
2 changes: 1 addition & 1 deletion misc/loose_pip_install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
conda create -n directlfq python=3.9 -y
conda activate directlfq
pip install -e '../.[development-stable, gui]'
pip install -e '../.[development, gui]'
directlfq
conda deactivate
2 changes: 1 addition & 1 deletion misc/stable_pip_install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
conda create -n directlfq python=3.9 -y
conda activate directlfq
pip install -e '../.[stable,development-stable, gui-stable]'
pip install -e '../.[stable, gui-stable, development]'
directlfq
conda deactivate
60 changes: 60 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "directlfq"
requires-python = ">=3.9"
dynamic = ["version", "dependencies", "optional-dependencies"]

authors = [
{name = "Mann Labs", email = "opensource@alphapept.com"}
]
description = "An open-source Python package of the AlphaPept ecosystem"
readme = "README.md"
keywords = [
"LFQ",
"label-free quantification",
"mass spectrometry",
"proteomics",
"bioinformatics",
"AlphaPept",
"AlphaPept ecosystem",
]
license = {file = "LICENSE.txt"}
classifiers = [
"Development Status :: 5 - Production/Stable",
# "Development Status :: 6 - Mature",
# "Development Status :: 7 - Inactive"
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Bio-Informatics",
]

[project.urls]

"Paper preprint" = "https://www.biochem.mpg.de/mann"
Repository = "https://github.com/MannLabs/directlfq"
#Documentation = "https://readthedocs.org"
#Changelog = "https://github.com/me/spam/blob/master/CHANGELOG.md"
Issues = "https://github.com/MannLabs/directlfq/issues"
"Mann Labs Homepage" = "https://www.biochem.mpg.de/mann"

[tool.setuptools.packages]
find = {}

[tool.setuptools.dynamic]
# https://stackoverflow.com/a/73600610
dependencies = {file = ["requirements/requirements_loose.txt"]}
optional-dependencies = { stable = { file = ["requirements/requirements.txt",
] }, gui = { file = [ "requirements/requirements_gui_loose.txt",
] }, gui-stable = { file = [ "requirements/requirements_gui.txt",
] }, development = { file = ["requirements/requirements_development.txt"
] }}

version = {attr = "directlfq.__version__"}

[project.scripts]
directlfq = "directlfq.cli:run"
7 changes: 5 additions & 2 deletions release/linux/build_installer_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ rm -rf dist build *.egg-info
rm -rf dist_pyinstaller build_pyinstaller

# Creating the wheel
python setup.py sdist bdist_wheel
pip install "dist/directlfq-0.3.1-dev0-py3-none-any.whl[stable,gui]"
python -m build

# substitute X.Y.Z-devN with X.Y.Z.devN
WHL_NAME=$(echo "directlfq-0.3.1-dev0-py3-none-any.whl" | sed 's/\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)-dev\([0-9][0-9]*\)/\1.dev\2/g')
pip install "dist/${WHL_NAME}[stable,gui-stable]"

# Creating the stand-alone pyinstaller folder
pip install pyinstaller
Expand Down
7 changes: 5 additions & 2 deletions release/macos/build_installer_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ rm -rf dist build *.egg-info
rm -rf dist_pyinstaller build_pyinstaller

# Creating the wheel
python setup.py sdist bdist_wheel
pip install "dist/directlfq-0.3.1-dev0-py3-none-any.whl[stable,gui]"
python -m build

# substitute X.Y.Z-devN with X.Y.Z.devN
WHL_NAME=$(echo "directlfq-0.3.1-dev0-py3-none-any.whl" | sed 's/\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)-dev\([0-9][0-9]*\)/\1.dev\2/g')
pip install "dist/${WHL_NAME}[stable,gui-stable]"

# Creating the stand-alone pyinstaller folder
pip install pyinstaller
Expand Down
Loading

0 comments on commit 1b62dff

Please sign in to comment.