From 6d44aec4bceffea476024a03418ecfae589f5f62 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Wed, 29 May 2024 21:54:45 +0200 Subject: [PATCH] Initial --- .gitea/workflows/python-package.yml | 15 ++++++ .gitea/workflows/python-test.yml | 6 +++ .gitignore | 19 ++++++++ README.md | 14 ++++++ fin_depo/__init__.py | 1 + fin_depo/_version.py | 1 + requirements.txt | 1 + requirements_test.txt | 1 + setup.py | 71 +++++++++++++++++++++++++++++ test/__init__.py | 0 test/test_data.py | 5 ++ 11 files changed, 134 insertions(+) create mode 100644 .gitea/workflows/python-package.yml create mode 100644 .gitea/workflows/python-test.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 fin_depo/__init__.py create mode 100644 fin_depo/_version.py create mode 100644 requirements.txt create mode 100644 requirements_test.txt create mode 100644 setup.py create mode 100644 test/__init__.py create mode 100644 test/test_data.py diff --git a/.gitea/workflows/python-package.yml b/.gitea/workflows/python-package.yml new file mode 100644 index 0000000..a236fcf --- /dev/null +++ b/.gitea/workflows/python-package.yml @@ -0,0 +1,15 @@ +name: Package Python +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +jobs: + Package: + uses: jmaa/workflows/.gitea/workflows/python-package.yaml@v6.21 + with: + REGISTRY_DOMAIN: gitfub.space + REGISTRY_ORGANIZATION: usagi-keiretsu + secrets: + PIPY_REPO_USER: ${{ secrets.PIPY_REPO_USER }} + PIPY_REPO_PASS: ${{ secrets.PIPY_REPO_PASS }} diff --git a/.gitea/workflows/python-test.yml b/.gitea/workflows/python-test.yml new file mode 100644 index 0000000..cf6212f --- /dev/null +++ b/.gitea/workflows/python-test.yml @@ -0,0 +1,6 @@ +name: Test Python +on: [push] + +jobs: + Test: + uses: jmaa/workflows/.gitea/workflows/python-test.yaml@v6.21 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd63e04 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +# Program specific +/output/ +/deps/ +/secrets/ +/private_deps/ +/data/ + +# Python +__pycache__/ +/build/ +/dist/ +*.egg-info/ +.mypy_cache/ + +# Python, Testing +/test/secrets.py +/.coverage +/.hypothesis/ +/htmlcov/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..a996219 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# Financial Depository Fetchers + +Python library for automatic fetching of personal asset depo information. + +Supports: + +- None :) + +## TODO + +- [ ] Kraken through API +- [ ] Partisia Blockchain Account +- [ ] Nordnet +- [ ] Bank Account (Open Banking) diff --git a/fin_depo/__init__.py b/fin_depo/__init__.py new file mode 100644 index 0000000..4640904 --- /dev/null +++ b/fin_depo/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/fin_depo/_version.py b/fin_depo/_version.py new file mode 100644 index 0000000..b794fd4 --- /dev/null +++ b/fin_depo/_version.py @@ -0,0 +1 @@ +__version__ = '0.1.0' diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..63a601e --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +enforce-typing diff --git a/requirements_test.txt b/requirements_test.txt new file mode 100644 index 0000000..e079f8a --- /dev/null +++ b/requirements_test.txt @@ -0,0 +1 @@ +pytest diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..c71143a --- /dev/null +++ b/setup.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# +# WARNING +# +# THIS IS AN AUTOGENERATED FILE. +# +# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN. + +import re + +from setuptools import setup + +PACKAGE_NAME = 'fin_depo' + +with open('README.md') as f: + readme = f.read() + +def parse_version_file(text: str) -> str: + match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text) + if match is None: + msg = 'Malformed _version.py file!' + raise Exception(msg) + return match.group(2) + +with open(PACKAGE_NAME + '/_version.py') as f: + version = parse_version_file(f.read()) + +def parse_requirements(text: str) -> list[str]: + return text.strip().split('\n') + + +def read_requirements(path: str) -> list[str]: + with open(path) as f: + return parse_requirements(f.read()) + + +def determine_short_description(readme: str) -> str: + readme = re.sub(r'#+[^\n]*\n+', '', readme) + m = re.search(r'^\s*(\w+[\w\s,`+-]+\.)', readme) + try: + return m.group(1) + except AttributeError as err: + msg = f'Could not determine short description: {readme}' + raise Exception(msg) from err + + +REQUIREMENTS_MAIN = """ +enforce-typing +""" + +REQUIREMENTS_TEST = """ +pytest +""" + + +setup( + name=PACKAGE_NAME, + version=version, + description=determine_short_description(readme), + long_description=readme, + long_description_content_type='text/markdown', + author='Jmaa', + author_email='jonjmaa@gmail.com', + url='https://gitfub.space/Jmaa/' + PACKAGE_NAME, + packages=[PACKAGE_NAME], + install_requires=parse_requirements(REQUIREMENTS_MAIN), + extras_require={ + 'test': parse_requirements(REQUIREMENTS_TEST), + }, + python_requires='>=3.9', +) diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/test_data.py b/test/test_data.py new file mode 100644 index 0000000..77ef5d8 --- /dev/null +++ b/test/test_data.py @@ -0,0 +1,5 @@ +import pytest + +import fin_depo + +# TODO