Skip to content

Commit f94f1f8

Browse files
authored
base on py-template (#126)
The `py-template` was generalized out of this project. A lot of them share similar structure and framework, we should just use py-template now that is mature enough here.
1 parent 7ca4d5c commit f94f1f8

33 files changed

+551
-89
lines changed

.cruft.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"template": "https://github.com/iterative/py-template",
3+
"commit": "84a385c99003c39632dfe985bf0ca4ed08235f36",
4+
"context": {
5+
"cookiecutter": {
6+
"project_name": "scmrepo",
7+
"package_name": "scmrepo",
8+
"friendly_name": "scmrepo",
9+
"author": "Iterative",
10+
"email": "support@dvc.org",
11+
"github_user": "iterative",
12+
"version": "0.0.0",
13+
"copyright_year": "2022",
14+
"license": "Apache-2.0",
15+
"docs": "False",
16+
"short_description": "scmrepo",
17+
"development_status": "Development Status :: 4 - Beta",
18+
"_template": "https://github.com/iterative/py-template"
19+
}
20+
},
21+
"directory": null
22+
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/dependabot.yml

+13
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,23 @@ updates:
77
interval: "weekly"
88
labels:
99
- "maintenance"
10+
# Update via cruft
11+
ignore:
12+
- dependency-name: "mkdocs*"
13+
- dependency-name: "pytest*"
14+
- dependency-name: "pylint"
15+
- dependency-name: "mypy"
1016

1117
- directory: "/"
1218
package-ecosystem: "github-actions"
1319
schedule:
1420
interval: "weekly"
1521
labels:
1622
- "maintenance"
23+
# Update via cruft
24+
ignore:
25+
- dependency-name: "actions/checkout"
26+
- dependency-name: "actions/setup-python"
27+
- dependency-name: "pypa/gh-action-pypi-publish"
28+
- dependency-name: "codecov/codecov-action"
29+
- dependency-name: "peter-evans/create-pull-request"

.github/workflows/release.yaml

+20-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
name: Release
2+
23
on:
34
release:
45
types: [published]
6+
workflow_dispatch:
57

68
env:
79
FORCE_COLOR: "1"
@@ -10,15 +12,27 @@ jobs:
1012
release:
1113
runs-on: ubuntu-latest
1214
steps:
13-
- uses: actions/checkout@v3
15+
- name: Check out the repository
16+
uses: actions/checkout@v3
1417
with:
1518
fetch-depth: 0
16-
- name: Set up Python 3.7
19+
20+
- name: Set up Python 3.10
1721
uses: actions/setup-python@v4
1822
with:
19-
python-version: 3.7
20-
- run: pip install -U nox pip wheel
21-
- run: nox -s build
22-
- uses: pypa/gh-action-pypi-publish@release/v1
23+
python-version: '3.10'
24+
25+
- name: Upgrade pip and nox
26+
run: |
27+
pip install --upgrade pip nox
28+
pip --version
29+
nox --version
30+
31+
- name: Build package
32+
run: nox -s build
33+
34+
- name: Upload package
35+
if: github.event_name == 'release'
36+
uses: pypa/gh-action-pypi-publish@release/v1
2337
with:
2438
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/tests.yaml

+35-13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
name: Tests
2-
on: [push, pull_request]
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
38

49
env:
510
FORCE_COLOR: "1"
611

712
concurrency:
8-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
914
cancel-in-progress: true
1015

1116
jobs:
@@ -16,19 +21,36 @@ jobs:
1621
fail-fast: false
1722
matrix:
1823
os: [ubuntu-20.04, windows-latest, macos-latest]
19-
python-version: ['3.7', '3.8', '3.9', '3.10']
24+
pyv: ['3.8', '3.9', '3.10']
2025
include:
21-
- os: ubuntu-latest
22-
python-version: 'pypy3.8'
26+
- {os: ubuntu-latest, pyv: 'pypy3.8'}
27+
2328
steps:
24-
- uses: actions/checkout@v3
29+
- name: Check out the repository
30+
uses: actions/checkout@v3
2531
with:
2632
fetch-depth: 0
27-
- uses: actions/setup-python@v4
33+
34+
- name: Set up Python ${{ matrix.pyv }}
35+
uses: actions/setup-python@v4
2836
with:
29-
python-version: ${{ matrix.python-version }}
30-
- run: python -m pip install -U pip --user
31-
- run: pip install -U nox wheel
32-
- run: nox -s lint
33-
- run: nox -s tests-${{ matrix.python-version }} -- --slow --cov
34-
- run: nox -s build
37+
python-version: ${{ matrix.pyv }}
38+
39+
- name: Upgrade pip and nox
40+
run: |
41+
python -m pip install --upgrade pip nox
42+
pip --version
43+
nox --version
44+
45+
- name: Lint code and check dependencies
46+
continue-on-error: ${{ matrix.nox_pyv == '3.11' }}
47+
run: nox -s lint safety
48+
49+
- name: Run tests
50+
run: nox -s tests-${{ matrix.nox_pyv || matrix.pyv }} -- --slow --cov-report=xml
51+
52+
- name: Upload coverage report
53+
uses: codecov/codecov-action@v3.1.0
54+
55+
- name: Build package
56+
run: nox -s build
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Update template
2+
3+
on:
4+
schedule:
5+
- cron: '5 1 * * *' # every day at 01:05
6+
workflow_dispatch:
7+
8+
jobs:
9+
update:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out the repository
13+
uses: actions/checkout@v3
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.10'
19+
20+
- name: Update template via cruft
21+
id: update
22+
run: |
23+
pip install cruft
24+
cruft update -y
25+
echo "::set-output name=changes::$(git diff)"
26+
27+
- name: Create PR
28+
if: ${{ steps.update.outputs.changes != '' }}
29+
uses: peter-evans/create-pull-request@v4
30+
with:
31+
commit-message: update template
32+
title: update template

.pre-commit-config.yaml

+33-21
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,48 @@
1+
default_language_version:
2+
python: python3
13
repos:
2-
- hooks:
3-
- id: black
4-
language_version: python3
5-
repo: https://github.com/psf/black
4+
- repo: https://github.com/psf/black
65
rev: 22.6.0
6+
hooks:
7+
- id: black
78
- repo: https://github.com/pre-commit/pre-commit-hooks
89
rev: v4.3.0
910
hooks:
11+
- id: check-added-large-files
12+
- id: check-case-conflict
13+
- id: check-docstring-first
14+
- id: check-executables-have-shebangs
15+
- id: check-json
16+
- id: check-merge-conflict
1017
- id: check-toml
1118
- id: check-yaml
19+
- id: debug-statements
1220
- id: end-of-file-fixer
21+
- id: mixed-line-ending
22+
args: ['--fix=lf']
23+
- id: sort-simple-yaml
1324
- id: trailing-whitespace
14-
- hooks:
25+
- repo: https://github.com/codespell-project/codespell
26+
rev: v2.2.1
27+
hooks:
1528
- id: codespell
1629
args:
1730
- --ignore-words-list=cachable
18-
repo: https://github.com/codespell-project/codespell
19-
rev: v2.2.1
20-
- hooks:
21-
- id: isort
22-
language_version: python3
23-
repo: https://github.com/timothycrosley/isort
31+
- repo: https://github.com/asottile/pyupgrade
32+
rev: v2.37.3
33+
hooks:
34+
- id: pyupgrade
35+
- repo: https://github.com/PyCQA/isort
2436
rev: 5.10.1
25-
- hooks:
37+
hooks:
38+
- id: isort
39+
- repo: https://gitlab.com/pycqa/flake8
40+
rev: 5.0.4
41+
hooks:
2642
- id: flake8
27-
language_version: python3
2843
additional_dependencies:
29-
- flake8-bugbear
30-
- flake8-comprehensions
31-
- flake8-debugger
32-
- flake8-string-format
33-
- flake8-bandit
34-
- bandit<1.7.3
35-
repo: https://gitlab.com/pycqa/flake8
36-
rev: 3.9.2
44+
- flake8-broken-line==0.5.0
45+
- flake8-bugbear==22.8.23
46+
- flake8-comprehensions==3.10.0
47+
- flake8-debugger==4.1.2
48+
- flake8-string-format==0.3.0

CODE_OF_CONDUCT.rst

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
Contributor Covenant Code of Conduct
2+
====================================
3+
4+
Our Pledge
5+
----------
6+
7+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
8+
9+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
10+
11+
12+
Our Standards
13+
-------------
14+
15+
Examples of behavior that contributes to a positive environment for our community include:
16+
17+
- Demonstrating empathy and kindness toward other people
18+
- Being respectful of differing opinions, viewpoints, and experiences
19+
- Giving and gracefully accepting constructive feedback
20+
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
21+
- Focusing on what is best not just for us as individuals, but for the overall community
22+
23+
Examples of unacceptable behavior include:
24+
25+
- The use of sexualized language or imagery, and sexual attention or
26+
advances of any kind
27+
- Trolling, insulting or derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or email
30+
address, without their explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
Enforcement Responsibilities
35+
----------------------------
36+
37+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
38+
39+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
40+
41+
42+
Scope
43+
-----
44+
45+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
46+
47+
48+
Enforcement
49+
-----------
50+
51+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at support@dvc.org. All complaints will be reviewed and investigated promptly and fairly.
52+
53+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
54+
55+
56+
Enforcement Guidelines
57+
----------------------
58+
59+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
60+
61+
62+
1. Correction
63+
~~~~~~~~~~~~~
64+
65+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
66+
67+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
68+
69+
70+
2. Warning
71+
~~~~~~~~~~
72+
73+
**Community Impact**: A violation through a single incident or series of actions.
74+
75+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
76+
77+
78+
3. Temporary Ban
79+
~~~~~~~~~~~~~~~~
80+
81+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
82+
83+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
84+
85+
86+
4. Permanent Ban
87+
~~~~~~~~~~~~~~~~
88+
89+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
90+
91+
**Consequence**: A permanent ban from any sort of public interaction within the community.
92+
93+
94+
Attribution
95+
-----------
96+
97+
This Code of Conduct is adapted from the `Contributor Covenant <homepage_>`__, version 2.0,
98+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct/.
99+
100+
Community Impact Guidelines were inspired by `Mozilla’s code of conduct enforcement ladder <https://github.com/mozilla/inclusion>`__.
101+
102+
.. _homepage: https://www.contributor-covenant.org
103+
104+
For answers to common questions about this code of conduct, see the FAQ at
105+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

0 commit comments

Comments
 (0)