Skip to content

Commit

Permalink
RTD attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes committed Jul 3, 2023
1 parent 288381f commit 43776b6
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 55 deletions.
33 changes: 33 additions & 0 deletions docs/.readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
apt_packages:
- gcc
- g++
tools:
python: "3.11"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
system_packages: true
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pandas>=0.24.0
numpy
cython
scipy
scipy>=1.11.1
Sphinx>=4.2.0
docutils==0.16
sphinx-rtd-theme>=1.0.0
95 changes: 41 additions & 54 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,58 +212,45 @@ def test_supports_compile_arg(self, comm, with_omp=False):
return is_supported


from_rtd = os.environ.get('READTHEDOCS') == 'True'
if not from_rtd:
setup(
name = "poismf",
packages = ["poismf"],
author = 'David Cortes',
url = 'https://github.com/david-cortes/poismf',
version = '0.4.0-7',
install_requires = ['numpy', 'pandas>=0.24', 'cython', 'scipy'],
description = 'Fast and memory-efficient Poisson factorization for sparse count matrices',
cmdclass = {'build_ext': build_ext_subclass},
ext_modules = [
Extension("poismf.c_funs_double",
sources=["poismf/cfuns_double.pyx",
"src/poismf.c", "src/topN.c", "src/pred.c",
"src/nonnegcg.c", "src/tnc.c"],
include_dirs=[numpy.get_include(), "src/"],
define_macros = [
("_FOR_PYTHON", None),
("NDEBUG", None),
]),
Extension("poismf.c_funs_float",
sources=["poismf/cfuns_float.pyx",
"src/poismf.c", "src/topN.c", "src/pred.c",
"src/nonnegcg.c", "src/tnc.c"],
include_dirs=[numpy.get_include(), "src/"],
define_macros = [
("_FOR_PYTHON", None),
("NDEBUG", None),
("USE_FLOAT", None)
])
]
)
setup(
name = "poismf",
packages = ["poismf"],
author = 'David Cortes',
url = 'https://github.com/david-cortes/poismf',
version = '0.4.0-7',
install_requires = ['numpy', 'pandas>=0.24', 'cython', 'scipy'],
description = 'Fast and memory-efficient Poisson factorization for sparse count matrices',
cmdclass = {'build_ext': build_ext_subclass},
ext_modules = [
Extension("poismf.c_funs_double",
sources=["poismf/cfuns_double.pyx",
"src/poismf.c", "src/topN.c", "src/pred.c",
"src/nonnegcg.c", "src/tnc.c"],
include_dirs=[numpy.get_include(), "src/"],
define_macros = [
("_FOR_PYTHON", None),
("NDEBUG", None),
]),
Extension("poismf.c_funs_float",
sources=["poismf/cfuns_float.pyx",
"src/poismf.c", "src/topN.c", "src/pred.c",
"src/nonnegcg.c", "src/tnc.c"],
include_dirs=[numpy.get_include(), "src/"],
define_macros = [
("_FOR_PYTHON", None),
("NDEBUG", None),
("USE_FLOAT", None)
])
]
)

if not found_omp:
omp_msg = "\n\n\nCould not detect OpenMP. Package will be built without multi-threading capabilities. "
omp_msg += " To enable multi-threading, first install OpenMP"
if (sys.platform[:3] == "dar"):
omp_msg += " - for macOS: 'brew install libomp'\n"
else:
omp_msg += " modules for your compiler. "

omp_msg += "Then reinstall this package from scratch: 'pip install --upgrade --no-deps --force-reinstall poismf'.\n"
warnings.warn(omp_msg)
else:
setup(
name = "poismf",
packages = ["poismf"],
author = 'David Cortes',
author_email = 'david.cortes.rivera@gmail.com',
url = 'https://github.com/david-cortes/poismf',
version = '0.4.0-6',
install_requires = ['numpy', 'scipy', 'pandas>=0.24', 'cython'],
description = 'Fast and memory-efficient Poisson factorization for sparse count matrices',
)
if not found_omp:
omp_msg = "\n\n\nCould not detect OpenMP. Package will be built without multi-threading capabilities. "
omp_msg += " To enable multi-threading, first install OpenMP"
if (sys.platform[:3] == "dar"):
omp_msg += " - for macOS: 'brew install libomp'\n"
else:
omp_msg += " modules for your compiler. "

omp_msg += "Then reinstall this package from scratch: 'pip install --upgrade --no-deps --force-reinstall poismf'.\n"
warnings.warn(omp_msg)

0 comments on commit 43776b6

Please sign in to comment.