From 4d751fddae543bb9e22ff46e08d5a815fc72e62c Mon Sep 17 00:00:00 2001 From: sttdtran <thuy.d.ngoc@stud.h-da.de> Date: Tue, 16 Jul 2024 11:37:42 +0200 Subject: [PATCH] finish step --- .gitignore | 114 +++++++++++++++++++++ MANIFEST.in | 3 + Makefile | 35 +++++++ docs/Makefile | 20 ++++ docs/make.bat | 35 +++++++ docs/source/conf.py | 28 +++++ docs/source/index.rst | 17 +++ sample/__pycache__/helpers.cpython-312.pyc | Bin 935 -> 1530 bytes sample/helpers.py | 12 +++ tests/__init__.py | 0 tests/test_feproject.py | 13 +++ 11 files changed, 277 insertions(+) create mode 100644 .gitignore create mode 100644 MANIFEST.in create mode 100644 Makefile create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst create mode 100644 tests/__init__.py create mode 100644 tests/test_feproject.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fb2dedc --- /dev/null +++ b/.gitignore @@ -0,0 +1,114 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# Ignore config.json +config.json +config.ini + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller + +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + + +# Rope project settings +.ropeproject + + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..64ea2dd --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include README.md +include LICENSE +recursive-include docs * diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0fd5103 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +# Makefile for common tasks + +.PHONY: help clean install test docs + +help: + @echo "Available commands:" + @echo " clean - Remove all build, test, coverage and Python artifacts" + @echo " install - Install dependencies" + @echo " test - Run tests quickly with the default Python" + @echo " docs - Generate Sphinx HTML documentation, including API docs" + +clean: + @echo "Cleaning up..." + find . -name '*.pyc' -exec rm -f {} + + find . -name '*.pyo' -exec rm -f {} + + find . -name '__pycache__' -exec rm -rf {} + + rm -rf build/ + rm -rf dist/ + rm -rf *.egg-info + rm -rf .tox/ + rm -rf .nox/ + rm -rf .mypy_cache/ + rm -rf .pytest_cache/ + +install: + @echo "Installing dependencies..." + pip install -r requirements.txt + +test: + @echo "Running tests..." + pytest + +docs: + @echo "Building documentation..." + cd docs && make html diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..dc1312a --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..024da35 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,28 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'feproject' +copyright = '2024, Thuy Dung' +author = 'Thuy Dung' +release = '12.01.2030' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [] + +templates_path = ['_templates'] +exclude_patterns = [] + + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'alabaster' +html_static_path = ['_static'] diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..a39e100 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,17 @@ +.. feproject documentation master file, created by + sphinx-quickstart on Tue Jul 16 00:17:05 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +feproject documentation +======================= + +Add your content using ``reStructuredText`` syntax. See the +`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_ +documentation for details. + + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + diff --git a/sample/__pycache__/helpers.cpython-312.pyc b/sample/__pycache__/helpers.cpython-312.pyc index 549a30752f9ce7c9dd7ff7610eea7fc10c6b25b3..cd8366dedab158295d29b1716a9e0fdd8a7e9216 100644 GIT binary patch delta 681 zcmZ3^{)?OMG%qg~0|Ns?<%+3k8O#&;Bp59wsvC2qu(dEmu~#x_vQLb=#K=C`kZ}<s z&*UqNyBL2>?q|wi6=7gt5S;vn$y_`cq#K4=7#J9s85kHoznaX!<X>OIkisO%z`#(; zSi_jb4pW4nQ<zsXLU^@II8?B}RWRdF!3tNwf~KM#Vm3nx8(ax%4O0zs4NDDc8cQ&P zCc9q|9|Hr!Esm7LlEkFM;?!F#d5O8Hx44T^(=+q);=vr=;?&||5HCBmGBf3t5R99c zoSa%*9G{(9smW3#z`(#zBnTpeKn60Wr<Q24)fWkaIGia-@yYplX_@J_*i(`qhJwT( zmfYe<Ndg&?nR1IaB`F?ZYB3uF1A_t>6mfve;ZIL3iFXVSj(2g2&&*59FH&S+U=U|u zU?|RGU|?uqxWg-XomcH5ui9l^jRv<HEL`>N-i_W9c&@O>-VhL*P<2s2sloFGpLl<6 zXYLHQ%Y4cW?l%M^r}IwaosoN4K&Qd;2ERmqZD;L__{;pd4IVc{WT*R1^u3^Dc3H%{ z!S?~T&;-vJ6)R*faGPCVF)IQ^rzXcO_JYKcjGWA*B2d(WgW(oyQhrIkaS<m29|J=X z4=7APsijD9ax}B7i3$S)11Qdml^7TpJ}@&fGTvp7xXmDZn}O#O2NR>@CoU#NtxsGm OjM|@hI2p~s)&KyQAf^TY delta 156 zcmeyxy_}uzG%qg~0|NuYv~yu;yBH_(NiZ5sR5xa+WYT1tm~x4cZL&GzB1Z1Xw-|RZ zR!yGDl));@z`!6dnTgq4LzDd$dqHAJMowl@5eowYLlHj%1H&!Wr2LY6<04Lw01t=| zp1hJ(R$q*Pfq{{MfuUHIfq~%zGb1D8T?UEU48pe=cs{W)F-m^oVq(<#%*Dc}UBu47 GzyJXGNF%WT diff --git a/sample/helpers.py b/sample/helpers.py index f7d7197..4d3af89 100644 --- a/sample/helpers.py +++ b/sample/helpers.py @@ -2,6 +2,7 @@ from pathlib import Path import configparser import boto3 +#%% def get_path_to_data(): """Return path to data.""" @@ -18,3 +19,14 @@ def get_tidy_data_path(): config = configparser.ConfigParser() config.read("config.ini") return get_path_to_data() / 'TidyData' + +def get_AWS_DB_info(): + config = configparser.ConfigParser() + config.read("config.ini") + db_config = config["database"] + db_name = db_config.get("name") # region_name session_keyid session_access_key + db_region = db_config.get("region_name") + db_keyid = db_config.get("session_keyid") + db_access_key = db_config.get("session_access_key") + + return db_name, db_region, db_keyid, db_access_key \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_feproject.py b/tests/test_feproject.py new file mode 100644 index 0000000..43d4cbd --- /dev/null +++ b/tests/test_feproject.py @@ -0,0 +1,13 @@ +#%% +from feproject.sample.helpers import get_tidy_data_path + +import pandas as pd + + +def test_check_dataframe_size(): + # df = pd.read_parquet(get_tidy_data_path(), engine = 'fastparquet')#/ 'current_race.parquet' + a = get_tidy_data_path() + print(a) + +# %% +test_check_dataframe_size() -- GitLab