From fe7061fd4e8a84c7d85123bacbac5820a6e6cf31 Mon Sep 17 00:00:00 2001 From: Enzo Busseti Date: Fri, 7 Feb 2020 21:05:59 +0100 Subject: [PATCH] cleanup --- AUTHORS.txt => AUTHORS | 0 LICENSE.txt => LICENSE | 0 PIP.md | 10 ---- README.md | 2 +- conda-recipe/conda_build_config.yaml | 3 - conda-recipe/meta.yaml | 40 ------------- continuous_integration/build_and_deploy.py | 70 ---------------------- continuous_integration/install.sh | 34 ----------- continuous_integration/test_script.sh | 19 ------ pre_commit.sh | 11 ---- test_environment.yml | 28 --------- test_environment_py2.yml | 28 --------- 12 files changed, 1 insertion(+), 244 deletions(-) rename AUTHORS.txt => AUTHORS (100%) rename LICENSE.txt => LICENSE (100%) delete mode 100644 PIP.md delete mode 100644 conda-recipe/conda_build_config.yaml delete mode 100644 conda-recipe/meta.yaml delete mode 100644 continuous_integration/build_and_deploy.py delete mode 100644 continuous_integration/install.sh delete mode 100755 continuous_integration/test_script.sh delete mode 100755 pre_commit.sh delete mode 100644 test_environment.yml delete mode 100644 test_environment_py2.yml diff --git a/AUTHORS.txt b/AUTHORS similarity index 100% rename from AUTHORS.txt rename to AUTHORS diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE diff --git a/PIP.md b/PIP.md deleted file mode 100644 index 969186d0d..000000000 --- a/PIP.md +++ /dev/null @@ -1,10 +0,0 @@ -## How to upload to pip - -- change the version number in setup.py -- `python setup.py bdist_wheel` -- `python setup.py sdist`, needed for conda -- `twine upload dist/*` -- steps taken from - [https://packaging.python.org/tutorials/distributing-packages/](https://packaging.python.org/tutorials/distributing-packages/) - -All this is superflous now, use bumpversion (*e.g.*, `bumpversion patch`), and travis should update pip using `deploy_script.sh`. diff --git a/README.md b/README.md index 05414dddd..1a51b603a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ============= [![Build Status](https://travis-ci.org/cvxgrp/cvxportfolio.png?branch=master)](https://travis-ci.org/cvxgrp/cvxportfolio) [![Coverage Status](https://coveralls.io/repos/github/cvxgrp/cvxportfolio/badge.svg?branch=master)](https://coveralls.io/github/cvxgrp/cvxportfolio?branch=master) -[![Apache 2.0 License](https://img.shields.io/badge/License-APACHEv2-green.svg)](https://github.com/cvxgrp/cvxportfolio/blob/master/LICENSE.txt) +[![Apache 2.0 License](https://img.shields.io/badge/License-APACHEv2-green.svg)](https://github.com/cvxgrp/cvxportfolio/blob/master/LICENSE) **The documentation of the package is given at [cvxportfolio.org](http://www.cvxportfolio.org/).** diff --git a/conda-recipe/conda_build_config.yaml b/conda-recipe/conda_build_config.yaml deleted file mode 100644 index 19cfa9870..000000000 --- a/conda-recipe/conda_build_config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -python: -# - 2.7 - - 3.6 diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml deleted file mode 100644 index 150a045a3..000000000 --- a/conda-recipe/meta.yaml +++ /dev/null @@ -1,40 +0,0 @@ -{% set version = "0.0.5" %} - -package: - name: cvxportfolio - version: {{ version }} - -source: - path: .. - -build: - number: 0 - script: {{ PYTHON }} setup.py install --single-version-externally-managed --record record.txt - -requirements: - host: - - python {{ python }} - build: - - setuptools - run: - - python - - pandas - - numpy - - matplotlib - - cvxpy >=1.0.6 - -test: - imports: - - cvxportfolio - - cvxportfolio.tests - - cvxportfolio.utils - requires: - - nose - commands: - - nosetests cvxportfolio - -about: - home: http://github.com/cvxgrp/cvxportfolio/ - license: Apache - summary: 'Portfolio optimization and simulation in Python.' - doc_url: 'http://cvxportfolio.org' diff --git a/continuous_integration/build_and_deploy.py b/continuous_integration/build_and_deploy.py deleted file mode 100644 index 766db2a2d..000000000 --- a/continuous_integration/build_and_deploy.py +++ /dev/null @@ -1,70 +0,0 @@ -import os -import subprocess -import requests -import json -import cvxportfolio -from distutils.version import StrictVersion - -# On Travis, you should set $CONDA_UPLOAD_TOKEN, $PYPI_USER, and $PYPI_PASSWORD - -CHANNEL = "cvxgrp" -BUILDDIR = 'build' -ARCH = json.load(subprocess.Popen("conda info --json", shell=True, - stdout=subprocess.PIPE).stdout)['platform'] -LOCAL_VERSION = cvxportfolio.__version__ - - -def pypi_version(test=False): - if test: - url = "https://test.pypi.org/pypi/cvxportfolio/json" - else: - url = "https://pypi.org/pypi/cvxportfolio/json" - r = requests.get(url) - data = r.json() - versions = list(data["releases"].keys()) - versions.sort(key=StrictVersion) - return versions[-1] - - -PYPI_VERSION = pypi_version() - -print('local version:', LOCAL_VERSION) -print('pypi version:', PYPI_VERSION) - -# if (LOCAL_VERSION == PYPI_VERSION): -# print("Versions match, skipping build.") -# exit(0) - -subprocess.call(["conda", "config", "--add", "channels", "cvxgrp"]) -subprocess.call(["conda", "config", "--add", "channels", "conda-forge"]) - -if not (subprocess.call(["conda", "build", - "--variant-config-files=conda-recipe/conda_build_config.yaml", - "--output-folder=build", - "conda-recipe/meta.yaml"]) == 0): - print('build failed') - exit(1) - -LAST_BUILD_NAME_Py36 = [el for el in sorted(os.listdir( - '%s/%s' % (BUILDDIR, ARCH))) if el[:5] == 'cvxpo' and el[-14:] == "py36_0.tar.bz2"][-1] - -# LAST_BUILD_NAME_Py27 = [el for el in sorted(os.listdir( -# '%s/%s' % (BUILDDIR, ARCH))) if el[:5] == 'cvxpo' and el[-14:] == "py27_0.tar.bz2"][-1] - -for LAST_BUILD_NAME in [LAST_BUILD_NAME_Py36]: # , LAST_BUILD_NAME_Py27]: - for NEWARCH in ['osx-64', 'win-32', 'win-64', 'linux-32', 'linux-64']: - subprocess.call(["conda", "convert", - "--platform=%s" % NEWARCH, - "%s/%s/%s" % (BUILDDIR, ARCH, LAST_BUILD_NAME), - "-o=%s" % BUILDDIR]) - subprocess.call(["anaconda", "upload", "--force", - "--user=%s" % CHANNEL] + - ["--token=$CONDA_UPLOAD_TOKEN"] + - ["%s/%s/%s" % (BUILDDIR, NEWARCH, LAST_BUILD_NAME)]) - -# pypi -subprocess.call(["python", "setup.py", "sdist"]) -subprocess.call(["twine", "upload", "--skip-existing"] + - ["-u $PYPI_USER"] + - ["-p $PYPI_PASSWORD"] + - ["dist/*"]) diff --git a/continuous_integration/install.sh b/continuous_integration/install.sh deleted file mode 100644 index 1890e0cfa..000000000 --- a/continuous_integration/install.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# This script is meant to be called by the "install" step defined in -# .travis.yml. See http://docs.travis-ci.com/ for more details. -# The behavior of the script is controlled by environment variabled defined -# in the .travis.yml in the top level folder of the project. - -set -e - -# Deactivate the travis-provided virtual environment and setup a -# conda-based environment instead -deactivate - -# Use the miniconda installer for faster download / install of conda -# itself -wget http://repo.continuum.io/miniconda/Miniconda-3.9.1-Linux-x86_64.sh \ - -O miniconda.sh -chmod +x miniconda.sh && ./miniconda.sh -b -export PATH=/home/travis/miniconda/bin:$PATH -conda update --yes conda - -conda install --yes conda-build -conda install --yes anaconda-client - -conda create -n testenv --yes python=$PYTHON_VERSION pip nose pandas -source activate testenv -conda install --yes -c cvxgrp matplotlib -pip install flake8 - -# installing via pip because conda might not have py2 -pip install cvxpy==1.0.6 - -if [[ "$COVERAGE" == "true" ]]; then - pip install coverage coveralls -fi diff --git a/continuous_integration/test_script.sh b/continuous_integration/test_script.sh deleted file mode 100755 index d073cd344..000000000 --- a/continuous_integration/test_script.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# This script is meant to be called by the "script" step defined in -# .travis.yml. See http://docs.travis-ci.com/ for more details. -# The behavior of the script is controlled by environment variabled defined -# in the .travis.yml in the top level folder of the project. - -set -e - -python --version -python -c "import numpy; print('numpy %s' % numpy.__version__)" -python -c "import cvxpy; print('cvxpy %s' % cvxpy.__version__)" -python setup.py install - -if [[ "$COVERAGE" == "true" ]]; then - export WITH_COVERAGE="--with-coverage" -else - export WITH_COVERAGE="" -fi -nosetests $WITH_COVERAGE cvxportfolio diff --git a/pre_commit.sh b/pre_commit.sh deleted file mode 100755 index 5732f2b2e..000000000 --- a/pre_commit.sh +++ /dev/null @@ -1,11 +0,0 @@ -## TODO: move everything to docker - -source activate cvxportfolio-testing -nosetests -flake8 --exclude="*/__init__.py" . -source deactivate - -source activate cvxportfolio-testing-py2 -nosetests -flake8 --exclude="*/__init__.py" . -source deactivate \ No newline at end of file diff --git a/test_environment.yml b/test_environment.yml deleted file mode 100644 index 4ebc3a0f6..000000000 --- a/test_environment.yml +++ /dev/null @@ -1,28 +0,0 @@ -# This file describes a conda environment that can be used by alpha testers -# -# Run the following command to set up this environment: -# $ conda env create -f test_environment.yml -# -# The environment name can be overridden with the following command: -# $ conda env create -n -f test_environment.yml -# -# Run the following command to activate the environment: -# $ source activate cvxportfolio-testing -# -# To deactivate the environment run the following command: -# $ source deactivate -# -# To remove the environment entirely, run the following command: -# $ conda env remove -n cvxportfolio-testing - -name: cvxportfolio-testing -channels: - - cvxgrp -dependencies: - - python=3.6 - - pandas - - cvxpy - - matplotlib - - jupyter - - pytables - - nose \ No newline at end of file diff --git a/test_environment_py2.yml b/test_environment_py2.yml deleted file mode 100644 index 4a51a82ab..000000000 --- a/test_environment_py2.yml +++ /dev/null @@ -1,28 +0,0 @@ -# This file describes a conda environment that can be used by alpha testers -# -# Run the following command to set up this environment: -# $ conda env create -f test_environment_py2.yml -# -# The environment name can be overridden with the following command: -# $ conda env create -n -f test_environment_py2.yml -# -# Run the following command to activate the environment: -# $ source activate cvxportfolio-testing-py2 -# -# To deactivate the environment run the following command: -# $ source deactivate -# -# To remove the environment entirely, run the following command: -# $ conda env remove -n cvxportfolio-testing-py2 - -name: cvxportfolio-testing-py2 -channels: - - cvxgrp -dependencies: - - python=2.7 - - pandas - - cvxpy - - matplotlib - - jupyter - - pytables - - nose \ No newline at end of file