Skip to content

Commit

Permalink
Initial code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gluon-ts-dev authored and Alexander Alexandrov committed May 17, 2019
1 parent 443fa28 commit c4501f6
Show file tree
Hide file tree
Showing 69 changed files with 6,622 additions and 0 deletions.
102 changes: 102 additions & 0 deletions .devtools/githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/usr/bin/env python3

# Standard library imports
import os
import sys
import textwrap
from pathlib import Path
from subprocess import CalledProcessError, check_output

# Third-party imports
import flake8.main.git


def type_check() -> int:
mypy_opts = ['--follow-imports=silent', '--ignore-missing-imports']
mypy_args = [
str(p.parent.resolve())
for p in Path(__file__).parents[2].glob('**/.typesafe')
]

try:
check_output(['mypy'] + mypy_opts + mypy_args)
return 0
except CalledProcessError as e:
print(e.output.decode().strip())

print(
textwrap.dedent(
f'''
Mypy command
mypy {" ".join(mypy_opts + mypy_args)}
returned a non-zero exit code. Fix the type errors listed above
and then run
python setup.py type_check
in order to validate your fixes.
'''
).lstrip(),
file=sys.stderr,
)

return e.returncode


def style_check() -> int:
git_root = (
check_output(['git', 'rev-parse', '--show-toplevel']).decode().strip()
)
git_files = (
check_output(['git', 'diff', '--name-only', '--cached'])
.decode()
.strip()
.split()
)

black_opts = []
black_args = [
os.path.join(git_root, git_file)
for git_file in git_files
if git_file.endswith('.py') and os.path.isfile(git_file)
]

try:
check_output(['black'] + ['--check'] + black_opts + black_args)
return 0
except CalledProcessError as e:
print(
textwrap.dedent(
f'''
Black command
black {" ".join(['--check'] + black_opts + black_args)}
returned a non-zero exit code. Fix the files listed above with
black {" ".join(black_opts + black_args)}
and then run
python setup.py style_check
in order to validate your fixes.
'''
).lstrip(),
file=sys.stderr,
)

return e.returncode


def flake8_check() -> int:
return flake8.main.git.hook(
strict=flake8.main.git.config_for('strict'),
lazy=flake8.main.git.config_for('lazy'),
)


if __name__ == '__main__':
sys.exit(type_check() | style_check() | flake8_check())
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
140 changes: 140 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
*.pyc
*.pyo
*.class
*~
*#
/docs/api/*
/docs/_build
/runpy
/build
.coverage*
**/.idea
**/.history
**/.cache
**/.eggs
*.egg
*.egg-info
.*.swp
.mypy_cache
.pytest_cache
tags
__pycache__
/gluonts/version*.py

# 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/
pip-wheel-metadata/
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
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
docs/gluonts

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# 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/
4 changes: 4 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.
61 changes: 61 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Contributing Guidelines

Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.

Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.


## Reporting Bugs/Feature Requests

We welcome you to use the GitHub issue tracker to report bugs or suggest features.

When filing an issue, please check [existing open](https://github.com/awslabs/gluon-ts/issues), or [recently closed](https://github.com/awslabs/gluon-ts/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:

* A reproducible test case or series of steps
* The version of our code being used
* Any modifications you've made relevant to the bug
* Anything unusual about your environment or deployment


## Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:

1. You are working against the latest source on the *master* branch.
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.

To send us a pull request, please:

1. Fork the repository.
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
3. Ensure local tests pass.
4. Commit to your fork using clear commit messages.
5. Send us a pull request, answering any default questions in the pull request interface.
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).


## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/awslabs/gluon-ts/labels/help%20wanted) issues is a great place to start.


## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.


## Security issue notifications
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.


## Licensing

See the [LICENSE](https://github.com/awslabs/gluon-ts/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.

We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
Loading

0 comments on commit c4501f6

Please sign in to comment.