diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e8c5158f..a41961d3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ test: image: $registry/$tag script: - ls - - pytest --cov=pycmdstan --cov-report=term --cov-report=html -n 2 pycmdstan/tests.py + - pytest --cov=cmdstanpy --cov-report=term --cov-report=html -n 2 cmdstanpy/tests.py artifacts: paths: - htmlcov/ diff --git a/.travis.yml b/.travis.yml index d496fcac..c44348ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,4 @@ install: - docker build -t cmdstanpy . script: - - docker run --rm cmdstanpy pytest --cov=pycmdstan --cov-report=term --cov-report=html -n 10 pycmdstan/tests.py \ No newline at end of file + - docker run --rm cmdstanpy pytest --cov=cmdstanpy --cov-report=term --cov-report=html -n 10 cmdstanpy/tests.py \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 944971ac..78f87c2b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,6 @@ FROM python:3.6-stretch ENV CSVER=2.17.1 ENV CMDSTAN=/opt/cmdstan-$CSVER ENV CXX=clang++-3.9 -ENV MPLBACKEND=agg ENV PYTHONDONTWRITEBYTECODE=1 RUN apt-get update && apt-get install -y clang-3.9 @@ -17,7 +16,6 @@ RUN curl -OL https://github.com/stan-dev/cmdstan/releases/download/v$CSVER/cmdst && cd cmdstan-$CSVER \ && make -j2 build examples/bernoulli/bernoulli -RUN mkdir -p /opt/pycmdstan -WORKDIR /opt/pycmdstan -RUN pip install scipy -ADD ./ /opt/pycmdstan/ +RUN mkdir -p /opt/cmdstanpy +WORKDIR /opt/cmdstanpy +ADD ./ /opt/cmdstanpy/ diff --git a/LICENSE b/LICENSE index 8415999d..89ce5175 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2019 +Copyright 2019 Stan Dev Team Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pycmdstan/__init__.py b/cmdstanpy/__init__.py similarity index 100% rename from pycmdstan/__init__.py rename to cmdstanpy/__init__.py diff --git a/pycmdstan/io.py b/cmdstanpy/io.py similarity index 98% rename from pycmdstan/io.py rename to cmdstanpy/io.py index 79fd4343..aa83b314 100755 --- a/pycmdstan/io.py +++ b/cmdstanpy/io.py @@ -4,8 +4,11 @@ """ import re +import logging import numpy as np +logger = logging.getLogger('cmdstanpy.io') + def _rdump_array(key, val): c = 'c(' + ', '.join(map(str, val.T.flat)) + ')' diff --git a/pycmdstan/model.py b/cmdstanpy/model.py similarity index 99% rename from pycmdstan/model.py rename to cmdstanpy/model.py index d025a189..23020f0a 100644 --- a/pycmdstan/model.py +++ b/cmdstanpy/model.py @@ -9,7 +9,7 @@ import numpy as np from . import io -logger = logging.getLogger('pycmdstan.model') +logger = logging.getLogger('cmdstanpy.model') class CmdStanNotFound(RuntimeError): @@ -87,7 +87,7 @@ def model_path() -> str: key = 'PYCMDSTAN_MODEL_PATH' if key not in os.environ: os.environ[key] = os.path.join( - os.path.expanduser('~'), '.cache', 'pycmdstan') + os.path.expanduser('~'), '.cache', 'cmdstanpy') if not os.path.exists(os.environ[key]): logger.debug(f'creating cache dir {os.environ[key]}') try: diff --git a/pycmdstan/tests.py b/cmdstanpy/tests.py similarity index 99% rename from pycmdstan/tests.py rename to cmdstanpy/tests.py index ac8d5dbe..214af17f 100644 --- a/pycmdstan/tests.py +++ b/cmdstanpy/tests.py @@ -97,7 +97,7 @@ def test_code_from_file(self): class TestMetrics(BaseTestCase): - # cache model on test machine and cover code path for ~/.cache/pycmdstan/... + # cache model on test machine and cover code path for ~/.cache/cmdstanpy/... use_tmp = False model_code = ''' diff --git a/docs/conf.py b/docs/conf.py index 0957107e..41592ee4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -138,7 +138,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(master_doc, 'pycmdstan', 'PyCmdStan Documentation', [author], 1)] +man_pages = [(master_doc, 'cmdstanpy', 'PyCmdStan Documentation', [author], 1)] # -- Options for Texinfo output ---------------------------------------------- diff --git a/pycmdstan/__main__.py b/pycmdstan/__main__.py deleted file mode 100644 index efc726f2..00000000 --- a/pycmdstan/__main__.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Run workflow for Stan model & dataset. -""" - -import argparse - - -def main(): - pass - -# TODO CLI - -# compile model -# dump npz/pkl/h5 to Rdump -# run multiple chains -# run stansummary -# figures per chain -# diagnostics rhat efmi etc -# psis diff --git a/setup.py b/setup.py index 118ff0de..d9eb8794 100644 --- a/setup.py +++ b/setup.py @@ -22,14 +22,14 @@ def readme_contents() -> str: """ setuptools.setup( - name='pycmdstan', + name='cmdstanpy', version='0.9', description='Python interface to CmdStan', long_description=readme_contents(), long_description_content_type="text/markdown", author='Stan Dev Team', url='https://github.com/stan-dev/cmdstanpy', - packages=['pycmdstan'], + packages=['cmdstanpy'], install_requires='numpy filelock'.split(), classifiers=_classifiers.strip().split('\n'), )