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

Updated platform support for MacOS using arm64 in function is_aarch64 #36

Merged
merged 19 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
39 changes: 21 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
minimum_pre_commit_version: 1.15.2
minimum_pre_commit_version: 3.6.0
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: trailing-whitespace # Trims trailing whitespace.
Expand Down Expand Up @@ -36,8 +36,8 @@ repos:
language: system
# <---- Local Hooks ------------------------------------------------------------------------------------------------

- repo: https://github.com/s0undt3ch/python-tools-scripts
rev: "0.17.0"
- repo: https://github.com/saltstack/python-tools-scripts
rev: "0.20.5"
hooks:
- id: tools
alias: actionlint
Expand All @@ -51,14 +51,14 @@ repos:

# ----- Formatting ------------------------------------------------------------------------------------------------>
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.1
hooks:
- id: pyupgrade
name: Rewrite Code to be Py3.7+
args: [--py37-plus]
name: Rewrite Code to be Py3.8+
args: [--py38-plus]

- repo: https://github.com/asottile/reorder_python_imports
rev: v3.10.0
rev: v3.13.0
hooks:
- id: reorder-python-imports
args: [
Expand All @@ -68,25 +68,25 @@ repos:
exclude: ^src/pytestskipmarkers/(version.py|downgraded/.*)$

- repo: https://github.com/psf/black
rev: 23.7.0
rev: 24.2.0
hooks:
- id: black
args: [-l 100]
exclude: ^src/pytestskipmarkers/(version.py|downgraded/.*)$

- repo: https://github.com/asottile/blacken-docs
rev: 1.15.0
rev: 1.16.0
hooks:
- id: blacken-docs
args: [--skip-errors]
files: ^(.*\.rst|docs/.*\.rst|src/pytestskipmarkers/.*\.py)$
additional_dependencies:
- black==23.7.0
- black==24.2.0
# <---- Formatting -------------------------------------------------------------------------------------------------

# ----- Security -------------------------------------------------------------------------------------------------->
- repo: https://github.com/PyCQA/bandit
rev: "1.7.5"
rev: "1.7.7"
hooks:
- id: bandit
alias: bandit-salt
Expand All @@ -97,7 +97,7 @@ repos:
tests/.*
)$
- repo: https://github.com/PyCQA/bandit
rev: "1.7.5"
rev: "1.7.7"
hooks:
- id: bandit
alias: bandit-tests
Expand All @@ -108,7 +108,7 @@ repos:

# ----- Code Analysis --------------------------------------------------------------------------------------------->
- repo: https://github.com/pycqa/flake8
rev: '6.1.0'
rev: '7.1.1'
hooks:
- id: flake8
exclude: ^(src/pytestskipmarkers/(downgraded/.*|version\.py)|\.pre-commit-hooks/.*\.py)$
Expand All @@ -118,26 +118,29 @@ repos:
- flake8-typing-imports

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.11.1
hooks:
- id: mypy
name: Run mypy against source
files: ^src/.*\.py$
exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$
args: [--strict]
args:
- --strict
- --no-site-packages
additional_dependencies:
- attrs
- types-attrs
- types-setuptools

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.11.1
hooks:
- id: mypy
name: Run mypy against tests
files: ^tests/.*\.py$
exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$
args: []
args:
- --no-site-packages
additional_dependencies:
- pytest
- attrs
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-hooks/check-changelog-entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
CHANGELOG_ENTRY_REREX = r"^[\d]+\.({})\.rst$".format("|".join(CHANGELOG_EXTENSIONS))
CHANGELOG_ENTRY_RE = re.compile(CHANGELOG_ENTRY_REREX)

## Example changelog entry: <PR number>.improvement.rst


def check_changelog_entries(files):
exitcode = 0
Expand Down
1 change: 1 addition & 0 deletions changelog/36.improvement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added support for is_arm64 for MacOS and is_x86_64, and updated pre-commit, drop support for Python 3.7
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def session_run_always(session, *command, **kwargs):
session._runner.global_config.install_only = old_install_only_value


@nox.session(python=("3", "3.5", "3.6", "3.7", "3.8", "3.9"))
@nox.session(python=("3", "3.8", "3.9", "3.10"))
def tests(session):
"""
Run tests.
Expand Down
4 changes: 2 additions & 2 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
-r tests.txt
pylint==2.12.2
pyenchant
black; python_version >= '3.7'
reorder-python-imports; python_version >= '3.7'
black; python_version >= '3.8'
reorder-python-imports; python_version >= '3.8'
flake8 >= 4.0.1
flake8-mypy-fork
flake8-docstrings
Expand Down
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ classifiers =
Programming Language :: Cython
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand All @@ -35,7 +34,7 @@ include_package_data = True
package_dir =
=src
packages = find:
python_requires = >= 3.7
python_requires = >= 3.8
setup_requires =
setuptools>=50.3.2
setuptools_scm[toml]>=3.4
Expand Down Expand Up @@ -133,7 +132,7 @@ docstring-convention = google


[mypy]
python_version = 3.7
python_version = 3.8
mypy_path = src
ignore_missing_imports = True
no_implicit_optional = True
Expand Down
19 changes: 19 additions & 0 deletions src/pytestskipmarkers/utils/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ def is_aarch64() -> bool:
return platform.machine().startswith("aarch64")


def is_arm64() -> bool:
dmurphy18 marked this conversation as resolved.
Show resolved Hide resolved
"""
Simple function to return if host is Arm64 or not.
"""
return platform.machine().startswith("arm64")


def is_x86_64() -> bool:
"""
Simple function to return if host is x86_64 or not.
"""
return platform.machine().startswith("x86_64")


def is_photonos() -> bool:
"""
Simple function to return if host is Photon OS or not.
Expand All @@ -138,6 +152,7 @@ def on_platforms(
openbsd: bool = False,
aix: bool = False,
aarch64: bool = False,
arm64: bool = False,
spawning: bool = False,
photonos: bool = False,
) -> bool:
Expand All @@ -154,6 +169,7 @@ def on_platforms(
:keyword bool openbsd: When :py:const:`True`, check if running on OpenBSD.
:keyword bool aix: When :py:const:`True`, check if running on AIX.
:keyword bool aarch64: When :py:const:`True`, check if running on AArch64.
:keyword bool arm64: When :py:const:`True`, check if running on Arm64.
:keyword bool spawning:
When :py:const:`True`, check if running on a platform which defaults
multiprocessing to spawn
Expand Down Expand Up @@ -188,6 +204,9 @@ def on_platforms(
if aarch64 and is_aarch64():
return True

if arm64 and is_arm64():
return True

if spawning and is_spawning_platform():
return True

Expand Down
Loading