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

Fix the broken Mac OS CI jobs because the setup-python actions decided to release a new OS without support for all versions #6142

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Expand Up @@ -71,12 +71,12 @@ jobs:
tests:
name: ${{matrix.os}} / ${{ matrix.python-version }}
needs: lint
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10", 3.11, 3.12]
os: [MacOS, Ubuntu, Windows]
os: [MacOS-12, Ubuntu-latest, Windows-latest]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Expand Up @@ -9,7 +9,7 @@ sphinx = "*"
sphinx-click = "==4.*"
sphinxcontrib-spelling = "==7.*"
click = "==8.0.3"
pypiserver = "==1.*"
pypiserver = "*"
stdeb = {version="*", sys_platform = "== 'linux'"}
zipp = {version = "==3.6.0", markers = "python_version < '3.10'"}
pre-commit = "==2.*"
Expand Down
28 changes: 18 additions & 10 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pipenv/cli/options.py
Expand Up @@ -467,7 +467,7 @@ def validate_python_path(ctx, param, value):
# we'll report absolute paths which do not exist:
if isinstance(value, (str, bytes)):
if os.path.isabs(value) and not os.path.isfile(value):
raise BadParameter("Expected Python at path %s does not exist" % value)
raise BadParameter(f"Expected Python at path {value} does not exist")
return value


Expand All @@ -479,7 +479,7 @@ def validate_bool_or_none(ctx, param, value):

def validate_pypi_mirror(ctx, param, value):
if value and not is_valid_url(value):
raise BadParameter("Invalid PyPI mirror URL: %s" % value)
raise BadParameter(f"Invalid PyPI mirror URL: {value}")
return value


Expand Down
2 changes: 1 addition & 1 deletion pipenv/environment.py
Expand Up @@ -310,7 +310,7 @@ def build_command(
lines = pylib_lines + pyinc_lines
if scripts:
lines.append(
"u'scripts': u'{0}'.format(%s)" % sysconfig_line.format("scripts")
"u'scripts': u'{{0}}'.format({})".format(sysconfig_line.format("scripts"))
)
if py_version:
lines.append(
Expand Down
2 changes: 1 addition & 1 deletion pipenv/exceptions.py
Expand Up @@ -157,7 +157,7 @@ def show(self, file=None):
if self.cmd is not None and self.cmd.get_help_option(self.ctx) is not None:
hint = f'Try "{self.ctx.command_path} {self.ctx.help_option_names[0]}" for help.\n'
if self.ctx is not None:
click.echo(self.ctx.get_usage() + "\n%s" % hint, file=file, color=color)
click.echo(self.ctx.get_usage() + f"\n{hint}", file=file, color=color)
click.echo(self.message, file=file)


Expand Down
14 changes: 7 additions & 7 deletions pipenv/utils/exceptions.py
Expand Up @@ -14,7 +14,7 @@ def __init__(self, param):

@classmethod
def get_message(cls, param):
return "Missing Parameter: %s" % param
return f"Missing Parameter: {param}"

def show(self, param):
print(self.message, file=sys.stderr, flush=True)
Expand All @@ -37,9 +37,9 @@ def __init__(self, path, *args, **kwargs):
super().__init__(self.message)

def get_message(self, path, backup_path=None):
message = "ERROR: Failed to load file at %s" % path
message = f"ERROR: Failed to load file at {path}"
if backup_path:
msg = "it will be backed up to %s and removed" % backup_path
msg = f"it will be backed up to {backup_path} and removed"
else:
msg = "it will be removed and replaced on the next lock."
message = f"{message}\nYour lockfile is corrupt, {msg}"
Expand All @@ -55,9 +55,9 @@ def __init__(self, path, backup_path=None):
super().__init__(self.message)

def get_message(self, path, backup_path=None):
message = "ERROR: Failed to load lockfile at %s" % path
message = f"ERROR: Failed to load lockfile at {path}"
if backup_path:
msg = "it will be backed up to %s and removed" % backup_path
msg = f"it will be backed up to {backup_path} and removed"
else:
msg = "it will be removed and replaced on the next lock."
message = f"{message}\nYour lockfile is corrupt, {msg}"
Expand All @@ -73,9 +73,9 @@ def __init__(self, path, backup_path=None):
super().__init__(self.message)

def get_message(self, path, backup_path=None):
message = "ERROR: Failed to load Pipfile at %s" % path
message = f"ERROR: Failed to load Pipfile at {path}"
if backup_path:
msg = "it will be backed up to %s and removed" % backup_path
msg = f"it will be backed up to {backup_path} and removed"
else:
msg = "it will be removed and replaced on the next lock."
message = f"{message}\nYour Pipfile is corrupt, {msg}"
Expand Down
16 changes: 8 additions & 8 deletions pipenv/utils/requirementslib.py
Expand Up @@ -361,7 +361,7 @@ def get_path(root, path, default=_UNSET):
cur = cur[seg]
except (ValueError, KeyError, IndexError, TypeError):
if not getattr(cur, "__iter__", None):
exc = TypeError("%r object is not indexable" % type(cur).__name__)
exc = TypeError(f"{type(cur).__name__!r} object is not indexable")
raise PathAccessError(exc, seg, path)
except PathAccessError:
if default is _UNSET:
Expand Down Expand Up @@ -429,7 +429,7 @@ def dict_path_exit(path, key, old_parent, new_parent, new_items):
except AttributeError:
ret = new_parent.__class__(vals) # frozensets
else:
raise RuntimeError("unexpected iterable type: %r" % type(new_parent))
raise RuntimeError(f"unexpected iterable type: {type(new_parent)!r}")
return ret


Expand Down Expand Up @@ -519,14 +519,14 @@ def remap(
# TODO: improve argument formatting in sphinx doc
# TODO: enter() return (False, items) to continue traverse but cancel copy?
if not callable(visit):
raise TypeError("visit expected callable, not: %r" % visit)
raise TypeError(f"visit expected callable, not: {visit!r}")
if not callable(enter):
raise TypeError("enter expected callable, not: %r" % enter)
raise TypeError(f"enter expected callable, not: {enter!r}")
if not callable(exit):
raise TypeError("exit expected callable, not: %r" % exit)
raise TypeError(f"exit expected callable, not: {exit!r}")
reraise_visit = kwargs.pop("reraise_visit", True)
if kwargs:
raise TypeError("unexpected keyword arguments: %r" % kwargs.keys())
raise TypeError(f"unexpected keyword arguments: {kwargs.keys()!r}")

path, registry, stack = (), {}, [(None, root)]
new_items_stack = []
Expand All @@ -551,7 +551,7 @@ def remap(
# TODO: handle False?
raise TypeError(
"enter should return a tuple of (new_parent,"
" items_iterator), not: %r" % res
f" items_iterator), not: {res!r}"
)
if new_items is not False:
# traverse unless False is explicitly passed
Expand Down Expand Up @@ -583,7 +583,7 @@ def remap(
try:
new_items_stack[-1][1].append(visited_item)
except IndexError:
raise TypeError("expected remappable root, not: %r" % root)
raise TypeError(f"expected remappable root, not: {root!r}")
return value


Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Expand Up @@ -113,6 +113,9 @@ exclude = '''
exclude = [
"pipenv/patched/*",
"pipenv/vendor/*",
"ests/pypi/*",
"tests/fixtures/*",
"tests/test_artifacts/*",
]
select = [
"ASYNC",
Expand Down Expand Up @@ -140,8 +143,7 @@ ignore = [
"PLW2901",
]
line-length = 137
target-version = "py37"

target-version = "py38"

[tool.ruff.mccabe]
max-complexity = 44
Expand Down
20 changes: 10 additions & 10 deletions tasks/release.py
Expand Up @@ -19,7 +19,7 @@


def log(msg):
print("[release] %s" % msg)
print(f"[release] {msg}")


def get_version_file(ctx):
Expand Down Expand Up @@ -126,11 +126,11 @@ def build_dists(ctx):
executable = ctx.run(
"python -c 'import sys; print(sys.executable)'", hide=True
).stdout.strip()
log("Building sdist using %s ...." % executable)
log(f"Building sdist using {executable} ....")
os.environ["PIPENV_PYTHON"] = py_version
ctx.run("pipenv install --dev", env=env)
ctx.run("pipenv run pip install -e . --upgrade --upgrade-strategy=eager", env=env)
log("Building wheel using python %s ...." % py_version)
log(f"Building wheel using python {py_version} ....")
ctx.run("pipenv run python -m build", env=env)


Expand Down Expand Up @@ -224,8 +224,8 @@ def clean_mdchangelog(ctx, filename=None, content=None):
def tag_version(ctx, push=False):
version = find_version(ctx)
version = semver.VersionInfo.parse(version)
log("Tagging revision: v%s" % version)
ctx.run("git tag v%s" % version)
log(f"Tagging revision: v{version}")
ctx.run(f"git tag v{version}")
if push:
log("Pushing tags...")
ctx.run("git push origin master")
Expand Down Expand Up @@ -283,17 +283,17 @@ def bump_version(ctx, dry_run=False, pre=False, dev=False):
new_version = new_version.bump_prerelease(current_version, "dev")

# Update the version file
log("Updating version to %s" % new_version)
log(f"Updating version to {new_version}")
version = find_version(ctx)
log("Found current version: %s" % version)
log(f"Found current version: {version}")
if dry_run:
log("Would update to: %s" % new_version)
log(f"Would update to: {new_version}")
else:
log("Updating to: %s" % new_version)
log(f"Updating to: {new_version}")
version_file = get_version_file(ctx)
file_contents = version_file.read_text()
version_file.write_text(file_contents.replace(version, str(new_version)))
ctx.run(f"git add {version_file.as_posix()}")
log("Committing...")
ctx.run('git commit -s -m "Bumped version to %s."' % new_version)
ctx.run(f'git commit -s -m "Bumped version to {new_version}."')
return str(new_version)