Skip to content

Commit 7fdb131

Browse files
authored
Merge pull request #47 from fabian-sp/f-modernize-build
Modernize package structure and build
2 parents 589073b + e195469 commit 7fdb131

34 files changed

+914
-504
lines changed

.github/workflows/unit_test.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ jobs:
1919
with:
2020
activate-environment: gglasso_env
2121
environment-file: environment.yml
22-
python-version: 3.8
22+
python-version: 3.9
2323

2424
# Install package and run tests
2525
- name: run tests
2626
# This one is very important so we can reuse conda env from last step
2727
shell: bash -l {0}
2828
run: |
29-
pip install -e .
30-
conda list
31-
pytest gglasso/tests -v
29+
python -m pip install --editable .
30+
pytest tests/ -v

.readthedocs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ formats:
2222
python:
2323
install:
2424
- requirements: readthedocs-requirements.txt
25-
- method: setuptools
25+
- method: pip
2626
path: .
2727

README.md

+7-12
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,23 @@ or
2525
conda install -c conda-forge gglasso
2626

2727

28-
### Install from source
28+
### Developer installation
2929

30-
Alternatively, you can install the package from source using the following commands:
30+
If you want to create a conda environment with full development dependencies (for building docs, testing,...), run:
3131

32-
git clone https://github.com/fabian-sp/GGLasso.git
33-
pip install -r requirements.txt
34-
python setup.py
32+
conda env create -f environment.yml
3533

36-
Test your installation with
34+
To install `gglasso` in developer mode run
3735

38-
pytest gglasso/ -v
36+
python -m pip install --editable .
3937

4038

41-
### Advanced options
39+
Test your installation with
4240

43-
If you want to create a conda environment with full development dependencies (for building docs, testing etc), run:
41+
pytest tests/ -v
4442

45-
conda env create -f environment.yml
4643

47-
If you wish to install `gglasso` in developer mode, i.e. not having to reinstall `gglasso` everytime the source code changes (either by remote or local changes), run
4844

49-
python setup.py clean --all develop clean --all
5045

5146
## The `glasso_problem` class
5247

docs/source/getting-started.rst

+8-7
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,30 @@ Getting started
66
Installation
77
^^^^^^^^^^^^^^^^
88

9-
``GGLasso`` is available over Pypi or `Github`_. For installation with pip, simply run
9+
The official repository can be found on `Github`_. ``GGLasso`` is available over ``pip`` and ``conda``. For installation from PyPi, simply run
1010

1111
.. code-block::
1212
1313
pip install gglasso
1414
15-
To install from source, clone the repository and make sure you have all requirements installed. Then move to the directory and run
15+
For ``conda``, use
1616

1717
.. code-block::
1818
19-
python setup.py
19+
conda install -c conda-forge gglasso
2020
21-
This installs a package called ``gglasso`` in your Python environment. In case you want to edit the source code and use the ``gglasso`` package without re-installing, you can run instead
21+
Alternatively, you can clone from Github and install a developer version with the command
2222

2323
.. code-block::
2424
25-
python setup.py clean --all develop clean --all
25+
python -m pip install --editable .
2626
27-
To make sure that everything works properly you can run unit tests in ``gglasso/tests``, for example
27+
28+
To make sure that everything works properly you can run unit tests with
2829

2930
.. code-block::
3031
31-
pytest gglasso/ -v
32+
pytest tests/ -v
3233
3334
To import from ``GGLasso`` in Python, type for example
3435

environment.yml

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
name: gglasso_env
22

33
dependencies:
4-
- python>=3.8
5-
- numpy>=1.19.2
6-
- numba>=0.53.1
4+
- python>=3.9
5+
- numpy>=1.19.2, <2.0.0
6+
- numba>=0.53.1, <0.60.0
77
- scipy>=0.11.0
88
- scikit-learn>=0.24.1
99
- pandas
1010
- matplotlib
1111
- seaborn
1212
- networkx
13-
- decorator==4.4.2
14-
- sphinx==3.5.4
13+
- sphinx
1514
- pytest
1615
- pip
1716
- pip:
1817
- regain
1918
- scikit-fda
20-
- sphinx-gallery==0.8.2
21-
- sphinx_rtd_theme==0.5.2
22-
- fdasrsf==2.3.11
23-
19+
- sphinx-gallery
20+
- sphinx_rtd_theme

gglasso/__init__.py

-2
This file was deleted.

pyproject.toml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
###############################################################################
6+
# Main library #
7+
###############################################################################
8+
9+
[project]
10+
name = "gglasso"
11+
dynamic = ["version"]
12+
description = 'Algorithms for Single and Multiple Graphical Lasso problems.'
13+
readme = "README.md"
14+
requires-python = ">=3.9"
15+
license = "MIT"
16+
keywords = ["network inference",
17+
"graphcial models",
18+
"graphical lasso",
19+
"optimization"]
20+
authors = [
21+
{name = "Fabian Schaipp", email = "[email protected]" },
22+
{name = "Oleg Vlasovets", email = ""},
23+
{name = "Christian L. Müller", email = ""},
24+
]
25+
classifiers = [
26+
"Development Status :: 5 - Production/Stable",
27+
"License :: OSI Approved :: MIT License",
28+
"Programming Language :: Python",
29+
"Programming Language :: Python :: 3.9",
30+
"Programming Language :: Python :: 3.10",
31+
"Programming Language :: Python :: 3.11",
32+
"Programming Language :: Python :: 3.12",
33+
"Programming Language :: Python :: Implementation :: CPython",
34+
"Programming Language :: Python :: Implementation :: PyPy",
35+
]
36+
dependencies = [
37+
"numpy>=1.17.3, <2.0.0",
38+
"scipy>=0.11.0",
39+
"scikit-learn>=0.24.1",
40+
"numba>=0.46.0, <0.60.0",
41+
"pandas",
42+
"matplotlib",
43+
"seaborn",
44+
"networkx",
45+
]
46+
47+
[project.urls]
48+
Documentation = "https://gglasso.readthedocs.io/en/stable/"
49+
Issues = "https://github.com/fabian-sp/GGLasso/issues"
50+
Source = "https://github.com/fabian-sp/GGLasso"
51+
52+
[tool.hatch.version]
53+
path = "src/gglasso/__init__.py"
54+
55+
[[tool.hatch.envs.all.matrix]]
56+
python = ["3.9", "3.10", "3.11", "3.12"]
57+
58+
# The minimum Python version that should be supported
59+
target-version = "py39"
60+
61+
[tool.hatch.build.targets.sdist]
62+
include = ["src/gglasso"]
63+
64+
[tool.hatch.build.targets.wheel]
65+
packages = ["src/gglasso"]
66+
67+
###############################################################################
68+
# Development dependencies #
69+
###############################################################################
70+
71+
# See: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#writing-pyproject-toml
72+
[project.optional-dependencies]
73+
tests = ["pytest", "pytest-cov"]
74+
docs = [
75+
"sphinx",
76+
"sphinx-gallery",
77+
"sphinx_rtd_theme",
78+
]
79+
examples = [
80+
"regain",
81+
"scikit-fda",
82+
]

readthedocs-requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ sphinx
44
sphinx-gallery
55
sphinx_rtd_theme
66

7-
scikit-fda
7+
scikit-fda
8+
regain

requirements.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
numpy>=1.17.3
2-
numba>=0.46.0
1+
numpy>=1.17.3,<2.0.0
2+
numba>=0.46.0,<0.60.0
33
scipy>=0.11.0
44
scikit-learn>=0.24.1
55
pandas
66
matplotlib
77
seaborn
88
networkx
9-
regain

setup.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
URL = 'https://github.com/fabian-sp/GGLasso'
1111
1212
AUTHOR = 'Fabian Schaipp'
13-
REQUIRES_PYTHON = '>=3.7.0'
13+
REQUIRES_PYTHON = '>=3.9.0'
1414
VERSION = gglasso.__version__
1515

1616

1717
# What packages are required for this module to be executed?
1818
REQUIRED = [
1919
"numpy>=1.17.3", "scipy>=0.11.0", "scikit-learn>=0.24.1", "numba>=0.46.0", "pandas",
20-
"matplotlib", "seaborn", "networkx", "regain"]
20+
"matplotlib", "seaborn", "networkx"]
2121

2222
# What packages are optional?
2323
EXTRAS = {
@@ -27,6 +27,10 @@
2727
"sphinx-gallery",
2828
"sphinx_rtd_theme",
2929
],
30+
"examples": [
31+
"regain",
32+
"scikit-fda",
33+
]
3034
}
3135

3236
here = os.path.abspath(os.path.dirname(__file__))
@@ -42,13 +46,12 @@
4246

4347
CLASSIFIERS = """\
4448
Development Status :: 5 - Production/Stable
45-
Intended Audience :: Science/Research
46-
Intended Audience :: Developers
47-
License :: OSI Approved
49+
License :: OSI Approved :: MIT License
4850
Programming Language :: Python
49-
Programming Language :: Python :: 3
50-
Topic :: Software Development
51-
Operating System :: Unix
51+
Programming Language :: Python :: 3.9
52+
Programming Language :: Python :: 3.10
53+
Programming Language :: Python :: 3.11
54+
Programming Language :: Python :: 3.12
5255
"""
5356

5457

src/gglasso/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__version__ = "0.2.1"
2+
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)