Skip to content

Commit 13fb156

Browse files
Initial commit
0 parents  commit 13fb156

File tree

16 files changed

+616
-0
lines changed

16 files changed

+616
-0
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* @remarkablemark
2+
3+
/pyproject.toml

.github/CONTRIBUTING.md

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# Contributing
2+
3+
<details>
4+
<summary>Table of Contents</summary>
5+
6+
- [Fork](#fork)
7+
- [Install](#install)
8+
- [Develop](#develop)
9+
- [Test](#test)
10+
- [Lint](#lint)
11+
- [Build](#build)
12+
- [Release](#release)
13+
14+
</details>
15+
16+
Pull requests are welcome! By participating in this project, you agree to abide by our [code of conduct](https://github.com/remarkablemark/.github/blob/master/CODE_OF_CONDUCT.md).
17+
18+
## Fork
19+
20+
[Fork](https://github.com/remarkablemark/python_package_template/fork) and then clone the repository:
21+
22+
```sh
23+
# replace <USER> with your username
24+
git clone [email protected]:<USER>/python_package_template.git
25+
```
26+
27+
```sh
28+
cd python_package_template
29+
```
30+
31+
## Install
32+
33+
Install [Python](https://www.python.org/):
34+
35+
```sh
36+
brew install python
37+
```
38+
39+
Create the virtual environment:
40+
41+
```sh
42+
python3 -m venv .venv
43+
```
44+
45+
Activate the virtual environment:
46+
47+
```sh
48+
source .venv/bin/activate
49+
```
50+
51+
Install the dependencies:
52+
53+
```sh
54+
pip install -e '.[build]'
55+
pip install -e '.[test]'
56+
```
57+
58+
Install pre-commit into your git hooks:
59+
60+
```sh
61+
pre-commit install
62+
```
63+
64+
## Develop
65+
66+
Make your changes, add tests/documentation, and ensure tests pass:
67+
68+
```sh
69+
pytest
70+
```
71+
72+
Write a commit message that follows the [Conventional Commits](https://www.conventionalcommits.org/) specification:
73+
74+
- **feat**: A new feature
75+
- **fix**: A bug fix
76+
- **perf**: A code change that improves performance
77+
- **refactor**: A code change that neither fixes a bug nor adds a feature
78+
- **test**: Add missing tests or correct existing tests
79+
- **build**: Changes that affect the build system or external dependencies
80+
- **ci**: Updates configuration files and scripts for continuous integration
81+
- **docs**: Documentation only changes
82+
83+
Push to your fork and create a [pull request](https://github.com/remarkablemark/python_package_template/compare/).
84+
85+
At this point, wait for us to review your pull request. We'll try to review pull requests within 1-3 business days. We may suggest changes, improvements, and/or alternatives.
86+
87+
Things that will improve the chance that your pull request will be accepted:
88+
89+
- [ ] Write tests that pass [CI](https://github.com/remarkablemark/python_package_template/actions/workflows/test.yml).
90+
- [ ] Write solid documentation.
91+
- [ ] Write a good [commit message](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit).
92+
93+
## Test
94+
95+
Run the tests:
96+
97+
```sh
98+
pytest
99+
```
100+
101+
## Lint
102+
103+
Update pre-commit hooks to the latest version:
104+
105+
```sh
106+
pre-commit autoupdate
107+
```
108+
109+
Run all pre-commit hooks:
110+
111+
```sh
112+
pre-commit run --all-files
113+
```
114+
115+
Lint all files in the current directory:
116+
117+
```sh
118+
ruff check
119+
```
120+
121+
Format all files in the current directory:
122+
123+
```sh
124+
ruff format
125+
```
126+
127+
## Build
128+
129+
Generate distribution packages:
130+
131+
```sh
132+
python3 -m build
133+
```
134+
135+
Upload all of the archives under `dist`:
136+
137+
```sh
138+
twine upload --repository testpypi dist/*
139+
```
140+
141+
Install the package:
142+
143+
```sh
144+
pip install --index-url https://test.pypi.org/simple/ --no-deps python_package_template
145+
```
146+
147+
## Release
148+
149+
Release and publish are automated with [Release Please](https://github.com/googleapis/release-please).
150+
151+
[Add a new pending publisher to PyPI.](https://pypi.org/manage/account/publishing/)

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/working-with-dependabot/dependabot-options-reference
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: 'pip'
9+
directory: '/'
10+
schedule:
11+
interval: 'daily'
12+
13+
- package-ecosystem: 'github-actions'
14+
directory: '/'
15+
schedule:
16+
interval: 'daily'

.github/mergify.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pull_request_rules:
2+
- name: automatic merge for Dependabot pull requests
3+
conditions:
4+
- author=dependabot[bot]
5+
- check-success=commitlint
6+
- check-success=lint
7+
- check-success=test
8+
- 'title~=^build\(deps-dev\): bump '
9+
actions:
10+
merge:
11+
method: squash

.github/workflows/commitlint.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: commitlint
2+
on: [push, pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
commitlint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Commitlint
12+
uses: remarkablemark/commitlint@v1
13+
with:
14+
checkout: true

.github/workflows/lint.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: lint
2+
on: [push, pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Use Python
15+
uses: actions/setup-python@v5
16+
with:
17+
cache: pip
18+
python-version: 3
19+
20+
- name: Install dependencies
21+
run: pip install -e .[test]
22+
23+
- name: Run Black
24+
run: black --check .
25+
26+
- name: Run Ruff
27+
run: ruff check
28+
29+
- name: Run pre-commit
30+
run: pre-commit run --all-files
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: release-please
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
release-please:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
outputs:
14+
release_created: ${{ steps.release.outputs.release_created }}
15+
16+
steps:
17+
- name: Release Please
18+
uses: googleapis/release-please-action@v4
19+
id: release
20+
with:
21+
release-type: python
22+
23+
publish:
24+
runs-on: ubuntu-latest
25+
needs: release-please
26+
if: ${{ needs.release-please.outputs.release_created }}
27+
permissions:
28+
contents: read
29+
id-token: write
30+
environment:
31+
name: pypi
32+
url: https://pypi.org/p/python_package_template
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
38+
- name: Use Python
39+
uses: actions/setup-python@v5
40+
with:
41+
cache: pip
42+
python-version: 3
43+
44+
- name: Install dependencies
45+
run: python -m pip install build
46+
47+
- name: Build package
48+
run: python -m build
49+
50+
- name: Publish package to PyPI
51+
uses: pypa/gh-action-pypi-publish@v1

.github/workflows/test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: test
2+
on: [push, pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Use Python
15+
uses: actions/setup-python@v5
16+
with:
17+
cache: pip
18+
python-version: 3
19+
20+
- name: Install dependencies
21+
run: pip install -e .[test]
22+
23+
- name: Run pytest
24+
run: pytest

0 commit comments

Comments
 (0)