Skip to content

Commit

Permalink
move to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
tschm committed Dec 7, 2024
1 parent 081b5ac commit 974de31
Show file tree
Hide file tree
Showing 7 changed files with 1,568 additions and 3,817 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ jobs:
run: |
pip install pytest pytest-cov
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
fail_ci_if_error: true
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# files: ./coverage.xml
# fail_ci_if_error: true
23 changes: 12 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest isort black flake8
pip install ecos
pip install pytest ecos
# isort black flake8
# pip install ecos
- name: Test with pytest
run: |
pytest ./tests
- name: Check with isort
run: |
isort --check --diff .
- name: Check with black
run: |
black --check --diff .
- name: Check with flake8
run: |
flake8 --show-source --statistics .
#- name: Check with isort
# run: |
# isort --check --diff .
#- name: Check with black
# run: |
# black --check --diff .
#- name: Check with flake8
# run: |
# flake8 --show-source --statistics .
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.DEFAULT_GOAL := help

SHELL=/bin/bash

UNAME=$(shell uname -s)

.PHONY: install
install: ## Install a virtual environment with all extras
@curl -LsSf https://astral.sh/uv/install.sh | sh
@uv venv
@uv sync -vv --all-extras
@echo "Virtual environment created with all extras. Activate with:"
@echo "source .venv/bin/activate"

.PHONY: fmt
fmt: ## Run autoformatting and linting
@uv pip install pre-commit
@uv run pre-commit install
@uv run pre-commit run --all-files


.PHONY: test
test: install ## Run tests
@uv run pytest


.PHONY: clean
clean: ## Clean up caches and build artifacts
@git clean -X -d -f


.PHONY: coverage
coverage: install ## test and coverage
@uv run coverage run --source=cvx/. -m pytest
@uv run coverage report -m
@uv run coverage html

@if [ ${UNAME} == "Darwin" ]; then \
open htmlcov/index.html; \
elif [ ${UNAME} == "linux" ]; then \
xdg-open htmlcov/index.html 2> /dev/null; \
fi


.PHONY: help
help: ## Display this help screen
@echo -e "\033[1mAvailable commands:\033[0m"
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort
3,767 changes: 0 additions & 3,767 deletions poetry.lock

This file was deleted.

116 changes: 82 additions & 34 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[tool.poetry]
[project]
name = "pyportfolioopt"
version = "1.5.6"
version = "0.0.0"
description = "Financial portfolio optimization in python"
license = "MIT"
authors = ["Robert Andrew Martin <[email protected]>"]
authors = [{name="Robert Andrew Martin", email="[email protected]"}]
readme = "README.md"
repository = "https://github.com/robertmartin8/PyPortfolioOpt"
documentation = "https://pyportfolioopt.readthedocs.io/en/latest/"
keywords= ["finance", "portfolio", "optimization", "quant", "investing"]
requires-python = ">=3.10"
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
Expand All @@ -25,43 +26,90 @@ classifiers=[
"Topic :: Office/Business :: Financial",
"Topic :: Office/Business :: Financial :: Investment",
]
packages = [ {include = "pypfopt"} ]
dependencies = [
"scipy",
"pandas",
"cvxpy",
"numpy"
]

[tool.poetry.urls]
"Issues" = "https://github.com/robertmartin8/PyPortfolioOpt/issues"
"Personal website" = "https://reasonabledeviations.com"
#[tool.poetry.urls]
#"Issues" = "https://github.com/robertmartin8/PyPortfolioOpt/issues"
#"Personal website" = "https://reasonabledeviations.com"

[tool.poetry.dependencies]
python = ">=3.9"
scipy = ">=1.3"
pandas = ">=0.19"
cvxpy = ">=1.1.19"
numpy = ">=1.26.0"
matplotlib = { version=">=3.2.0", optional=true }
scikit-learn = { version=">=0.24.1", optional=true }
ecos = { version="^2.0.14", optional=true }
plotly = { version="^5.0.0", optional=true }
[project.optional-dependencies]
plot = [
"matplotlib",
"plotly",
"scikit-learn",
"ecos"
]

[tool.poetry.dev-dependencies]
pytest = ">=7.1.2"
flake8 = ">=4.0.1"
jupyterlab = ">=3.4.2"
black = ">=22.3.0"
ipykernel = ">=6.13.0"
jedi = ">=0.18.1"
pytest-cov = ">=3.0.0"
yfinance = ">=0.1.70"
[dependency-groups]
dev = [
"pytest-cov>=6.0.0",
"pytest>=8.3.3",
"pre-commit>=4.0.1",
"jedi",
"yfinance",
"ecos"
]

[tool.poetry.extras]
optionals = ["scikit-learn", "matplotlib", "cvxopt"]
#excel = [
# "odfpy>=1.4.1",
# "openpyxl>=3.1.0",
# "python-calamine>=0.1.7",
# "pyxlsb>=1.0.10",
# "xlrd>=2.0.1",
# "xlsxwriter>=3.0.5"
#]

#[tool.poetry.dependencies]
#python = ">=3.9"
#scipy = ">=1.3"
#pandas = ">=0.19"
#cvxpy = ">=1.1.19"
#numpy = ">=1.26.0"
#matplotlib = { version=">=3.2.0", optional=true }
#scikit-learn = { version=">=0.24.1", optional=true }
#ecos = { version="^2.0.14", optional=true }
#plotly = { version="^5.0.0", optional=true }

#[tool.poetry.dev-dependencies]
#pytest = ">=7.1.2"
#flake8 = ">=4.0.1"
#jupyterlab = ">=3.4.2"
#black = ">=22.3.0"
#ipykernel = ">=6.13.0"
#jedi = ">=0.18.1"
#pytest-cov = ">=3.0.0"
#yfinance = ">=0.1.70"

#[tool.poetry.extras]
#optionals = ["scikit-learn", "matplotlib", "cvxopt"]

[tool.ruff]
select = ["E", "F", "I"]
line-length = 120
target-version = "py310"
exclude = [
"*__init__.py", "tests/test_imports.py"
]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["pypfopt"]

#[build-system]
#requires = ["poetry-core>=1.0.0"]
#build-backend = "poetry.core.masonry.api"


[tool.black]
line-length = 88
#[tool.black]
#line-length = 88

[tool.isort]
profile = "black"
#[tool.isort]
#profile = "black"
Loading

0 comments on commit 974de31

Please sign in to comment.