Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
calico-1226 committed Jun 13, 2024
0 parents commit a9520cd
Show file tree
Hide file tree
Showing 26 changed files with 2,857 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[flake8]
max-line-length = 120
max-doc-length = 100
select = B,C,E,F,W,Y,SIM
ignore =
# E203: whitespace before ':'
# E241: whitespace after ':'
# E704: multiple statements on one line (def)
# W503: line break before binary operator
# W504: line break after binary operator
# format by black
E203,E241,E704,W503,W504,
# E501: line too long
# W505: doc line too long
# too long docstring due to long example blocks
E501,W505,
per-file-ignores =
# F401: module imported but unused
# intentionally unused imports
__init__.py: F401
# E301: expected 1 blank line
# E302: expected 2 blank lines
# E305: expected 2 blank lines after class or function definition
# E701: multiple statements on one line (colon)
# E704: multiple statements on one line (def)
# format by black
*.pyi: E301,E302,E305,E701,E704
exclude =
.git,
.vscode,
venv,
third-party,
__pycache__,
docs/source/conf.py,
build,
dist,
examples,
tests
132 changes: 132 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: 🐛 Bug Report
description: File an issue about a bug.
title: "[BUG] "
labels: [bug]
body:
- type: markdown
attributes:
value: |
Please do your best to make the issue as easy to act on as possible, and only submit here if there is clearly a problem with SafeSora (ask in [Discussions](https://github.com/PKU-Alignment/safe-sora/discussions) first if unsure).
- type: checkboxes
id: steps
attributes:
label: Required prerequisites
description: Make sure you've completed the following steps before submitting your issue -- thank you!
options:
- label: I have read the documentation. # <https://safe-sora.readthedocs.io>.
required: true
- label: I have searched the [Issue Tracker](https://github.com/PKU-Alignment/safe-sora/issues) and [Discussions](https://github.com/PKU-Alignment/safe-sora/discussions) that this hasn't already been reported. (+1 or comment there if it has.)
required: true
- label: Consider asking first in a [Discussion](https://github.com/PKU-Alignment/safe-sora/discussions/new).
required: false

- type: input
id: version
attributes:
label: What version of SafeSora are you using?
description: Run command `python3 -c 'print(__import__("safe_sora").__version__)'` in your shell and paste the output here.
placeholder: E.g., 0.1.0
validations:
required: true

- type: textarea
id: system-info
attributes:
label: System information
description: |
Describe the characteristic of your environment:
- Describe how the library was installed (pip, conda, source, ...)
- Python version
- Versions of any other relevant libraries
```python
import sys, safe_sora
print(sys.version, sys.platform)
print(safe_sora.__version__)
```
validations:
required: true

- type: textarea
id: description
attributes:
label: Problem description
description: >-
Provide a short description, state the expected behavior and what actually happens. Include
relevant information like what version of SafeSora you are using, what system you are on,
and any useful commands / output.
validations:
required: true

- type: textarea
id: code
attributes:
label: Reproducible example code
description: >-
The code should be minimal, have minimal external dependencies, and isolate the functions
that cause breakage. Submit matched and complete snippets that can be easily run to diagnose
the issue.
value: |
The Python snippets:
```python
```
Command lines:
```bash
```
Extra dependencies:
```text
```
Steps to reproduce:
1.
2.
3.
validations:
required: true

- type: textarea
id: traceback
attributes:
label: Traceback
description: Put the Python traceback information here.
placeholder: |
Traceback (most recent call last):
File ...
render: pytb

- type: textarea
id: expected
attributes:
label: Expected behavior
description: Provide a clear and concise description of what you expected to happen.

- type: textarea
id: additional-context
attributes:
label: Additional context
description: >-
Add any other context about the problem here. Screenshots may also be helpful.
If you know or suspect the reason for this bug, paste the code lines and suggest modifications.
- type: checkboxes
id: post-steps
attributes:
label: Checklist
description: Make sure you've completed the following steps before submitting your issue -- thank you!
options:
- label: I have provided all relevant and necessary information above.
required: true
- label: I have chosen a suitable title for this issue.
required: true
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: 💬 Start a discussion
url: https://github.com/PKU-Alignment/safe-sora/discussions/new
about: Please ask and answer questions here if unsure.
56 changes: 56 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: ✨ Feature Request
description: Suggest an idea for this project.
title: "[Feature Request] "
labels: [enhancement]
body:
- type: checkboxes
id: steps
attributes:
label: Required prerequisites
description: Make sure you've completed the following steps before submitting your issue -- thank you!
options:
- label: I have searched the [Issue Tracker](https://github.com/PKU-Alignment/safe-sora/issues) and [Discussions](https://github.com/PKU-Alignment/safe-sora/discussions) that this hasn't already been reported. (+1 or comment there if it has.)
required: true
- label: Consider asking first in a [Discussion](https://github.com/PKU-Alignment/safe-sora/discussions/new).
required: false

- type: textarea
id: motivation
attributes:
label: Motivation
description: Outline the motivation for the proposal.
value: |
<!-- Please outline the motivation for the proposal.
Is your feature request related to a problem? E.g., "I'm always frustrated when [...]".
If this is related to another issue, please link here too. -->
validations:
required: true

- type: textarea
id: solution
attributes:
label: Solution
description: Provide a clear and concise description of what you want to happen.

- type: textarea
id: alternatives
attributes:
label: Alternatives
description: A clear and concise description of any alternative solutions or features you've considered.

- type: textarea
id: additional-context
attributes:
label: Additional context
description: Add any other context about the problem here. Screenshots may also be helpful.

- type: checkboxes
id: post-steps
attributes:
label: Checklist
description: Make sure you've completed the following steps before submitting your issue -- thank you!
options:
- label: I have provided all relevant and necessary information above.
required: true
- label: I have chosen a suitable title for this issue.
required: true
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/questions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 🤔 Questions / Help / Support
description: Do you need support?
title: "[Question] "
labels: [question]
body:
- type: checkboxes
id: steps
attributes:
label: Required prerequisites
description: Make sure you've completed the following steps before submitting your issue -- thank you!
options:
- label: I have read the documentation. # <https://safe-sora.readthedocs.io>.
required: true
- label: I have searched the [Issue Tracker](https://github.com/PKU-Alignment/safe-sora/issues) and [Discussions](https://github.com/PKU-Alignment/safe-sora/discussions) that this hasn't already been reported. (+1 or comment there if it has.)
required: true
- label: Consider asking first in a [Discussion](https://github.com/PKU-Alignment/safe-sora/discussions/new).
required: false

- type: textarea
id: questions
attributes:
label: Questions
description: Describe your questions with relevant resources such as snippets, links, images, etc.
validations:
required: true

- type: checkboxes
id: post-steps
attributes:
label: Checklist
description: Make sure you've completed the following steps before submitting your issue -- thank you!
options:
- label: I have provided all relevant and necessary information above.
required: true
- label: I have chosen a suitable title for this issue.
required: true
33 changes: 33 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Description

Describe your changes in detail.

## Motivation and Context

Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
You can use the syntax `close #15213` if this solves the issue #15213

- [ ] I have raised an issue to propose this change ([required](https://github.com/PKU-Alignment/safe-sora/issues) for new features and bug fixes)

## Types of changes

What types of changes does your code introduce? Put an `x` in all the boxes that apply:

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds core functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation (update in the documentation)

## Checklist

Go over all the following points, and put an `x` in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

<!-- - [ ] I have read the [CONTRIBUTION](https://safe-sora.readthedocs.io/en/latest/developer/contributing.html) guide. (**required**) -->
- [ ] My change requires a change to the documentation.
- [ ] I have updated the tests accordingly. (*required for a bug fix or a new feature*)
- [ ] I have updated the documentation accordingly.
- [ ] I have reformatted the code using `make format`. (**required**)
- [ ] I have checked the code using `make lint`. (**required**)
- [ ] I have ensured `make test` pass. (**required**)
65 changes: 65 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Lint

on:
push:
branches:
- main
pull_request:
# Allow to trigger the workflow manually
workflow_dispatch:

permissions:
contents: read

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
fetch-depth: 1

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
update-environment: true

- name: Upgrade pip
run: |
python -m pip install --upgrade pip setuptools
- name: Install safe-sora
run: |
python -m pip install -vvv --editable '.[lint]'
- name: pre-commit
run: |
make pre-commit
- name: ruff
run: |
make ruff
- name: flake8
run: |
make flake8
- name: pylint
run: |
make pylint
- name: isort and black
run: |
make py-format
- name: addlicense
run: |
make addlicense
Loading

0 comments on commit a9520cd

Please sign in to comment.