diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..fb2dedce36adc2f88283a371c5cd0d4072904a98 --- /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 0000000000000000000000000000000000000000..64ea2ddb658c035026890039ba65fa17673c0859 --- /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 0000000000000000000000000000000000000000..0fd5103d441c50329822d7d99b4bb26fd30fe59c --- /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 0000000000000000000000000000000000000000..d0c3cbf1020d5c292abdedf27627c6abe25e2293 --- /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 0000000000000000000000000000000000000000..dc1312ab09ca6fb0267dee6b28a38e69c253631a --- /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 0000000000000000000000000000000000000000..024da35e645c14accfec446cbfcc31b04a951203 --- /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 0000000000000000000000000000000000000000..a39e100a7fbc8cf701c33f17498b5a909c54dc97 --- /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 Binary files a/sample/__pycache__/helpers.cpython-312.pyc and b/sample/__pycache__/helpers.cpython-312.pyc differ diff --git a/sample/helpers.py b/sample/helpers.py index f7d719734b1f8821018dcdc650b388b7ee870031..4d3af896d0bd34b28ea0522ef2b545bdfd241118 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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/test_feproject.py b/tests/test_feproject.py new file mode 100644 index 0000000000000000000000000000000000000000..43d4cbdf60da01971740906fece4363379474137 --- /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()