Skip to content

Commit

Permalink
Merge pull request #579 from Cornices/modernize-repo
Browse files Browse the repository at this point in the history
Modernize repo
  • Loading branch information
leplatrem authored Feb 1, 2024
2 parents 511f04c + ac4f24c commit 27e80ff
Show file tree
Hide file tree
Showing 50 changed files with 2,097 additions and 1,922 deletions.
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Cornices/cornice
52 changes: 52 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
How to contribute
=================

Thanks for your interest in contributing!

## Reporting Bugs

Report bugs at https://github.com/Cornices/cornice/issues/new

If you are reporting a bug, please include:

- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug or even a PR with a failing tests if you can.


## Ready to contribute?

### Getting Started

- Fork the repo on GitHub and clone locally:

```bash
git clone [email protected]:Cornices/cornice.git
git remote add {your_name} [email protected]:{your_name}/cornice.git
```

## Testing

- `make test` to run all the tests

## Submitting Changes

```bash
git checkout main
git pull origin main
git checkout -b issue_number-bug-title
git commit # Your changes
git push -u {your_name} issue_number-bug-title
```

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/Cornices/cornice/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
12 changes: 12 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Security Policy

## Supported Versions

| Version | Supported |
| ------- | ------------------ |
| 6.x.x | :white_check_mark: |
| < 6.0 | :x: |

## Reporting a Vulnerability

If you believe you have found a Cornice-related security vulnerability, please [report it in a security advisory](https://github.com/Cornices/cornice/security/advisories/new).
19 changes: 13 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
ignore:
- dependency-name: marshmallow
versions:
- 3.2.1
interval: weekly
open-pull-requests-limit: 99
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
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/cornice
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
74 changes: 32 additions & 42 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,49 @@
on:
push:
branches:
- master
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, flake8]
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: flake8
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
run: make install

- 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
if: matrix.toxenv != 'flake8'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
uses: coverallsapp/github-action@v2

docs:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4

- name: Build docs
run: make docs
6 changes: 3 additions & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
CHANGELOG
#########

6.0.2 (unreleased)
==================
>= 6.0.2
========

- Add support for Python 3.9 and 3.10.
Since version 6.0.2, we use `Github releases <https://github.com/Cornices/cornice/releases>`_ and autogenerated changelogs.


6.0.1 (2022-01-07)
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

58 changes: 36 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,44 @@
HERE = $(shell pwd)
VENV = $(HERE)/.venv
BIN = $(VENV)/bin
PYTHON = $(BIN)/python
VIRTUALENV = virtualenv

.PHONY: all test docs

all: build
VENV := $(shell echo $${VIRTUAL_ENV-.venv})
PYTHON = $(VENV)/bin/python
SPHINX_BUILD = $(shell realpath ${VENV})/bin/sphinx-build
INSTALL_STAMP = $(VENV)/.install.stamp

.PHONY: all
all: install

install: $(INSTALL_STAMP)
$(INSTALL_STAMP): $(PYTHON) pyproject.toml requirements.txt
$(VENV)/bin/pip install -U pip
$(VENV)/bin/pip install -r requirements.txt
$(VENV)/bin/pip install -r docs/requirements.txt
$(VENV)/bin/pip install -e ".[dev]"
touch $(INSTALL_STAMP)

$(PYTHON):
$(VIRTUALENV) $(VENV)
python3 -m venv $(VENV)

build: $(PYTHON)
$(PYTHON) setup.py develop
requirements.txt: requirements.in
pip-compile

clean:
rm -rf $(VENV)
.PHONY: test
test: install
$(VENV)/bin/pytest --cov-report term-missing --cov-fail-under 100 --cov cornice

test_dependencies: build
$(BIN)/pip install tox
.PHONY: lint
lint: install
$(VENV)/bin/ruff check src tests
$(VENV)/bin/ruff format --check src tests

test: test_dependencies
$(BIN)/tox
.PHONY: format
format: install
$(VENV)/bin/ruff check --fix src tests
$(VENV)/bin/ruff format src tests

docs_dependencies: $(PYTHON)
$(BIN)/pip install -r docs/requirements.txt
docs: install
cd docs && $(MAKE) html SPHINXBUILD=$(SPHINX_BUILD)

docs: docs_dependencies
cd docs && $(MAKE) html SPHINXBUILD=$(VENV)/bin/sphinx-build
.IGNORE: clean
clean:
find src -name '__pycache__' -type d -exec rm -fr {} \;
find tests -name '__pycache__' -type d -exec rm -fr {} \;
rm -rf .venv .coverage *.egg-info .pytest_cache .ruff_cache build dist
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Cornice
=======

|readthedocs| |pypi| |github-actions| |master-coverage|
|readthedocs| |pypi| |github-actions| |main-coverage|

.. |github-actions| image:: https://github.com/Cornices/cornice/workflows/Unit%20Testing/badge.svg
:target: https://github.com/Cornices/cornice/actions?query=workflow%3A%22Unit+Testing%22
Expand All @@ -11,8 +11,8 @@ Cornice
:target: https://cornice.readthedocs.io/en/latest/
:alt: Documentation Status

.. |master-coverage| image::
https://coveralls.io/repos/Cornices/cornice/badge.svg?branch=master
.. |main-coverage| image::
https://coveralls.io/repos/Cornices/cornice/badge.svg?branch=main
:alt: Coverage
:target: https://coveralls.io/r/Cornices/cornice

Expand Down
Loading

0 comments on commit 27e80ff

Please sign in to comment.