From 0c07a9d59f5af06c107692d12b8a713958b0041d Mon Sep 17 00:00:00 2001 From: Elijas <4084885+Elijas@users.noreply.github.com> Date: Thu, 12 Oct 2023 04:52:09 +0300 Subject: [PATCH] feat: initial commit --- .github/workflows/deploy.yaml | 14 ++++ .github/workflows/test.yaml | 7 ++ .gitignore | 151 ++++++++++++++++++++++++++++++++++ LICENSE | 21 +++++ MANIFEST.in | 5 ++ README.md | 22 +++++ nbs/00_core.ipynb | 99 ++++++++++++++++++++++ nbs/_quarto.yml | 20 +++++ nbs/index.ipynb | 96 +++++++++++++++++++++ nbs/nbdev.yml | 9 ++ nbs/styles.css | 37 +++++++++ sec_downloader/__init__.py | 1 + sec_downloader/_modidx.py | 8 ++ sec_downloader/core.py | 7 ++ settings.ini | 43 ++++++++++ setup.py | 57 +++++++++++++ 16 files changed, 597 insertions(+) create mode 100644 .github/workflows/deploy.yaml create mode 100644 .github/workflows/test.yaml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 MANIFEST.in create mode 100644 README.md create mode 100644 nbs/00_core.ipynb create mode 100644 nbs/_quarto.yml create mode 100644 nbs/index.ipynb create mode 100644 nbs/nbdev.yml create mode 100644 nbs/styles.css create mode 100644 sec_downloader/__init__.py create mode 100644 sec_downloader/_modidx.py create mode 100644 sec_downloader/core.py create mode 100644 settings.ini create mode 100644 setup.py diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..29bfc57 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,14 @@ +name: Deploy to GitHub Pages + +permissions: + contents: write + pages: write + +on: + push: + branches: [ "main", "master" ] + workflow_dispatch: +jobs: + deploy: + runs-on: ubuntu-latest + steps: [uses: fastai/workflows/quarto-ghp@master] diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..5608592 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,7 @@ +name: CI +on: [workflow_dispatch, pull_request, push] + +jobs: + test: + runs-on: ubuntu-latest + steps: [uses: fastai/workflows/nbdev-ci@master] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5f112e2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,151 @@ +_docs/ +_proc/ + +*.bak +.gitattributes +.last_checked +.gitconfig +*.bak +*.log +*~ +~* +_tmp* +tmp* +tags +*.pkg + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# dotenv +.env + +# virtualenv +.venv +venv/ +ENV/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +.vscode +*.swp + +# osx generated files +.DS_Store +.DS_Store? +.Trashes +ehthumbs.db +Thumbs.db +.idea + +# pytest +.pytest_cache + +# tools/trust-doc-nbs +docs_src/.last_checked + +# symlinks to fastai +docs_src/fastai +tools/fastai + +# link checker +checklink/cookies.txt + +# .gitconfig is now autogenerated +.gitconfig + +# Quarto installer +.deb +.pkg + +# Quarto +.quarto diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4ef57d1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Elijas Dapšauskas + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..5c0e7ce --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,5 @@ +include settings.ini +include LICENSE +include CONTRIBUTING.md +include README.md +recursive-exclude * __pycache__ diff --git a/README.md b/README.md new file mode 100644 index 0000000..8cb04d2 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# sec-downloader + + + +This file will become your README and also the index of your +documentation. + +## Install + +``` sh +pip install sec_downloader +``` + +## How to use + +Fill me in please! Don’t forget code examples: + +``` python +1+1 +``` + + 2 diff --git a/nbs/00_core.ipynb b/nbs/00_core.ipynb new file mode 100644 index 0000000..9d45e96 --- /dev/null +++ b/nbs/00_core.ipynb @@ -0,0 +1,99 @@ +{ + "cells": [ + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# core" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "# | default_exp core" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "ename": "ModuleNotFoundError", + "evalue": "No module named 'sec_edgar_downloader'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[6], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[39m# | export\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39msec_edgar_downloader\u001b[39;00m \u001b[39mimport\u001b[39;00m Downloader\n", + "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'sec_edgar_downloader'" + ] + } + ], + "source": [ + "# | export\n", + "from sec_edgar_downloader import Downloader" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "# | hide\n", + "import jupyter_black\n", + "\n", + "jupyter_black.load()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "# | export\n", + "def foo():\n", + " pass" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "# | hide\n", + "import nbdev\n", + "\n", + "nbdev.nbdev_export()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "python3", + "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.10.12" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/nbs/_quarto.yml b/nbs/_quarto.yml new file mode 100644 index 0000000..0a6dfcb --- /dev/null +++ b/nbs/_quarto.yml @@ -0,0 +1,20 @@ +project: + type: website + +format: + html: + theme: cosmo + css: styles.css + toc: true + +website: + twitter-card: true + open-graph: true + repo-actions: [issue] + navbar: + background: primary + search: true + sidebar: + style: floating + +metadata-files: [nbdev.yml, sidebar.yml] \ No newline at end of file diff --git a/nbs/index.ipynb b/nbs/index.ipynb new file mode 100644 index 0000000..490c2e1 --- /dev/null +++ b/nbs/index.ipynb @@ -0,0 +1,96 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#| hide\n", + "from sec_downloader.core import *" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# sec-downloader\n", + "\n", + "> An enhanced version of sec-edgar-downloader with caching capabilities and in-memory data retrieval. Designed for efficient SEC EDGAR document processing." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This file will become your README and also the index of your documentation." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Install" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "```sh\n", + "pip install sec_downloader\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## How to use" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Fill me in please! Don't forget code examples:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2" + ] + }, + "execution_count": null, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1+1" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "python3", + "language": "python", + "name": "python3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/nbs/nbdev.yml b/nbs/nbdev.yml new file mode 100644 index 0000000..ed87fc6 --- /dev/null +++ b/nbs/nbdev.yml @@ -0,0 +1,9 @@ +project: + output-dir: _docs + +website: + title: "sec-downloader" + site-url: "https://Elijas.github.io/sec-downloader" + description: "An enhanced version of sec-edgar-downloader with caching capabilities and in-memory data retrieval. Designed for efficient SEC EDGAR document processing." + repo-branch: main + repo-url: "https://github.com/Elijas/sec-downloader" diff --git a/nbs/styles.css b/nbs/styles.css new file mode 100644 index 0000000..66ccc49 --- /dev/null +++ b/nbs/styles.css @@ -0,0 +1,37 @@ +.cell { + margin-bottom: 1rem; +} + +.cell > .sourceCode { + margin-bottom: 0; +} + +.cell-output > pre { + margin-bottom: 0; +} + +.cell-output > pre, .cell-output > .sourceCode > pre, .cell-output-stdout > pre { + margin-left: 0.8rem; + margin-top: 0; + background: none; + border-left: 2px solid lightsalmon; + border-top-left-radius: 0; + border-top-right-radius: 0; +} + +.cell-output > .sourceCode { + border: none; +} + +.cell-output > .sourceCode { + background: none; + margin-top: 0; +} + +div.description { + padding-left: 2px; + padding-top: 5px; + font-style: italic; + font-size: 135%; + opacity: 70%; +} diff --git a/sec_downloader/__init__.py b/sec_downloader/__init__.py new file mode 100644 index 0000000..f102a9c --- /dev/null +++ b/sec_downloader/__init__.py @@ -0,0 +1 @@ +__version__ = "0.0.1" diff --git a/sec_downloader/_modidx.py b/sec_downloader/_modidx.py new file mode 100644 index 0000000..73c9004 --- /dev/null +++ b/sec_downloader/_modidx.py @@ -0,0 +1,8 @@ +# Autogenerated by nbdev + +d = { 'settings': { 'branch': 'main', + 'doc_baseurl': '/sec-downloader', + 'doc_host': 'https://Elijas.github.io', + 'git_url': 'https://github.com/Elijas/sec-downloader', + 'lib_path': 'sec_downloader'}, + 'syms': {'sec_downloader.core': {'sec_downloader.core.foo': ('core.html#foo', 'sec_downloader/core.py')}}} diff --git a/sec_downloader/core.py b/sec_downloader/core.py new file mode 100644 index 0000000..6552cc5 --- /dev/null +++ b/sec_downloader/core.py @@ -0,0 +1,7 @@ +# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb. + +# %% auto 0 +__all__ = ['foo'] + +# %% ../nbs/00_core.ipynb 3 +def foo(): pass diff --git a/settings.ini b/settings.ini new file mode 100644 index 0000000..7e09199 --- /dev/null +++ b/settings.ini @@ -0,0 +1,43 @@ +[DEFAULT] +# All sections below are required unless otherwise specified. +# See https://github.com/fastai/nbdev/blob/master/settings.ini for examples. + +### Python library ### +repo = sec-downloader +lib_name = %(repo)s +version = 0.0.1 +min_python = 3.7 +license = apache2 +black_formatting = False + +### nbdev ### +doc_path = _docs +lib_path = sec_downloader +nbs_path = nbs +recursive = True +tst_flags = notest +put_version_in_init = True + +### Docs ### +branch = main +custom_sidebar = False +doc_host = https://%(user)s.github.io +doc_baseurl = /%(repo)s +git_url = https://github.com/%(user)s/%(repo)s +title = %(lib_name)s + +### PyPI ### +audience = Developers +author = Elijas +author_email = 4084885+Elijas@users.noreply.github.com +copyright = 2023 onwards, %(author)s +description = An enhanced version of sec-edgar-downloader with caching capabilities and in-memory data retrieval. Designed for efficient SEC EDGAR document processing. +keywords = nbdev jupyter notebook python +language = English +status = 3 +user = Elijas + +### Optional ### +# requirements = fastcore pandas +# dev_requirements = +# console_scripts = \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..e3281ae --- /dev/null +++ b/setup.py @@ -0,0 +1,57 @@ +from pkg_resources import parse_version +from configparser import ConfigParser +import setuptools, shlex +assert parse_version(setuptools.__version__)>=parse_version('36.2') + +# note: all settings are in settings.ini; edit there, not here +config = ConfigParser(delimiters=['=']) +config.read('settings.ini', encoding='utf-8') +cfg = config['DEFAULT'] + +cfg_keys = 'version description keywords author author_email'.split() +expected = cfg_keys + "lib_name user branch license status min_python audience language".split() +for o in expected: assert o in cfg, "missing expected setting: {}".format(o) +setup_cfg = {o:cfg[o] for o in cfg_keys} + +licenses = { + 'apache2': ('Apache Software License 2.0','OSI Approved :: Apache Software License'), + 'mit': ('MIT License', 'OSI Approved :: MIT License'), + 'gpl2': ('GNU General Public License v2', 'OSI Approved :: GNU General Public License v2 (GPLv2)'), + 'gpl3': ('GNU General Public License v3', 'OSI Approved :: GNU General Public License v3 (GPLv3)'), + 'bsd3': ('BSD License', 'OSI Approved :: BSD License'), +} +statuses = [ '1 - Planning', '2 - Pre-Alpha', '3 - Alpha', + '4 - Beta', '5 - Production/Stable', '6 - Mature', '7 - Inactive' ] +py_versions = '3.6 3.7 3.8 3.9 3.10'.split() + +requirements = shlex.split(cfg.get('requirements', '')) +if cfg.get('pip_requirements'): requirements += shlex.split(cfg.get('pip_requirements', '')) +min_python = cfg['min_python'] +lic = licenses.get(cfg['license'].lower(), (cfg['license'], None)) +dev_requirements = (cfg.get('dev_requirements') or '').split() + +setuptools.setup( + name = cfg['lib_name'], + license = lic[0], + classifiers = [ + 'Development Status :: ' + statuses[int(cfg['status'])], + 'Intended Audience :: ' + cfg['audience'].title(), + 'Natural Language :: ' + cfg['language'].title(), + ] + ['Programming Language :: Python :: '+o for o in py_versions[py_versions.index(min_python):]] + (['License :: ' + lic[1] ] if lic[1] else []), + url = cfg['git_url'], + packages = setuptools.find_packages(), + include_package_data = True, + install_requires = requirements, + extras_require={ 'dev': dev_requirements }, + dependency_links = cfg.get('dep_links','').split(), + python_requires = '>=' + cfg['min_python'], + long_description = open('README.md', encoding='utf-8').read(), + long_description_content_type = 'text/markdown', + zip_safe = False, + entry_points = { + 'console_scripts': cfg.get('console_scripts','').split(), + 'nbdev': [f'{cfg.get("lib_path")}={cfg.get("lib_path")}._modidx:d'] + }, + **setup_cfg) + +