Skip to content

Commit 04cb9ff

Browse files
authored
Modernize repo (#29)
* Move contributing docs into .github/ and simplify them * Remove built docs, already in obvious location in repo * Align github configuration with other repos * Replace setup.py/setup.cfg by pyproject.toml * Switch to src layout * Rework makefile * Run 'make format' * Fix readme * Fix call to pytest and leverage pytest-cov * Add missing Github files * Fix code owners
1 parent 8bcd81e commit 04cb9ff

32 files changed

Lines changed: 891 additions & 768 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @mozilla-services/syseng-pod

.github/CONTRIBUTING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
How to contribute
2+
=================
3+
4+
Thanks for your interest in contributing to the python-autograph-utils project!
5+
6+
## Reporting Bugs
7+
8+
Report bugs at https://github.com/mozilla-services/python-autograph-utils/issues/new
9+
10+
If you are reporting a bug, please include:
11+
12+
- Any details about your local setup that might be helpful in troubleshooting.
13+
- Detailed steps to reproduce the bug or even a PR with a failing tests if you can.
14+
15+
16+
## Ready to contribute?
17+
18+
### Getting Started
19+
20+
- Fork the repo on GitHub and clone locally:
21+
22+
```bash
23+
git clone git@github.com:mozilla-services/python-autograph-utils.git
24+
git remote add {your_name} git@github.com:{your_name}/kinto-http.py.git
25+
```
26+
27+
## Testing
28+
29+
- `make test` to run all the tests
30+
31+
## Submitting Changes
32+
33+
```bash
34+
git checkout main
35+
git pull origin main
36+
git checkout -b issue_number-bug-title
37+
git commit # Your changes
38+
git push -u {your_name} issue_number-bug-title
39+
```
40+
41+
Then you can create a Pull-Request.
42+
Please create your pull-request as soon as you have at least one commit even if it has only failing tests. This will allow us to help and give guidance.
43+
44+
You will be able to update your pull-request by pushing commits to your branch.
45+
46+
47+
## Releasing
48+
49+
1. Create a release on Github on https://github.com/mozilla-services/python-autograph-utils/releases/new
50+
2. Create a new tag `X.Y.Z` (*This tag will be created from the target when you publish this release.*)
51+
3. Generate release notes
52+
4. Publish release

.github/SECURITY.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Security Policy
2+
3+
Mozilla has a [well-defined process for handling security vulnerabilities](https://www.mozilla.org/en-US/about/governance/policies/security-group/bugs/) based around responsible disclosure.
4+
5+
## Supported Versions
6+
7+
| Version | Supported |
8+
| ------- | ------------------ |
9+
| > 1.x | :white_check_mark: |
10+
| < 1.0 | :x: |
11+
12+
## Reporting a Vulnerability
13+
14+
If you believe you have found a Remote Settings related security vulnerability, you should visit the [Mozilla bug bounty program](https://www.mozilla.org/en-US/security/bug-bounty/) for information on how to submit them.

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 99
8+
groups:
9+
all-dependencies:
10+
update-types: ["minor", "patch"]
11+
- package-ecosystem: "github-actions"
12+
directory: "/"
13+
schedule:
14+
interval: weekly
15+
open-pull-requests-limit: 99
16+
groups:
17+
all-dependencies:
18+
update-types: ["major", "minor", "patch"]

.github/release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- dependabot
5+
categories:
6+
- title: Breaking Changes
7+
labels:
8+
- "breaking-change"
9+
- title: Bug Fixes
10+
labels:
11+
- "bug"
12+
- title: New Features
13+
labels:
14+
- "enhancement"
15+
- title: Documentation
16+
labels:
17+
- "documentation"
18+
- title: Dependency Updates
19+
labels:
20+
- "dependencies"
21+
- title: Other Changes
22+
labels:
23+
- "*"

.github/workflows/labels.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Force pull-requests label(s)
2+
3+
on:
4+
pull_request:
5+
types: [opened, labeled, unlabeled]
6+
jobs:
7+
pr-has-label:
8+
name: Will be skipped if labelled
9+
runs-on: ubuntu-latest
10+
if: ${{ join(github.event.pull_request.labels.*.name, ', ') == '' }}
11+
steps:
12+
- run: |
13+
echo 'Pull-request must have at least one label'
14+
exit 1

.github/workflows/lint.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
name: Build distribution 📦
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.x"
20+
21+
- name: Print environment
22+
run: |
23+
python --version
24+
25+
- name: Install pypa/build
26+
run: python3 -m pip install build
27+
28+
- name: Build a binary wheel and a source tarball
29+
run: python3 -m build
30+
31+
- name: Store the distribution packages
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: python-package-distributions
35+
path: dist/
36+
37+
publish-to-pypi:
38+
name: Publish Python 🐍 distribution 📦 to PyPI
39+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
40+
needs:
41+
- build
42+
runs-on: ubuntu-latest
43+
environment:
44+
name: release
45+
url: https://pypi.org/p/autograph-utils
46+
permissions:
47+
id-token: write
48+
steps:
49+
- name: Download all the dists
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: python-package-distributions
53+
path: dist/
54+
- name: Publish distribution 📦 to PyPI
55+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
1-
on:
2-
push:
3-
branches:
4-
- master
5-
pull_request:
1+
on: pull_request
62

7-
name: Test
83
jobs:
9-
chore:
10-
name: Run unit tests
4+
lint:
5+
name: Lint
116
runs-on: ubuntu-latest
127

138
steps:
14-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1510

16-
- uses: actions/setup-python@v2
11+
- uses: actions/setup-python@v5
12+
13+
- name: Run linting and formatting checks
14+
run: make lint
15+
16+
unit-tests:
17+
name: Unit tests
18+
runs-on: ubuntu-latest
19+
needs: lint
20+
strategy:
21+
matrix:
22+
python-version: ["3.8", "3.9", "3.10", "3.11"]
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v5
1729
with:
18-
python-version: "3.x"
19-
20-
- name: Setup virtualenv
21-
run: |
22-
pip install -U pip
23-
python3 -m venv .venv
24-
25-
- name: Print environment
26-
run: |
27-
source .venv/bin/activate
28-
python --version
29-
pip --version
30-
31-
- name: Install all dependencies
32-
run: |
33-
source .venv/bin/activate
34-
pip install -r requirements.txt
35-
pip install -r requirements_dev.txt
36-
37-
- name: Test
38-
run: |
39-
source .venv/bin/activate
40-
py.test
30+
python-version: ${{ matrix.python-version }}
31+
cache: pip
32+
33+
- name: Install dependencies
34+
run: make install
35+
36+
- name: Run unit tests
37+
run: make test

.isort.cfg

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)