Skip to content

Commit

Permalink
Modernize repo (#365)
Browse files Browse the repository at this point in the history
* Modernize repository

* Move code to src/ and tests/ out of src/

* Run 'make format'

* Add blame ignore file

* Force labels on pull-requests

* Try switching to parallel jobs for coveralls

* Revert "Try switching to parallel jobs for coveralls" because too noisy in status report

This reverts commit 014ee46.

* Remove useless omit now that tests are outside

* Polish contributing docs

* Fix RST link
  • Loading branch information
leplatrem authored Jan 29, 2024
1 parent 2da3d15 commit 11f18b9
Show file tree
Hide file tree
Showing 50 changed files with 284 additions and 326 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Move code to src/ and tests/ out of src/
d2af34d337ad5b9a2ced39847701ef5d040495fe
# Switch to ruff
458e0233aeea155ed4be0cb2c42b980dc8cbbc36
3 changes: 3 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Code of conduct

This repository is governed by Mozilla's code of conduct and etiquette guidelines. For more details please see the [Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/) and [Developer Etiquette Guidelines](https://bugzilla.mozilla.org/page.cgi?id=etiquette.html).
44 changes: 19 additions & 25 deletions CONTRIBUTING.md → .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
How to contribute
=================

Thanks for your interest in contributing to Kinto!
Thanks for your interest in contributing to the Kinto client!

## Reporting Bugs

Expand All @@ -15,43 +15,29 @@ If you are reporting a bug, please include:

## Ready to contribute?

### System Requirements

Depending on the platform and chosen configuration, some libraries or extra services are required.

The following commands will install necessary tools for cryptography and Python packaging like Virtualenv.
### Getting Started

#### Linux
On Debian / Ubuntu based systems:
- Fork the repo on GitHub and clone locally:

```bash
apt-get install libffi-dev libssl-dev python-dev python-virtualenv
git clone [email protected]:Kinto/kinto-http.py.git
git remote add {your_name} [email protected]:{your_name}/kinto-http.py.git
```

#### OS X
Assuming [brew](http://brew.sh/) is installed:
Optionally, configure `git` to use `.git-blame-ignore-revs` to remove noisy commits from `git blame` (e.g. running formatters or moving files):

```bash
brew install libffi openssl pkg-config python
::

pip install virtualenv
```

### Getting Started
git config blame.ignoreRevsFile .git-blame-ignore-revs

- Fork the repo on GitHub and clone locally:

```bash
git clone [email protected]:Kinto/kinto-http.py.git
git remote add {your_name} [email protected]:{your_name}/kinto-http.py.git
```

## Testing

- `make tests-once` to run the tests with the current venv.
- `make tests` to run all the tests (with python3, flake8, and functional tests)
- Run `make run-kinto` in a separate terminal

- `make tests` to run all the tests

You may need to use `make run-kinto` before running the functional tests.
If you want to run the functional tests only, you can use `make functional`.

## Submitting Changes
Expand All @@ -68,3 +54,11 @@ Then you can create a Pull-Request.
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.

You will be able to update your pull-request by pushing commits to your branch.


## Releasing

1. Create a release on Github on https://github.com/Kinto/kinto-http.py/releases/new
2. Create a new tag `X.Y.Z` (*This tag will be created from the target when you publish this release.*)
3. Generate release notes
4. Publish release
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ updates:
groups:
all-dependencies:
update-types: ["major", "minor", "patch"]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 99
groups:
all-dependencies:
update-types: ["major", "minor", "patch"]
23 changes: 23 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
changelog:
exclude:
authors:
- dependabot
categories:
- title: Breaking Changes
labels:
- "breaking-change"
- title: Bug Fixes
labels:
- "bug"
- title: New Features
labels:
- "enhancement"
- title: Documentation
labels:
- "documentation"
- title: Dependency Updates
labels:
- "dependencies"
- title: Other Changes
labels:
- "*"
14 changes: 14 additions & 0 deletions .github/workflows/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Force pull-requests label(s)

on:
pull_request:
types: [opened, labeled, unlabeled]
jobs:
pr-has-label:
name: Will be skipped if labelled
runs-on: ubuntu-latest
if: ${{ join(github.event.pull_request.labels.*.name, ', ') == '' }}
steps:
- run: |
echo 'Pull-request must have at least one label'
exit 1
34 changes: 0 additions & 34 deletions .github/workflows/lint.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Publish Python 🐍 distribution 📦 to PyPI

on:
push:
tags:
- '*'

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Print environment
run: |
python --version
- name: Install pypa/build
run: python3 -m pip install build

- name: Build a binary wheel and a source tarball
run: python3 -m build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/kinto-http
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
73 changes: 23 additions & 50 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,41 @@
on:
push:
branches:
- main
pull_request:
on: pull_request

name: Unit Testing
jobs:
chore:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4

- name: Run linting and formatting checks
run: make lint

unit-tests:
name: Unit Tests
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
toxenv: [py38, py39, py310, py311, py311-master]
include:
- toxenv: py38
python-version: "3.8"
- toxenv: py39
python-version: "3.9"
- toxenv: py310
python-version: "3.10"
- toxenv: py311
python-version: "3.11"
- toxenv: py311-master
python-version: "3.11"
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install virtualenv
run: |
pip install virtualenv
virtualenv --python=python3 .venv
- name: Print environment
run: |
source .venv/bin/activate
python --version
pip --version
cache: pip

- name: Install dependencies
run: |
source .venv/bin/activate
pip install tox
make install-dev
run: make install

- name: Use kinto @ master
if: matrix.toxenv == 'py39-master'
run: pip install --pre -U https://github.com/Kinto/kinto/tarball/master
- name: Run kinto
run: make run-kinto & sleep 5

- name: Run server
run: |
make run-kinto &
sleep 5 # to give kinto migrate a chance to finish
- name: Tox
run: |
source .venv/bin/activate
tox -e ${{ matrix.toxenv }}
- name: Run unit tests
run: make test

- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
uses: coverallsapp/github-action@v2
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
.cache
*.pyc
kinto_http.egg-info/
*.egg-info/
.coverage
.venv/
.tox
.pytest_cache/
.vscode/
13 changes: 0 additions & 13 deletions .therapist.yml

This file was deleted.

9 changes: 3 additions & 6 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ CHANGELOG
This document describes changes between each past release.


11.0.2 (unreleased)
===================

**Internal Changes**
>= 11.0.2
=========

- Drop support of Python 3.7
- Update list of Python versions to run CI tests
Since version 11.0.2, we use `Github releases <https://github.com/Kinto/kinto-http.py/releases>`_ and autogenerated changelogs.


11.0.1 (2023-04-05)
Expand Down
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

Loading

0 comments on commit 11f18b9

Please sign in to comment.