Skip to content

Commit

Permalink
Merge pull request #110 from ben9809/feature/poetry-setup
Browse files Browse the repository at this point in the history
Setup Poetry and Bumpversion
  • Loading branch information
Jackal08 authored May 2, 2024
2 parents 4454610 + 023d4c7 commit 3c7b55e
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 131 deletions.
6 changes: 5 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ commit = False
tag = False
tag_name = {new_version}

[bumpversion:file:setup.cfg]
[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:docs/source/conf.py]
search = release = "{current_version}"
replace = release = "{new_version}"
36 changes: 36 additions & 0 deletions .github/workflows/publish-final-dist.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Distribution to PyPI

on:
pull_request:
branches:
- master

jobs:
build-and-publish-final-dist:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install Poetry
run: |
pip install poetry
- name: Install dependencies
run: |
poetry install --without docs tests
- name: Build the package
run: |
poetry build
- name: Publish to TestPyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry publish
39 changes: 39 additions & 0 deletions .github/workflows/publish-test-dist.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish Distribution to TestPyPI

on:
pull_request:
branches:
- develop
paths:
- 'release/*'

jobs:
build-and-publish-test-dist:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install Poetry
run: |
pip install poetry
- name: Install dependencies
run: |
poetry install --without docs tests
- name: Build the package
run: |
poetry build
- name: Publish to TestPyPI
env:
POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish -r testpypi
24 changes: 12 additions & 12 deletions .github/workflows/python-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -32,14 +32,14 @@ jobs:
- name: Install dependencies
run: |
poetry install
poetry install --without docs
- name: Run Pylint
run: |
poetry run pylint arbitragelab tests --rcfile=.pylintrc --output-format=text --output=pylint-report.txt
- name: Upload test results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pylint-report-${{ matrix.python-version }}
path: pylint-report.txt
Expand All @@ -53,10 +53,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -67,7 +67,7 @@ jobs:
- name: Install dependencies
run: |
poetry install
poetry install --without docs
- name: Run tests with coverage
run: |
Expand All @@ -77,7 +77,7 @@ jobs:
run: poetry run coverage html

- name: Upload Coverage XML Report as Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: coverage.html
Expand All @@ -93,10 +93,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -106,7 +106,7 @@ jobs:
- name: Install requirements
run: |
poetry install
poetry install --without tests
- name: Build documentation
run: |
Expand All @@ -119,7 +119,7 @@ jobs:
poetry run make doctest
- name: Upload doctest results as an artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: doctest-results
path: docs/build/doctest/output.txt
Expand Down
22 changes: 9 additions & 13 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

build:
os: ubuntu-22.04
os: "ubuntu-22.04"
tools:
python: "3.8"
jobs:
post_create_environment:
# Install poetry
- pip install poetry
post_install:
# Install dependencies
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --only docs

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Optionally build your docs in additional formats such as PDF
formats: []

# Optionally set the version of Python and requirements required to build your docs
python:
install:
- requirements: docs/source/requirements.txt
configuration: docs/source/conf.py

29 changes: 15 additions & 14 deletions arbitragelab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
ArbitrageLab helps portfolio managers and traders who want to leverage the power of Statistical Arbitrage by providing
reproducible, interpretable, and easy to use tools.
"""
# pylint: disable=consider-using-from-import

from arbitragelab import codependence
from arbitragelab import cointegration_approach
from arbitragelab import copula_approach
from arbitragelab import distance_approach
from arbitragelab import hedge_ratios
from arbitragelab import ml_approach
from arbitragelab import optimal_mean_reversion
from arbitragelab import other_approaches
from arbitragelab import spread_selection
from arbitragelab import stochastic_control_approach
from arbitragelab import tearsheet
from arbitragelab import time_series_approach
from arbitragelab import trading
from arbitragelab import util
import arbitragelab.codependence as codependence
import arbitragelab.cointegration_approach as cointegration_approach
import arbitragelab.copula_approach as copula_approach
import arbitragelab.distance_approach as distance_approach
import arbitragelab.hedge_ratios as hedge_ratios
import arbitragelab.ml_approach as ml_approach
import arbitragelab.optimal_mean_reversion as optimal_mean_reversion
import arbitragelab.other_approaches as other_approaches
import arbitragelab.spread_selection as spread_selection
import arbitragelab.stochastic_control_approach as stochastic_control_approach
import arbitragelab.tearsheet as tearsheet
import arbitragelab.time_series_approach as time_series_approach
import arbitragelab.trading as trading
import arbitragelab.util as util
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
author = 'Hudson & Thames Quantitative Research'

# The full version, including alpha/beta/rc tags
release = '0.9.1'
release = "0.9.1"


# -- General configuration ---------------------------------------------------
Expand Down
45 changes: 0 additions & 45 deletions docs/source/requirements.txt

This file was deleted.

4 changes: 4 additions & 0 deletions docs/source/visualization/tearsheet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,14 @@ Implementation
**************

.. automodule:: arbitragelab.tearsheet.tearsheet
:noindex:

.. autoclass:: TearSheet
:noindex:
:members: __init__

.. automethod:: TearSheet.cointegration_tearsheet
:noindex:

Code Example
************
Expand Down Expand Up @@ -172,6 +175,7 @@ Implementation
**************

.. automethod:: TearSheet.ou_tearsheet
:noindex:

Code Example
************
Expand Down
13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,25 @@ requires = ["poetry-core>=1.0"]
build-backend = "poetry.core.masonry.api"


[tool.poetry.group.dev.dependencies]
[tool.poetry.group.tests.dependencies]
coverage = "7.2.7"
pylint = "3.1.0"
pytest = "7.3.1"
releases = "1.6.3"
pyarmor = "8.5.2"
pytest-cov = "3.0.0"

[tool.poetry.group.doc.dependencies]
[tool.poetry.group.docs.dependencies]
releases = "1.6.3"
jinja2 = "<3.1"
docutils = "0.18.1"
hudsonthames-sphinx-theme = "0.1.5"
myst-parser = "2.0.0"
sphinx-rtd-theme = "1.2.0"
sphinx-tabs = "3.4.1"
myst-parser = "2.0.0" #3.0.0
sphinx-rtd-theme = "2.0.0" #2.0.0
sphinx-tabs = "3.4.1" #3.4.5
sphinx = "6.2.1"
sphinx-autoapi = "3.0.0"
sphinx-copybutton = "0.5.2"
six = "*"

[tool.poetry.extras]
docs = ["sphinx", "sphinx-rtd-theme", "sphinx-tabs", "sphinx-autoapi", "sphinx-copybutton", "myst-parser", "hudsonthames-sphinx-theme", "docutils", "jinja2", "releases"]
39 changes: 0 additions & 39 deletions requirements.txt

This file was deleted.

0 comments on commit 3c7b55e

Please sign in to comment.