Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize repo #304

Merged
merged 9 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
How to contribute
=================

Thanks for your interest in contributing to Kinto Wizard!

## Reporting Bugs

Report bugs at https://github.com/Kinto/kinto-wizard/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]:Kinto/kinto-wizard.git
git remote add {your_name} [email protected]:{your_name}/kinto-wizard.git
```

## Testing

- Run `make run-kinto` in a separate terminal

- `make tests` 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/Kinto/kinto-wizard/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
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-wizard
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
61 changes: 23 additions & 38 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,56 +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, flake8]
include:
- toxenv: py38
python-version: "3.8"
- toxenv: flake8
python-version: "3.X"
python-version: ["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: |
make install-dev
run: make install

- name: Run Kinto
run: |
make runkinto &
- name: Run kinto
run: make run-kinto & sleep 5

- 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
6 changes: 3 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Changelog

This document describes changes between each past release.

4.0.3 (unreleased)
------------------
>= 4.0.3
=========

- Nothing changed yet.
Since version 4.0.3, we use `Github releases <https://github.com/Kinto/kinto-wizard/releases>`_ and autogenerated changelogs.


4.0.2 (2023-11-30)
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

67 changes: 27 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,57 +1,44 @@
SERVER_CONFIG = tests/kinto.ini
VIRTUALENV = virtualenv
VENV := $(shell echo $${VIRTUAL_ENV-.venv})
PYTHON = $(VENV)/bin/python
DEV_STAMP = $(VENV)/.dev_env_installed.stamp
INSTALL_STAMP = $(VENV)/.install.stamp
TEMPDIR := $(shell mktemp -d)

.PHONY: all install migrate runkinto virtualenv tests

OBJECTS = .venv .coverage

.PHONY: all
all: install

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

$(VENV)/bin/kinto: virtualenv
$(VENV)/bin/pip install -U kinto
install-kinto: $(VENV)/bin/kinto

install-dev: $(INSTALL_STAMP) $(DEV_STAMP)
$(DEV_STAMP): $(PYTHON) dev-requirements.txt
$(VENV)/bin/pip install -Ur dev-requirements.txt
touch $(DEV_STAMP)

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

migrate:
$(VENV)/bin/kinto migrate --ini $(SERVER_CONFIG)
need-kinto-running:
@curl http://localhost:8888/v0/ 2>/dev/null 1>&2 || (echo "Run 'make run-kinto' before starting tests." && exit 1)

$(SERVER_CONFIG):
$(VENV)/bin/kinto init --ini $(SERVER_CONFIG) --backend=memory
run-kinto: install
$(VENV)/bin/kinto migrate --ini tests/kinto.ini
$(VENV)/bin/kinto start --ini tests/kinto.ini

runkinto: install-kinto $(SERVER_CONFIG) migrate
$(VENV)/bin/kinto start --ini $(SERVER_CONFIG)
.PHONY: tests
test: tests
tests: install need-kinto-running
$(VENV)/bin/pytest --cov-report term-missing --cov-fail-under 100 --cov kinto_wizard

build-requirements:
$(VIRTUALENV) $(TEMPDIR)
$(TEMPDIR)/bin/pip install -U pip
$(TEMPDIR)/bin/pip install -Ue .
$(TEMPDIR)/bin/pip freeze | grep -v -- '^-e' > requirements.txt
.PHONY: lint
lint: install
$(VENV)/bin/ruff check src tests
$(VENV)/bin/ruff format --check src tests

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

.IGNORE: clean
clean:
rm -fr build/ dist/ .tox .venv
find . -name '*.pyc' -delete
find . -name '__pycache__' -type d | xargs rm -fr

tests-once: install-dev
$(VENV)/bin/py.test --cov-report term-missing --cov-fail-under 100 --cov kinto_wizard
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
21 changes: 8 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,11 @@ and configure their attributes and permissions.
Installation
------------

The last release
~~~~~~~~~~~~~~~~
Use pip:

.. code-block:: bash

pip install kinto-wizard


The development version
~~~~~~~~~~~~~~~~~~~~~~~

After having cloned the repo:

.. code-block:: bash

pip install -e .
$ pip install kinto-wizard


How to use it?
Expand Down Expand Up @@ -91,3 +80,9 @@ to load the file on a Kinto server.
.. code-block:: bash

kinto-wizard validate current-config.yml


Development
-----------

See `contributing docs <./.github/CONTRIBUTING.md>`_
Loading
Loading