Skip to content

workflows: add a release workflow #308

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

Merged
merged 13 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.13.0
files = setup.py cachecontrol/__init__.py docs/conf.py
files = cachecontrol/__init__.py docs/conf.py
commit = True
tag = True
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on:
release:
types:
- published

name: release

jobs:
pypi:
name: upload release to PyPI
runs-on: ubuntu-latest

permissions:
# Used to authenticate to PyPI via OIDC.
# Used to sign the release's artifacts with sigstore-python.
id-token: write

# Used to attach signing artifacts to the published release.
contents: write

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: ">= 3.6"

- name: deps
run: python -m pip install -U build

- name: build
run: python -m build

- name: publish
uses: pypa/gh-action-pypi-publish@release/v1

- name: sign
uses: sigstore/gh-action-sigstore-python@v1.2.3
with:
inputs: ./dist/*.tar.gz ./dist/*.whl
release-signing-artifacts: true
86 changes: 86 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Contributing to CacheControl

Thank you for your interest in contributing to `CacheControl`!

The information below will help you set up a local development environment
and perform common development tasks.

## Requirements

`CacheControl`'s only external development requirement is Python 3.7 or newer.

## Development steps

First, clone this repository:

```bash
git clone https://github.com/psf/cachecontrol
cd cachecontrol
```

Then, bootstrap your local development environment:

```bash
make bootstrap
# OPTIONAL: enter the new environment, if you'd like to run things directly
source .venv/bin/activate
```

Once you've run `make bootstrap`, you can run the other `make` targets
to perform particular tasks.

Any changes you make to the `cachecontrol` source tree will take effect
immediately in the development environment.

### Linting

You can run the current formatters with:

```bash
make format
```

### Testing

You can run the unit tests locally with:

```bash
# run the test suite in the current environment
make test

# OPTIONAL: use `tox` to fan out across multiple interpreters
make test-all
```

### Documentation

You can build the Sphinx-based documentation with:

```bash
# puts the generated HTML in docs/_build/html/
make doc
```

### Releasing

**NOTE**: If you're a non-maintaining contributor, you don't need the steps
here! They're documented for completeness and for onboarding future maintainers.

Releases of `CacheControl` are managed by GitHub Actions.

To perform a release:

1. Update `CacheControl`'s `__version__` attribute. It can be found under
`cachecontrol/__init__.py`.

1. Create a new tag corresponding to your new version, with a `v` prefix. For example:

```bash
# IMPORTANT: don't forget the `v` prefix!
git tag v1.2.3
```

1. Push your changes to `master` and to the new remote tag.

1. Create, save, and publish a GitHub release for your new tag, including any
`CHANGELOG` entries.
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

12 changes: 3 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ VENV_CMD=python3 -m venv
ACTIVATE = $(VENV)/bin/activate
CHEESE=https://pypi.python.org/pypi
BUMPTYPE=patch
BUMPPRE=0


$(VENV)/bin/pip3:
$(VENV_CMD) $(VENV)

bootstrap: $(VENV)/bin/pip3
$(VENV)/bin/pip3 install -r dev_requirements.txt
$(VENV)/bin/pip3 install -e .[dev]

format:
$(VENV)/bin/black .
Expand Down Expand Up @@ -49,13 +50,6 @@ test:
coverage:
$(VENV)/bin/py.test --cov cachecontrol

release: dist
$(VENV)/bin/twine upload dist/*

dist: clean
$(VENV)/bin/python setup.py sdist bdist_wheel
$(VENV)/bin/python -m build
ls -l dist

bump:
$(VENV)/bin/bumpversion $(BUMPTYPE)
git push && git push --tags
18 changes: 0 additions & 18 deletions dev_requirements.txt

This file was deleted.

6 changes: 4 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# serve to show the default.


from cachecontrol import __version__

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand Down Expand Up @@ -51,9 +53,9 @@
# built documents.
#
# The short X.Y version.
version = "0.13.0"
version = __version__
# The full version, including alpha/beta/rc tags.
release = "0.13.0"
release = __version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
77 changes: 77 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[tool.flit.module]
name = "cachecontrol"

[tool.flit.sdist]
include = ["tests/"]

[project]
name = "CacheControl"
dynamic = ["version"]
description = "httplib2 caching for requests"
readme = "README.rst"
license = { file = "LICENSE.txt" }
authors = [
{ name = "Eric Larson", email = "ericlarson@ionrock.com" },
{ name = "Frost Ming", email = "me@frostming.com" },
{ name = "William Woodruff", email = "william@yossarian.net" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Internet :: WWW/HTTP",
]
keywords = ["requests", "http", "caching", "web"]
dependencies = ["requests >= 2.16.0", "msgpack >= 0.5.2"]
requires-python = ">=3.7"

[project.urls]
Homepage = "https://pypi.org/project/CacheControl/"
Issues = "https://github.com/psf/cachecontrol/issues"
Source = "https://github.com/psf/cachecontrol"

[project.optional-dependencies]
# End-user extras.
filecache = ["filelock >= 3.8.0"]
redis = ["redis>=2.10.5"]

# Development extras.
dev = [
"CacheControl[filecache,redis]",
"build",
"mypy",
"tox",
"pytest-cov",
"pytest",
"cherrypy",
"sphinx",
"black",
"types-redis",
"types-requests",
]

[project.scripts]
doesitcache = "cachecontrol._cmd:main"

[tool.mypy]
show_error_codes = true
strict = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]

[[tool.mypy.overrides]]
module = "msgpack"
ignore_missing_imports = true

[tool.pytest.ini_options]
norecursedirs = ["bin", "lib", "include", "build"]
18 changes: 0 additions & 18 deletions setup.cfg

This file was deleted.

44 changes: 0 additions & 44 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
; SPDX-License-Identifier: Apache-2.0

[tox]
isolated_build = True
envlist = py{36,37,38,39,310,311}, mypy

[gh-actions]
Expand Down