Skip to content

Commit

Permalink
initial release of chai-1
Browse files Browse the repository at this point in the history
show one more parameter

exclude folders from pypi package build

add workflow to auto-deploy to pypi on tag creation

improve docstring

merge changes from chai-internal
  • Loading branch information
arogozhnikov committed Sep 9, 2024
0 parents commit 551edc3
Show file tree
Hide file tree
Showing 101 changed files with 9,693 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "ChaiLab",
"build": {
"context": "..",
"dockerfile": "../Dockerfile.chailab",
"target": "chailab-baseimage"
},
"runArgs": [
// by default use all GPUs, can be overriden by envvar
"--gpus=${localEnv:DEVBOX_GPU_SPEC:all}",
"--ipc=host",
"-v=/data/instance:/data/instance",
// default container name is chai-lab-container
"--name=chai-lab-${localEnv:DEVBOX_USER:container}",
// set restrictions on CPU and RAM memory usage
"--cpus=60.0",
"--memory=1000g"
],
"shutdownAction": "none",
"postCreateCommand": "uv pip install -e . && pre-commit install -f",
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "/opt/venv/bin/python"
},
"extensions": [
"ms-azuretools.vscode-docker",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.mypy-type-checker",
"charliermarsh.ruff",
"ms-toolsai.jupyter",
"arianjamasb.protein-viewer",
"redhat.vscode-yaml",
// very optional git-specific stuff
"arturock.gitstash",
"mhutchie.git-graph",
"GitHub.vscode-pull-request-github"
]
}
}
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
9 changes: 9 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Description
<!--- Describe your changes in detail -->

## Motivation
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## Test plan
<!--- Please describe in detail how you tested your changes. -->
27 changes: 27 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Mypy
on:
# Triggered whenever a commit is added to the main branch
push:
branches:
- main
# Triggered whenever a PR is opened or updated
pull_request:
jobs:
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: |
# install uv and cpu-only torch
pip install --no-deps uv -r <( cat requirements.in | grep torch) --extra-index-url https://download.pytorch.org/whl/cpu
# install requirements, except torch and potentially nvidia-related stuff
uv pip install --system -r <( cat requirements.in | grep -v nvidia | grep -v torch )
uv pip install --system --no-deps -e .
- name: Run mypy
run: mypy .
27 changes: 27 additions & 0 deletions .github/workflows/prettier_yaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Prettier

on:
# Triggered whenever a commit is added to the main branch
push:
branches:
- main
# Triggered whenever a PR is opened or updated
pull_request:
jobs:
yaml:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: npm install --save-dev --save-exact prettier

- name: Run Prettier to check YAML format
run: npx prettier --check "**/*.yml" "**/*.yaml"
27 changes: 27 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy to pypi

on:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
pip install . && pip install hatch
- name: Publish to PyPi
env:
HATCH_INDEX_USER: "__token__"
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
run: |
hatch build --clean && hatch publish
27 changes: 27 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Ruff
on:
# Triggered whenever a commit is added to the main branch
push:
branches:
- main
# Triggered whenever a PR is opened or updated
pull_request:
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install
run: pip install pre-commit
- name: Run pre-commit checks on all files
# run specific ruff pre-commit hooks on all files
run: >
pip install pre-commit
&& pre-commit install -f
&& pre-commit run ruff --all-files
&& pre-commit run ruff-format --all-files
162 changes: 162 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# 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/
*.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/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# 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
.idea/

# outputs from the model
outputs/

10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.3
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
15 changes: 15 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// We use Dev Containers to run the code in a container. As a result,
// VS Code runs extensions in one of two places: locally on the UI /
// client side, or in the container. When adding extensions, take care
// to ensure you add them to the right list: container extensions should
// be added to the list in ../.devcontainer/devcontainer.json, and UI
// extensions should be added to the list below. See
// https://code.visualstudio.com/docs/devcontainers/containers#_managing-extensions
{
"recommendations": [
"ms-vscode-remote.remote-containers",
"ms-vscode-remote.remote-ssh",
"ms-vscode-remote.remote-ssh-edit",
"ms-vscode.remote-explorer"
]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"python.analysis.autoImportCompletions": true,
"terminal.integrated.scrollback": 30000,
"mypy-type-checker.cwd": "${workspaceFolder}",
// pytest setup
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
}
Loading

0 comments on commit 551edc3

Please sign in to comment.