Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
furechan committed Sep 23, 2024
1 parent 2d2e5d9 commit 9bdd76f
Show file tree
Hide file tree
Showing 2 changed files with 215 additions and 200 deletions.
225 changes: 25 additions & 200 deletions examples/typical-usage.ipynb

Large diffs are not rendered by default.

190 changes: 190 additions & 0 deletions misc/project-utils.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": [
"import re\n",
"\n",
"from pathlib import Path"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [],
"source": [
"PYPROJECT = Path.cwd().joinpath(\"../pyproject.toml\").resolve(strict=True)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[build-system]\n",
"requires = [\"hatchling\"]\n",
"build-backend = \"hatchling.build\"\n",
"\n",
"[project]\n",
"name = \"mplchart\"\n",
"version = \"0.0.12\"\n",
"requires-python = \">=3.9\"\n",
"readme = \"output/README.md\"\n",
"license = { text = \"MIT License\" }\n",
"description = \"Classic Stock Charts in Python\"\n",
"urls = { homepage = \"https://github.com/furechan/mplchart\" }\n",
"authors = [{ name = \"Furechan\", email = \"[email protected]\" }]\n",
"keywords = [\"finance\", \"charting\", \"matplotlib\", \"candlesticks\"]\n",
"dependencies = [\"matplotlib\", \"numpy\", \"pandas\"]\n",
"classifiers = [\n",
" \"Programming Language :: Python :: 3\",\n",
" \"License :: OSI Approved :: MIT License\",\n",
" \"Operating System :: OS Independent\",\n",
"]\n",
"\n",
"[project.optional-dependencies]\n",
"extras = [\"yfinance\", \"pytest\", \"ipykernel\", \"ta-lib\", \"ruff\"]\n",
"\n",
"[tool.hatch.version]\n",
"path = \"src/mplchart/__init__.py\"\n",
"\n",
"[tool.hatch.build]\n",
"targets.wheel.sources = [\"src\"]\n",
"dev-mode-dirs = [\"src\"]\n",
"only-include = [\"src\"]\n",
"exclude = [\".*\"]\n",
"\n",
"[tool.ruff.lint.per-file-ignores]\n",
"\"__init__.py\" = [\"F401\"]\n",
"\"*.ipynb\" = [\"F401\", \"F811\"]\n",
"\n",
"[tool.pytest.ini_options]\n",
"addopts = [\"-p no:cacheprovider\"]\n",
"testpaths = [\"tests\"]\n",
"\n"
]
}
],
"source": [
"pyproject = PYPROJECT.read_text()\n",
"print(pyproject)"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'0.0.12'"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pattern = r\"^version \\s* = \\s* \\\"(.+)\\\" \\s*\"\n",
"\n",
"match = re.search(pattern, pyproject, flags=re.VERBOSE | re.MULTILINE)\n",
"match.group(1)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[build-system]\n",
"requires = [\"hatchling\"]\n",
"build-backend = \"hatchling.build\"\n",
"\n",
"[project]\n",
"name = \"mplchart\"\n",
"HERE\n",
"requires-python = \">=3.9\"\n",
"readme = \"output/README.md\"\n",
"license = { text = \"MIT License\" }\n",
"description = \"Classic Stock Charts in Python\"\n",
"urls = { homepage = \"https://github.com/furechan/mplchart\" }\n",
"authors = [{ name = \"Furechan\", email = \"[email protected]\" }]\n",
"keywords = [\"finance\", \"charting\", \"matplotlib\", \"candlesticks\"]\n",
"dependencies = [\"matplotlib\", \"numpy\", \"pandas\"]\n",
"classifiers = [\n",
" \"Programming Language :: Python :: 3\",\n",
" \"License :: OSI Approved :: MIT License\",\n",
" \"Operating System :: OS Independent\",\n",
"]\n",
"\n",
"[project.optional-dependencies]\n",
"extras = [\"yfinance\", \"pytest\", \"ipykernel\", \"ta-lib\", \"ruff\"]\n",
"\n",
"[tool.hatch.version]\n",
"path = \"src/mplchart/__init__.py\"\n",
"\n",
"[tool.hatch.build]\n",
"targets.wheel.sources = [\"src\"]\n",
"dev-mode-dirs = [\"src\"]\n",
"only-include = [\"src\"]\n",
"exclude = [\".*\"]\n",
"\n",
"[tool.ruff.lint.per-file-ignores]\n",
"\"__init__.py\" = [\"F401\"]\n",
"\"*.ipynb\" = [\"F401\", \"F811\"]\n",
"\n",
"[tool.pytest.ini_options]\n",
"addopts = [\"-p no:cacheprovider\"]\n",
"testpaths = [\"tests\"]\n",
"\n"
]
}
],
"source": [
"print(re.sub(pattern, \"HERE\\n\", pyproject, flags=re.VERBOSE | re.MULTILINE))\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit 9bdd76f

Please sign in to comment.