Skip to content

Commit

Permalink
Initial commit (version 0.1).
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaimorariu committed Aug 17, 2021
0 parents commit f201f34
Show file tree
Hide file tree
Showing 179 changed files with 10,190 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# from https://github.com/facebookresearch/pytorch3d/blob/master/.clang-format
AccessModifierOffset: -1
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: [ FOR_EACH, FOR_EACH_R, FOR_EACH_RANGE, ]
IncludeCategories:
- Regex: '^<.*\.h(pp)?>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# from https://github.com/facebookresearch/pytorch3d/blob/master/.flake8

[flake8]
ignore = E203, E266, E501, W503, E221
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9
exclude = build,__init__.py
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Bug report
about: Create a report to help us improve
title: "[bug] "
labels: bug, normal priority, size-XS
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment information**
Add information about the environment that can be used to reproduce this bug (i.e., Docker image, commit number etc.).

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[feature] "
labels: enhancement, normal priority, size-XS
assignees: ''

---

**Describe the requested feature**
A clear and concise description of the requested feature.

**Tasks to be completed**
- [ ] TODO

**Definition of Done**
A clear and concise description of the conditions for marking the issue as completed.

**Additional context**
Add any other context or screenshots about the feature request here.
131 changes: 131 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# 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/
pip-wheel-metadata/
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/

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

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.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

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__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/

.idea/
7 changes: 7 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[isort]
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
ensure_newline_before_comments = True
line_length = 88
22 changes: 22 additions & 0 deletions .pfnci/checks.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash -e

function run_unit_tests() {
export PYTHONPATH=$(pwd):$PYTHONPATH
python3 tests/run_tests.py
}

function run_lint_check() {
bash .pfnci/linter.bash
}

function run_install_check() {
python3 setup.py install --user
}

function run_all_checks() {
run_unit_tests
run_lint_check
run_install_check
}

run_all_checks
16 changes: 16 additions & 0 deletions .pfnci/config.pbtxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
configs {
key: "pynif3d"
value {
requirement {
cpu: 8
memory: 32
disk: 16
gpu: 1
image: "imosci"
}
time_limit {
seconds: 1800
}
command: "bash .pfnci/run_all.bash"
}
}
23 changes: 23 additions & 0 deletions .pfnci/linter.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Make a copy of the current directory.
root_dir="$(pwd .)"
lint_dir="${root_dir}.lint"
cp -r "$root_dir" "$lint_dir"

# Run the lint checks. On error, terminate the script.
cd "$lint_dir" || exit 1
bash ./dev/linter.sh
exit_code=$?
echo "exit_code of linter is $exit_code"
[ $exit_code -eq 0 ] || exit 1
cd "$root_dir" || (echo "root_dir $root_dir cannot be accessed" && exit 1)

# Compare the files recursively and capture the exit code.
diff -qr "$root_dir" "$lint_dir"
exit_code=$?
echo "exit_code for diff command is $exit_code"

# Clean-up.
rm -rf "$lint_dir"
exit "$exit_code"
36 changes: 36 additions & 0 deletions .pfnci/run_all.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Set up some useful variables.
docker_url="asia.gcr.io/pfn-public-ci/pynif3d"
container_name="flexci"

# Grant access to the Docker registry.
service docker stop
mount -t tmpfs tmpfs /var/lib/docker -o size=100%
service docker start
gcloud auth configure-docker

# Create container and copy the current source code.
docker pull "$docker_url"
docker create --name="$container_name" -it "$docker_url"
docker start "$container_name"
docker cp . "$container_name":/tmp/"$container_name"

# Run the tests and capture the exit code.
docker exec -e PYTHONPATH=/tmp/"$container_name"/.pfnci \
-e CI_JOB_URL="$CI_JOB_URL" \
-e CI_JOB_ID="$CI_JOB_ID" \
-e CI_PROJECT_NAME="$CI_PROJECT_NAME" \
-w /tmp/"$container_name" \
"$container_name" \
bash -c "bash .pfnci/checks.bash"
exit_code=$?

echo "docker exit_code is $exit_code"

# Clean-up.
docker stop "$container_name"
docker rm "$container_name"

# Return the exit code, so that the job is marked as "Failed" on the CI's page, in case of failure.
exit "$exit_code"
Loading

0 comments on commit f201f34

Please sign in to comment.