Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tongyx361 committed Jun 20, 2024
0 parents commit ae4aa6e
Show file tree
Hide file tree
Showing 21 changed files with 690 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -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]
35 changes: 35 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches: [main]

jobs:
test:
strategy:
fail-fast: true
matrix:
os: [ubuntu]
version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: fastai/workflows/nbdev-ci@master
with:
version: ${{ matrix.version }}
pre: 1
- name: test docs build
if: ${{ (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch') && matrix.version == '3.10' && matrix.os == 'ubuntu' }}
run: |
set -ux
wget -q $(curl https://latest.fast.ai/pre/quarto-dev/quarto-cli/linux-amd64.deb)
sudo dpkg -i quarto*.deb
nbdev_docs
if [ -f "_docs/index.html" ]; then
echo "docs built successfully."
else
echo "index page not found in rendered docs."
ls -la
ls -la _docs
exit 1
fi
156 changes: 156 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
*.out
data/
models/
logs/

_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
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/fastai/nbdev
rev: 2.2.10
hooks:
- id: nbdev_clean
- id: nbdev_export
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2024 Yuxuan Tong

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.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include settings.ini
include LICENSE
include CONTRIBUTING.md
include README.md
recursive-exclude * __pycache__
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# `nbdev` Template @tongyx361


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Setup

We recommend:

- using [Conda](https://docs.conda.io/projects/miniconda) to set up the
**basic Python environment** and install some **non-Python packages**
like `git-lfs` when **without the root permission**;
- using [`pip`](https://pip.pypa.io/en/stable/#) to manage the **Python
packages** because some packages are **only available via `pip`**.

Run the following commands to setup the **basic environment** and
**install most dependencies**:

``` shell
git clone https://github.com/tongyx361/nbdev-template-tongyx361.git
cd nbdev-template-tongyx361
# Configure settings.ini, environment.yml, pkg_name
conda env create -f environment.yml
conda activate myenv
pip install -r requirements.txt
```

For common users/developers, please just run the following command the
install the `dart-math` package:

``` shell
pip install -e "."
```

For intended contributors, we recommend installing the package with the
`dev` extras and setting up the pre-commit hooks by running:

``` shell
pip install -e ".[dev]"
pre-commit install
```

## Contribution Guidelines

### File Structure

nbdev_template_tongyx361
├── data
├── utils # Repository utilities
├── pkg_name # Package code for common utilities
├── nbs # Notebooks and other files to run tests and generate documentation with https://nbdev.fast.ai
├── [pipelines] # Reusable (Python / Shell) scripts or notebooks
└── [scripts] # One-time scripts

### Checklist Before Commit

Run the [`prepare-commit.sh`](utils/prepare-commit.sh) to clean the
notebooks and export scripts for pipeline notebooks, generate
documentation, run tests, render README if needed:

bash utils/prepare-commit.sh
10 changes: 10 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: myenv
channels:
- pytorch
- nvidia
- huggingface
- fastai
- conda-forge
- defaults
dependencies:
- python=3.11
74 changes: 74 additions & 0 deletions nbs/00_core.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# core\n",
"\n",
"> Fill in a module description here\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# | default_exp core"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# | hide\n",
"from nbdev.showdoc import *"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# | export\n",
"def foo():\n",
" pass"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# | hide\n",
"import nbdev\n",
"\n",
"nbdev.nbdev_export()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "python3",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit ae4aa6e

Please sign in to comment.