-
Notifications
You must be signed in to change notification settings - Fork 5.6k
update python version #1868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
update python version #1868
Changes from 28 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
ec7bf7f
update python version
SunsetWolf 74b8e00
fix: Correct selector handling and add time filtering in storage.py
you-n-g 0bf8943
fix: convert index and columns to list in repr methods
you-n-g f9e41a5
feat: Add Makefile for managing project prerequisites
you-n-g 4f01195
feat: Add Cython extensions for rolling and expanding operations
you-n-g 018c631
resolve install error
SunsetWolf 009ee10
fix lint error
SunsetWolf c54721e
fix lint error
SunsetWolf 58d1e05
fix lint error
SunsetWolf 0e38d61
fix lint error
SunsetWolf b1685f8
fix lint error
SunsetWolf 40ab983
update build package
SunsetWolf f0bd5d7
update makefile
SunsetWolf da9eb5d
update ci yaml
SunsetWolf d863765
fix docs build error
SunsetWolf d9da86b
fix ubuntu install error
SunsetWolf 2bef082
fix docs build error
SunsetWolf 4904f3d
fix install error
SunsetWolf 3484fb7
fix install error
SunsetWolf c182dd4
fix install error
SunsetWolf da3a49f
fix install error
SunsetWolf 60fcb71
fix pylint error
SunsetWolf 5abfddf
fix pylint error
SunsetWolf 4cf783f
fix pylint error
SunsetWolf 2359552
fix pylint error
SunsetWolf 602ca12
fix pylint error E1123
SunsetWolf 9ea5bac
fix pylint error R0917
SunsetWolf b2cafd3
fix pytest error
SunsetWolf dea4c13
fix pytest error
SunsetWolf 6ea6609
fix pytest error
SunsetWolf 1e45aca
update code
SunsetWolf 6848b77
update code
SunsetWolf 067ea77
fix ci error
SunsetWolf a207d81
fix pylint error
SunsetWolf 0dc0f38
fix black error
SunsetWolf 202fc96
fix pytest error
SunsetWolf 84d9d70
fix CI error
SunsetWolf 89c7a0c
fix CI error
SunsetWolf ed5d71d
add python version to CI
SunsetWolf a369253
add python version to CI
SunsetWolf 6a6ff93
add python version to CI
SunsetWolf 27813eb
fix pylint error
SunsetWolf fd1ba4c
fix pytest general nn error
SunsetWolf 561abaf
fix CI error
SunsetWolf 825deb2
optimize code
SunsetWolf e67553b
add coments
SunsetWolf 32782ed
Extended macos version
SunsetWolf 47f50ad
remove build package
SunsetWolf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,4 +48,5 @@ tags | |
| *.swp | ||
|
|
||
| ./pretrain | ||
| .idea/ | ||
| .idea/ | ||
| .aider* | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,5 @@ | ||
| include qlib/VERSION.txt | ||
| exclude tests/* | ||
| include qlib/* | ||
| include qlib/*/* | ||
| include qlib/*/*/* | ||
| include qlib/*/*/*/* | ||
SunsetWolf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| .PHONY: prerequisite clean deepclean install init-qlib-env dev constraints black isort mypy ruff toml-sort lint pre-commit test-run test build upload docs-autobuild changelog docs-gen docs-mypy docs-coverage docs | ||
| #You can modify it according to your terminal | ||
| SHELL := /bin/bash | ||
|
|
||
| ######################################################################################## | ||
| # Variables | ||
| ######################################################################################## | ||
|
|
||
| # Documentation target directory, will be adapted to specific folder for readthedocs. | ||
| PUBLIC_DIR := $(shell [ "$$READTHEDOCS" = "True" ] && echo "$$READTHEDOCS_OUTPUT/html" || echo "public") | ||
|
|
||
| SO_DIR := qlib/data/_libs | ||
| SO_FILES := $(wildcard $(SO_DIR)/*.so) | ||
|
|
||
| ######################################################################################## | ||
| # Development Environment Management | ||
| ######################################################################################## | ||
| # Remove common intermediate files. | ||
| clean: | ||
| -rm -rf \ | ||
| $(PUBLIC_DIR) \ | ||
| qlib/data/_libs \ | ||
| mlruns \ | ||
| build \ | ||
| .coverage \ | ||
| .mypy_cache \ | ||
| .pytest_cache \ | ||
| .ruff_cache \ | ||
| Pipfile* \ | ||
| coverage.xml \ | ||
| dist \ | ||
| release-notes.md | ||
|
|
||
| find . -name '*.egg-info' -print0 | xargs -0 rm -rf | ||
| find . -name '*.pyc' -print0 | xargs -0 rm -f | ||
| find . -name '*.swp' -print0 | xargs -0 rm -f | ||
| find . -name '.DS_Store' -print0 | xargs -0 rm -f | ||
| find . -name '__pycache__' -print0 | xargs -0 rm -rf | ||
|
|
||
| # Remove pre-commit hook, virtual environment alongside itermediate files. | ||
| deepclean: clean | ||
| if command -v pre-commit > /dev/null 2>&1; then pre-commit uninstall --hook-type pre-push; fi | ||
| if command -v pipenv >/dev/null 2>&1 && pipenv --venv >/dev/null 2>&1; then pipenv --rm; fi | ||
|
|
||
| # Prerequisite section | ||
| prerequisite: | ||
| @if [ -n "$(SO_FILES)" ]; then \ | ||
| echo "Shared library files exist, skipping build."; \ | ||
| else \ | ||
| echo "No shared library files found, building..."; \ | ||
| python -m pip install cython numpy; \ | ||
| python -c "from setuptools import setup, Extension; from Cython.Build import cythonize; import numpy; extensions = [Extension('qlib.data._libs.rolling', ['qlib/data/_libs/rolling.pyx'], language='c++', include_dirs=[numpy.get_include()]), Extension('qlib.data._libs.expanding', ['qlib/data/_libs/expanding.pyx'], language='c++', include_dirs=[numpy.get_include()])]; setup(ext_modules=cythonize(extensions, language_level='3'), script_args=['build_ext', '--inplace'])"; \ | ||
SunsetWolf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fi | ||
|
|
||
| # Install the package in editable mode. | ||
| dependencies: | ||
| python -m pip install -e . | ||
|
|
||
| lightgbm: | ||
| python -m pip install lightgbm --prefer-binary | ||
|
|
||
| rl: | ||
| python -m pip install -e .[rl] | ||
|
|
||
| develop: | ||
| python -m pip install -e .[dev] | ||
|
|
||
| lint: | ||
| python -m pip install -e .[lint] | ||
|
|
||
| docs: | ||
| python -m pip install -e .[docs] | ||
|
|
||
| package: | ||
| python -m pip install -e .[package] | ||
|
|
||
| all: | ||
| python -m pip install -e .[rl,dev,lint,docs,package] | ||
|
|
||
| install: prerequisite dependencies | ||
|
|
||
| dev: prerequisite all | ||
|
|
||
| ######################################################################################## | ||
| # Lint and pre-commit | ||
| ######################################################################################## | ||
|
|
||
| # Check lint with black. | ||
| black: | ||
| black . -l 120 --check --diff | ||
|
|
||
| # Check code folder with pylint. | ||
| pylint: | ||
| pylint --disable=C0104,C0114,C0115,C0116,C0301,C0302,C0411,C0413,C1802,R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R0917,R1720,W0105,W0123,W0201,W0511,W0613,W1113,W1514,E0401,E1121,C0103,C0209,R0402,R1705,R1710,R1725,R1730,R1735,W0102,W0212,W0221,W0223,W0231,W0237,W0612,W0621,W0622,W0703,W1309,E1102,E1136 --const-rgx='[a-z_][a-z0-9_]{2,30}' qlib --init-hook="import astroid; astroid.context.InferenceContext.max_inferred = 500; import sys; sys.setrecursionlimit(2000)" | ||
| pylint --disable=C0104,C0114,C0115,C0116,C0301,C0302,C0411,C0413,C1802,R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R0917,R1720,W0105,W0123,W0201,W0511,W0613,W1113,W1514,E0401,E1121,E1123,C0103,C0209,R0402,R1705,R1710,R1725,R1735,W0102,W0212,W0221,W0223,W0231,W0237,W0246,W0612,W0621,W0622,W0703,W1309,E1102,E1136 --const-rgx='[a-z_][a-z0-9_]{2,30}' scripts --init-hook="import astroid; astroid.context.InferenceContext.max_inferred = 500; import sys; sys.setrecursionlimit(2000)" | ||
|
|
||
| # Check code with flake8. | ||
| flake8: | ||
| flake8 --ignore=E501,F541,E266,E402,W503,E731,E203 --per-file-ignores="__init__.py:F401,F403" qlib | ||
|
|
||
| # Check code with mypy. | ||
| mypy: | ||
| mypy qlib --install-types --non-interactive | ||
| mypy qlib --verbose | ||
|
|
||
| # Check ipynb with nbqa. | ||
| nbqa: | ||
| nbqa black . -l 120 --check --diff | ||
| nbqa pylint . --disable=C0104,C0114,C0115,C0116,C0301,C0302,C0411,C0413,C1802,R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R1720,W0105,W0123,W0201,W0511,W0613,W1113,W1514,E0401,E1121,C0103,C0209,R0402,R1705,R1710,R1725,R1735,W0102,W0212,W0221,W0223,W0231,W0237,W0612,W0621,W0622,W0703,W1309,E1102,E1136,W0719,W0104,W0404,C0412,W0611,C0410 --const-rgx='[a-z_][a-z0-9_]{2,30}' | ||
|
|
||
| # Check ipynb with nbconvert. | ||
| nbconvert: | ||
| jupyter nbconvert --to notebook --execute examples/workflow_by_code.ipynb | ||
|
|
||
| lint: black pylint flake8 mypy nbqa | ||
|
|
||
| ######################################################################################## | ||
| # Package | ||
| ######################################################################################## | ||
|
|
||
| # Build the package. | ||
| build: | ||
| python -m build | ||
|
|
||
| # Upload the package. | ||
| upload: | ||
| python -m twine upload dist/* | ||
|
|
||
| ######################################################################################## | ||
| # Documentation | ||
| ######################################################################################## | ||
|
|
||
| docs-gen: | ||
| python -m sphinx.cmd.build -W docs $(PUBLIC_DIR) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,84 @@ | ||
| [build-system] | ||
| requires = ["setuptools", "numpy", "Cython"] | ||
| requires = ["setuptools", "cython", "numpy"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| classifiers = [ | ||
| "Operating System :: POSIX :: Linux", | ||
| "Operating System :: Microsoft :: Windows", | ||
| "Operating System :: MacOS", | ||
| "License :: OSI Approved :: MIT License", | ||
| "Development Status :: 3 - Alpha", | ||
| "Programming Language :: Python", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.7", | ||
| "Programming Language :: Python :: 3.8", | ||
| "Programming Language :: Python :: 3.9", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| ] | ||
| name = "pyqlib" | ||
| dynamic = ["version"] | ||
| description = "A Quantitative-research Platform" | ||
| requires-python = ">=3.7.0" | ||
|
|
||
| dependencies = [ | ||
| "pyyaml", | ||
SunsetWolf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "numpy", | ||
| "pandas", | ||
| "mlflow", | ||
SunsetWolf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "filelock", | ||
| "redis", | ||
| "dill", | ||
| "fire", | ||
| "ruamel.yaml", | ||
| "python-redis-lock", | ||
| "tqdm", | ||
| "pymongo", | ||
| "loguru", | ||
| "lightgbm", | ||
| "gym", | ||
| "cvxpy", | ||
| "joblib", | ||
| "matplotlib", | ||
| ] | ||
|
|
||
| [project.optional-dependencies] | ||
| dev = [ | ||
| "pytest", | ||
| "baostock", | ||
SunsetWolf marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "tianshou", | ||
SunsetWolf marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "yahooquery", | ||
| "plotly", | ||
SunsetWolf marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "statsmodels", | ||
| ] | ||
| rl = [ | ||
| "tianshou<=0.4.10", | ||
| "torch", | ||
| ] | ||
| lint = [ | ||
| "black", | ||
| "pylint", | ||
| "mypy<1.5.0", | ||
| "flake8", | ||
| "nbqa", | ||
| "jupyter", | ||
| "nbconvert", | ||
SunsetWolf marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ] | ||
| docs = [ | ||
| "sphinx", | ||
| "sphinx_rtd_theme", | ||
| "readthedocs_sphinx_ext", | ||
| ] | ||
| package = [ | ||
| "twine", | ||
| "build", | ||
| ] | ||
|
|
||
| [tool.setuptools] | ||
| packages = [ | ||
| "qlib", | ||
| ] | ||
|
|
||
| [project.scripts] | ||
| qrun = "qlib.workflow.cli:run" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.