Skip to content

Commit

Permalink
checkpoint commit
Browse files Browse the repository at this point in the history
  • Loading branch information
patel-zeel committed Aug 2, 2024
1 parent d2ab881 commit 1215764
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 158 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
- push
- pull_request

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --no-cache-dir -U -r requirements-dev.txt | cat
pip install -e .
pip install pytest pytest-cov coveralls
- name: Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true
run: |
pytest -v --cov=box --cov-report term-missing
coveralls --service=github
coveralls:
name: Finish coverage
needs: test
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
162 changes: 4 additions & 158 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,160 +1,6 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.vscode
*.ipynb_checkpoints
*.pyc
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# 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/
.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
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
box/_version.py
23 changes: 23 additions & 0 deletions box/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from ._version import version as __version__ # noqa

base_libraries = """
# Config
import os
# Basic
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Monitoring
from tqdm.notebook import tqdm
# IO
from os.path import join, exists, basename, dirname
from glob import glob
# Parallel processing
from joblib import Parallel, delayed
"""

print(base_libraries)
10 changes: 10 additions & 0 deletions box/torch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from box import base_libraries

torch_libraries = f"""{base_libraries}
# torch
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader, TensorDataset, random_split
"""
17 changes: 17 additions & 0 deletions box/vision.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from box import base_libraries

vision_libraries = f"""{base_libraries}
# PIL
from PIL import Image
# torch
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
import torchvision.transforms as transforms
import torchvision.models as models
"""

print(vision_libraries)
83 changes: 83 additions & 0 deletions lab/test.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# Monitoring\n",
"from tqdm.notebook import tqdm\n",
"\n",
"# IO\n",
"import os\n",
"from os.path import join, exists, basename, dirname\n",
"from glob import glob\n",
"\n",
"# Parallel processing\n",
"from joblib import Parallel, delayed\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# Monitoring\n",
"from tqdm.notebook import tqdm\n",
"\n",
"# IO\n",
"import os\n",
"from os.path import join, exists, basename, dirname\n",
"from glob import glob\n",
"\n",
"# Parallel processing\n",
"from joblib import Parallel, delayed\n",
"\n",
"# PIL\n",
"from PIL import Image\n",
"\n",
"# torch\n",
"import torch\n",
"import torch.nn as nn\n",
"import torch.optim as optim\n",
"import torch.nn.functional as F\n",
"from torch.utils.data import Dataset, DataLoader\n",
"import torchvision.transforms as transforms\n",
"import torchvision.models as models\n",
"\n"
]
}
],
"source": [
"from box import vision"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "zeel_py310",
"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": 2
}
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[build-system]
requires = [
"setuptools>=50.0",
"setuptools_scm[toml]>=6.0",
"setuptools_scm_git_archive",
"wheel>=0.33",
"numpy>=1.16",
"cython>=0.29",
]

[tool.setuptools_scm]
write_to = "box/_version.py"
9 changes: 9 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[metadata]
name = box
author = Zeel B Patel
author-email = [email protected]
description = example description
url = https://github.com/patel-zeel/box
license = MIT
long_description_content_type = text/markdown
long_description = file: README.md

0 comments on commit 1215764

Please sign in to comment.