Skip to content
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
5 changes: 3 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/ScreenPyHQ/cookiecutter_screenpy",
"commit": "2b69298215c08160678dd749884c426a55828dce",
"commit": "6a7488b4183f615ff319dbfdac38a3a1354953c7",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -11,7 +11,8 @@
"author": "Perry Goy",
"author_email": "perry.goy@gmail.com",
"github_username": "ScreenPyHQ",
"_template": "https://github.com/ScreenPyHQ/cookiecutter_screenpy"
"_template": "https://github.com/ScreenPyHQ/cookiecutter_screenpy",
"_commit": "6a7488b4183f615ff319dbfdac38a3a1354953c7"
}
},
"directory": null
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cruft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
python-version: ["3.13"]
os: [ubuntu-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest]

steps:
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
max-parallel: 9
fail-fast: false
matrix:
python-version: ["3.12"]
python-version: ["3.13"]
os: [ubuntu-latest]
poetry-version: ["1.6.1"]
poetry-version: ["2.1.3"]

steps:
- uses: actions/checkout@v4
Expand All @@ -32,8 +32,5 @@ jobs:
with:
poetry-version: ${{ matrix.poetry-version }}

- name: Check toml structure
run: poetry check

- name: Check lock file
run: poetry lock --check
- name: Check lock file is consistent with pyproject
run: poetry check --lock
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
max-parallel: 9
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest]

steps:
Expand Down
19 changes: 0 additions & 19 deletions .pre-commit-config.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022-2024 Perry Goy
Copyright (c) 2022-2025 Perry Goy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,27 @@ mypy:

.PHONY: black-check black-fix ruff-check ruff-fix mypy

lint: black-check ruff-check

lint-fix: black-fix ruff-fix

pre-check-in: black-check ruff-check mypy

pre-check-in-fix: black-fix ruff-fix mypy

.PHONY: pre-check-in pre-check-in-fix
.PHONY: pre-check-in pre-check-in-fix lint lint-fix

# requires poetry-plugin-export
requirements:
poetry export --without-hashes --extras dev -f requirements.txt > requirements.txt

.PHONY: requirements

cruft-update:
cruft update --allow-untracked-files

.PHONY: cruft-update

################################################################################
# sub-package specific

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ You want to contribute? Great! Here are the things you should do before submitti
1. `pip install -e .[dev]`
1. Optional (poetry users):
1. `poetry install --extras dev`
1. Run `pre-commit install` once.
1. Run `tox` to perform tests frequently.
1. Create pull-request from your branch.

Expand Down
1,763 changes: 1,005 additions & 758 deletions poetry.lock

Large diffs are not rendered by default.

82 changes: 29 additions & 53 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ build-backend = "poetry.core.masonry.api"


[tool.black]
target-version = ['py312']
target-version = ['py313']
extend-exclude = '''
# A regex preceded with ^/ will apply only to files and directories
# in the root of the project.
Expand All @@ -36,67 +36,34 @@ extend-exclude = '''


[tool.ruff]
target-version = "py38" # minimum supported version
target-version = "py39" # minimum supported version
line-length = 88 # same as Black.
output-format = "concise"
extend-exclude = [
"docs",
]

[tool.ruff.lint]
select = [
"A", # flake8-builtins
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"D", # pydocstyle
"E", # pycodestyle error
"EM", # flake8-errmsg
"ERA", # eradicate
"F", # Pyflakes
"FA", # flake8-future-annotations
"FBT", # flake8-boolean-trap
"FIX", # flake8-fixme
"FLY", # flynt
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # ruff specific
"SIM", # flake8-simplify
"T10", # flake8-debugger
"T20", # flake8-print
"TCH", # flake8-type-checking
"TRY", # tryceratops
"UP", # python upgrade
"W", # pycodestyle warning
"YTT", # flake8-2020

# we would like these someday, but not yet
# "FURB", # refurb
"ALL", # let's get all the new hotness and ignore as we need!
]
ignore = [
"D107", # missing __init__ docstring, we do that in the class docstring.
"D203", # one blank line before class docstring, no thanks!
"D212", # multi line summary first line, we want a one line summary.
"ANN101", # missing self annotation, we only annotate self when we return it.
"ANN102", # missing cls annotation, we only annotate cls when we return it.
"COM812", # we prefer black's logic for trailing commas
"D107", # missing __init__ docstring, we do that in the class docstring.
"D203", # one blank line before class docstring, no thanks!
"D212", # multi line summary first line, we want a one line summary.
"E501", # black handles our line limits.
"N818", # we like our conventions with readable error classes.
"S608", # we will not have SQL injection concerns. :P
]

extend-safe-fixes = [
"EM101", "EM102",
"TCH001", "TCH002", "TCH003", "TCH004",
"C419",
"D200", "D205", "D415",
"EM101", "EM102",
"PT003", "PT006", "PT018",
"RET504",
"TCH001", "TCH002", "TCH003", "TCH004",
"UP006", "UP007",
"W291",
]
Expand All @@ -119,17 +86,27 @@ split-on-trailing-comma = false

[tool.ruff.lint.per-file-ignores]
"tests/**" = [
"D", # we don't need public-API-polished docstrings in tests.
"FBT", # using a boolean as a test object is useful!
"PLR", # likewise using specific numbers and strings in tests.
"A", # import __doc__ is shadowing python builtin
"D", # we don't need public-API-polished docstrings in tests.
"FBT", # using a boolean as a test object is useful!
"N802", # we are intentional about our capitalization!
"N803", # we like our standards for variable names in tests.
"N806", # we are intentional about our capitalization!
"PLR", # using specific numbers and strings in tests is useful!
"PYI034", # our Fake-ables need to be... weird.
"S101", # we want to assert in tests!
"SLF001", # we need to access private methods in tests.
]
"__version__.py" = [
"D", # we don't need public-API-polished docstrings in version.
]
"__version__.py" = ["D"]


################################################################################
# END OF BOILERPLATE ScreenPyHQ CONFIGURATIONS #
################################################################################


[tool.poetry]
name = "screenpy_requests"
version = "4.0.4"
Expand All @@ -143,11 +120,11 @@ readme = "README.md"
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Quality Assurance",
Expand All @@ -166,13 +143,12 @@ classifiers = [
# so we dont have two different sets of package versions to update.

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"

screenpy = ">=4.0.2"
requests = ">=2.26.0"
types-requests = ">=2.26.0"


# convenience packages for development
black = {version = "*", optional = true}
coverage = {version = "*", optional = true}
Expand Down
2 changes: 1 addition & 1 deletion screenpy_requests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
ScreenPy Requests is an extension for ScreenPy, enabling interaction with
Requests.

:copyright: (c) 2022-2024 by Perry Goy.
:copyright: (c) 2022-2025 by Perry Goy.
:license: MIT, see LICENSE for more details.
"""

Expand Down
6 changes: 3 additions & 3 deletions screenpy_requests/__version__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
█▀ █▀▀ █▀█ █▀▀ █▀▀ █▄░█ █▀█ █▄█ █▀█ █▀▀ █▀█ █░█ █▀▀ █▀ ▀█▀ █▀
▄█ █▄▄ █▀▄ ██▄ ██▄ █░▀█ █▀▀ ░█░ █▀▄ ██▄ ▀▀█ █▄█ ██▄ ▄█ ░█░ ▄█
█▀ █▀▀ █▀█ █▀▀ █▀▀ █▄░█ █▀█ █▄█ █▀█ █▀▀ █▀█ █░█ █▀▀ █▀ ▀█▀ █▀
▄█ █▄▄ █▀▄ ██▄ ██▄ █░▀█ █▀▀ ░█░ █▀▄ ██▄ ▀▀█ █▄█ ██▄ ▄█ ░█░ ▄█
"""

import importlib.metadata as importlib_metadata
Expand All @@ -14,4 +14,4 @@
__author__ = metadata["Author"]
__author_email__ = metadata["Author-email"]
__license__ = metadata["License"]
__copyright__ = f"2019-2024 {__author__}"
__copyright__ = f"2019-2025 {__author__}"
2 changes: 1 addition & 1 deletion screenpy_requests/abilities/make_api_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from requests import Session

from ..exceptions import RequestError
from screenpy_requests.exceptions import RequestError

if TYPE_CHECKING:
from requests import Response
Expand Down
8 changes: 5 additions & 3 deletions screenpy_requests/actions/add_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Iterable, cast
from typing import TYPE_CHECKING, cast

from screenpy import aside, beat
from screenpy.narration import AIRY

from ..abilities import MakeAPIRequests
from screenpy_requests.abilities import MakeAPIRequests

if TYPE_CHECKING:
from collections.abc import Iterable

from screenpy import Actor


Expand Down Expand Up @@ -64,7 +66,7 @@ def perform_as(self, the_actor: Actor) -> None:
def __init__(self, *header_pairs: str | Iterable, **header_kwargs: str) -> None:
self.headers = {}
if len(header_pairs) == 1:
self.headers = dict(cast(Iterable, header_pairs[0]))
self.headers = dict(cast("Iterable", header_pairs[0]))
elif header_pairs and len(header_pairs) % 2 == 0:
self.headers = dict(zip(header_pairs[0::2], header_pairs[1::2]))
elif header_pairs:
Expand Down
6 changes: 4 additions & 2 deletions screenpy_requests/actions/send_api_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from screenpy import aside, beat
from screenpy.narration import AIRY

from ..abilities import MakeAPIRequests
from screenpy_requests.abilities import MakeAPIRequests

if TYPE_CHECKING:
from screenpy import Actor
Expand Down Expand Up @@ -60,7 +60,9 @@ def perform_as(self, the_actor: Actor) -> None:
aside(f"... along with the following: {self.kwargs}", gravitas=AIRY)

the_actor.uses_ability_to(MakeAPIRequests).to_send(
self.method, self.url, **self.kwargs
self.method,
self.url,
**self.kwargs,
)

def __init__(self, method: str, url: str) -> None:
Expand Down
8 changes: 5 additions & 3 deletions screenpy_requests/actions/set_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Iterable, cast
from typing import TYPE_CHECKING, cast

from screenpy import aside, beat
from screenpy.narration import AIRY

from ..abilities import MakeAPIRequests
from screenpy_requests.abilities import MakeAPIRequests

if TYPE_CHECKING:
from collections.abc import Iterable

from screenpy import Actor


Expand Down Expand Up @@ -76,7 +78,7 @@ def perform_as(self, the_actor: Actor) -> None:
def __init__(self, *header_pairs: str | Iterable, **header_kwargs: str) -> None:
self.headers = {}
if len(header_pairs) == 1:
self.headers = dict(cast(Iterable, header_pairs[0]))
self.headers = dict(cast("Iterable", header_pairs[0]))
elif header_pairs and len(header_pairs) % 2 == 0:
self.headers = dict(zip(header_pairs[0::2], header_pairs[1::2]))
elif header_pairs:
Expand Down
Loading