Skip to content

Commit

Permalink
Merge pull request #57 from jawah/patch-1
Browse files Browse the repository at this point in the history
Release 2.5
  • Loading branch information
Ousret authored Jan 27, 2025
2 parents c8c4aec + bdb8233 commit b17e8d4
Show file tree
Hide file tree
Showing 44 changed files with 610 additions and 573 deletions.
25 changes: 25 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[run]
source =
kiss_headers
# Needed for Python 3.11 and lower
disable_warnings = no-sysmon

[paths]
source =
src/kiss_headers
*/kiss_headers
*\kiss_headers

[report]
exclude_lines =
except ModuleNotFoundError:
except ImportError:
pass
import
raise NotImplementedError
.* # Platform-specific.*
.*:.* # Python \d.*
.* # Abstract
.* # Defensive:
if (?:typing.)?TYPE_CHECKING:
^\s*?\.\.\.\s*$
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Pull Request

### My patch is about
- [ ] :bug: Bugfix
- [ ] :bug: Bugfix
- [ ] :arrow_up: Improvement
- [ ] :pencil: Documentation
- [ ] :heavy_check_mark: Tests
Expand Down
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
ignore:
# Ignore all patch releases as we can manually
# upgrade if we run into a bug and need a fix.
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
ignore:
- dependency-name: "*"
update-types: [ "version-update:semver-patch" ]
34 changes: 8 additions & 26 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,15 @@ on:

jobs:
lint:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
os: [ubuntu-latest]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: 3.x
- name: Install dependencies
run: |
pip install -U pip build wheel
pip install -r dev-requirements.txt
- name: Install the package
run: |
pip install .
- name: Type checking (Mypy)
run: |
mypy kiss_headers
- name: Import sorting check (isort)
run: |
isort --check kiss_headers
- name: Code format (Black)
run: |
black --check --diff kiss_headers
run: pip install nox
- name: Run pre-commit checks
run: nox -s lint
14 changes: 7 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- name: "Checkout repository"
uses: "actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608"
uses: "actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871"

- name: "Setup Python"
uses: "actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1"
uses: "actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b"
with:
python-version: "3.x"

Expand All @@ -38,7 +38,7 @@ jobs:
cd dist && echo "::set-output name=hashes::$(sha256sum * | base64 -w0)"
- name: "Upload dists"
uses: "actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce"
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: "dist"
path: "dist/"
Expand All @@ -51,7 +51,7 @@ jobs:
actions: read
contents: write
id-token: write # Needed to access the workflow's OIDC identity.
uses: "slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.9.0"
uses: "slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0"
with:
base64-subjects: "${{ needs.build.outputs.hashes }}"
upload-assets: true
Expand All @@ -62,7 +62,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
environment:
name: pypi
url: https://pypi.org/p/kiss-headers
url: https://pypi.org/p/niquests
needs: ["build", "provenance"]
permissions:
contents: write
Expand All @@ -71,7 +71,7 @@ jobs:

steps:
- name: "Download dists"
uses: "actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a"
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with:
name: "dist"
path: "dist/"
Expand All @@ -83,4 +83,4 @@ jobs:
gh release upload ${{ github.ref_name }} dist/* --repo ${{ github.repository }}
- name: "Publish dists to PyPI"
uses: "pypa/gh-action-pypi-publish@f8c70e705ffc13c3b4d1221169b84f12a75d6ca8" # v1.8.8
uses: "pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70" # v1.12.3
61 changes: 47 additions & 14 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,61 @@ on:

jobs:
tests:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04

strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
pip install -U pip build wheel
pip install -r dev-requirements.txt
- name: Install the package
run: |
pip install .
run: pip install nox
- name: Run tests
run: |
pytest
- uses: codecov/codecov-action@v1
run: nox -s test-${{ matrix.python-version }}
- name: "Upload artifact"
uses: "actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808"
with:
name: coverage-data-${{ matrix.python-version }}
path: ".coverage.*"
if-no-files-found: error

coverage:
if: always()
runs-on: "ubuntu-latest"
needs: tests
steps:
- name: "Checkout repository"
uses: "actions/checkout@d632683dd7b4114ad314bca15554477dd762a938"

- name: "Setup Python"
uses: "actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b"
with:
python-version: "3.x"

- name: "Install coverage"
run: "python -m pip install --upgrade coverage"

- name: "Download artifact"
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
pattern: coverage-data*
merge-multiple: true

- name: "Combine & check coverage"
run: |
python -m coverage combine
python -m coverage html --skip-covered --skip-empty
python -m coverage report --ignore-errors --show-missing --fail-under=77
- name: "Upload report"
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: coverage-report
path: htmlcov
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
exclude: 'docs/'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.1
hooks:
# Run the linter.
- id: ruff
args: [ --fix, --target-version=py37 ]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
args: [ --check-untyped-defs ]
exclude: 'noxfile.py|tests/'
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Contribution Guidelines

If you’re reading this, you’re probably interested in contributing to **kiss-headers**.
Thank you very much! Open source projects thrive based on the support they receive from others,
If you’re reading this, you’re probably interested in contributing to **kiss-headers**.
Thank you very much! Open source projects thrive based on the support they receive from others,
and the fact that you’re even considering contributing to this project is very generous of you.

## Questions

The GitHub issue tracker is for *bug reports* and *feature requests*.
The GitHub issue tracker is for *bug reports* and *feature requests*.
Questions are allowed only when no answer are provided in docs.

## Good Bug Reports
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Plus all the features that you would expect from handling headers...
### ✨ Installation

Whatever you like, use `pipenv` or `pip`, it simply works. Requires Python 3.7+ installed.
```sh
```sh
pip install kiss-headers --upgrade
```

Expand Down Expand Up @@ -99,9 +99,9 @@ from requests import get
from kiss_headers import Headers, UserAgent, Referer, UpgradeInsecureRequests, Accept, AcceptLanguage, CustomHeader

class CustomHeaderXyz(CustomHeader):

__squash__ = False

def __init__(self, charset: str = "utf-8"):
super().__init__("hello", charset=charset)

Expand Down Expand Up @@ -366,7 +366,7 @@ If-None-Match: "c561c68d0ba92bbeb8b0fff2a9199f722e3a621a"
Cache-Control: max-age="0"
```

See the complete list of available header class in the full documentation.
See the complete list of available header class in the full documentation.
Also, you can create your own custom header object using the class `kiss_headers.CustomHeader`.

## 📜 Documentation
Expand Down
42 changes: 0 additions & 42 deletions UPGRADE.md

This file was deleted.

10 changes: 2 additions & 8 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
requests>=2.10
black
pytest
pytest-cov
codecov
isort
mypy
mkdocs
mkdocs-material
pytest>=2.8.0,<=7.4.4
coverage>=7.2.7,<7.7
1 change: 0 additions & 1 deletion kiss_headers/py.typed

This file was deleted.

6 changes: 0 additions & 6 deletions kiss_headers/version.py

This file was deleted.

Loading

0 comments on commit b17e8d4

Please sign in to comment.