diff --git a/.github/code-of-conduct.md b/.github/code-of-conduct.md new file mode 100644 index 00000000..2aa2d8c0 --- /dev/null +++ b/.github/code-of-conduct.md @@ -0,0 +1,73 @@ +# Contributor covenant code of conduct + +## Our pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, +body size, disability, ethnicity, gender identity and expression, level of +experience, nationality, personal appearance, race, religion, or sexual +identity and orientation. + +## Our standards + +Examples of behavior that contributes to creating a positive environment +include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others’ private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an +appointed representative at an online or offline event. Representation of a +project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at . All complaints +will be reviewed and investigated and will result in a response that is deemed +necessary and appropriate to the circumstances. The project team is obligated +to maintain confidentiality with regard to the reporter of an incident. Further +details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project’s leadership. + +## Attribution + +This Code of Conduct is adapted from the +[Contributor Covenant](https://contributor-covenant.org), version 1.4, +available at +[https://contributor-covenant.org/version/1/4](https://contributor-covenant.org/version/1/4/) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 00000000..64edab5c --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,23 @@ +# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates +--- +version: 2 +updates: + + - package-ecosystem: "pip" + directory: "/" + versioning-strategy: increase-if-necessary + schedule: + interval: "daily" + labels: + - "📦 dependencies" + assignees: + - "kdeldycke" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + labels: + - "📦 dependencies" + assignees: + - "kdeldycke" diff --git a/.github/funding.yml b/.github/funding.yml new file mode 100644 index 00000000..1923788c --- /dev/null +++ b/.github/funding.yml @@ -0,0 +1,2 @@ +--- +github: kdeldycke diff --git a/.github/workflows/autofix.yaml b/.github/workflows/autofix.yaml new file mode 100644 index 00000000..0a06e6c0 --- /dev/null +++ b/.github/workflows/autofix.yaml @@ -0,0 +1,20 @@ +--- +name: Autofix +"on": + push: + # Only targets main branch to avoid amplification effects of auto-fixing + # the exact same stuff in multiple non-rebased branches. + branches: + - main + +# XXX Concurrency detection sucks and jobs gets killed randonmly. +# concurrency: +# # Group workflow jobs so new commits cancels in-progress execution triggered by previous commits. +# # Source: https://mail.python.org/archives/list/pypa-committers@python.org/thread/PCBCQMJF64JGRBOX7E2EE4YLKHT4DI55/ +# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} +# cancel-in-progress: true + +jobs: + + autofix: + uses: kdeldycke/workflows/.github/workflows/autofix.yaml@v4.4.3 diff --git a/.github/workflows/autolock.yaml b/.github/workflows/autolock.yaml new file mode 100644 index 00000000..199ee804 --- /dev/null +++ b/.github/workflows/autolock.yaml @@ -0,0 +1,11 @@ +--- +name: Autolock +"on": + schedule: + # Run weekly, every Monday at 8:43. + - cron: "43 8 * * 1" + +jobs: + + autolock: + uses: kdeldycke/workflows/.github/workflows/autolock.yaml@v4.4.3 diff --git a/.github/workflows/changelog.yaml b/.github/workflows/changelog.yaml new file mode 100644 index 00000000..d4a67423 --- /dev/null +++ b/.github/workflows/changelog.yaml @@ -0,0 +1,23 @@ +--- +name: Changelog & versions +"on": + push: + branches: + - main + paths: + - changelog.md + - pyproject.toml + - .github/workflows/changelog.yaml + - .github/workflows/release.yaml + +# XXX Concurrency detection sucks and jobs gets killed randonmly. +# concurrency: +# # Group workflow jobs so new commits cancels in-progress execution triggered by previous commits. +# # Source: https://mail.python.org/archives/list/pypa-committers@python.org/thread/PCBCQMJF64JGRBOX7E2EE4YLKHT4DI55/ +# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} +# cancel-in-progress: true + +jobs: + + changelog: + uses: kdeldycke/workflows/.github/workflows/changelog.yaml@v4.4.3 diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 00000000..9b6025cb --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,56 @@ +--- +name: Docs +"on": + push: + # Only targets main branch to avoid amplification effects of auto-fixing + # the exact same stuff in multiple non-rebased branches. + branches: + - main + +# XXX Concurrency detection sucks and jobs gets killed randonmly. +# concurrency: +# # Group workflow jobs so new commits cancels in-progress execution triggered by previous commits. +# # Source: https://mail.python.org/archives/list/pypa-committers@python.org/thread/PCBCQMJF64JGRBOX7E2EE4YLKHT4DI55/ +# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} +# cancel-in-progress: true + +jobs: + + docs: + uses: kdeldycke/workflows/.github/workflows/docs.yaml@v4.4.3 + + update-docs: + needs: docs + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4.1.7 + - uses: actions/setup-python@v5.1.1 + with: + python-version: "3.12" + - name: Install uv + run: | + python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/v4.4.3/requirements/uv.txt + - name: Install project + run: | + uv --no-progress venv --system + uv --no-progress pip install --all-extras --requirement pyproject.toml . + - name: Generate dynamic doc + run: | + uv --no-progress run --frozen -- python -m extra_platforms.docs_update + - uses: peter-evans/create-pull-request@v6.1.0 + with: + assignees: ${{ github.actor }} + commit-message: "[autofix] Regenerate documentation." + title: "[autofix] Regenerate documentation" + body: > +
Workflow metadata + + + > [Auto-generated on run `#${{ github.run_id }}`](${{ github.event.repository.html_url }}/actions/runs/${{ + github.run_id }}) by `${{ github.job }}` job from [`docs.yaml`](${{ github.event.repository.html_url + }}/blob/${{ github.sha }}/.github/workflows/docs.yaml) workflow. + + +
+ labels: "📚 documentation" + branch: update-docs diff --git a/.github/workflows/label-sponsors.yaml b/.github/workflows/label-sponsors.yaml new file mode 100644 index 00000000..5da1b748 --- /dev/null +++ b/.github/workflows/label-sponsors.yaml @@ -0,0 +1,14 @@ +--- +name: Label sponsors +"on": + pull_request: + types: + - opened + issues: + types: + - opened + +jobs: + + label-sponsors: + uses: kdeldycke/workflows/.github/workflows/label-sponsors.yaml@v4.4.3 \ No newline at end of file diff --git a/.github/workflows/labeller-content-based.yaml b/.github/workflows/labeller-content-based.yaml new file mode 100644 index 00000000..2faf2687 --- /dev/null +++ b/.github/workflows/labeller-content-based.yaml @@ -0,0 +1,19 @@ +--- +name: Labeller (content-based) +"on": + issues: + types: [opened] + pull_request: + types: [opened] + +# XXX Concurrency detection sucks and jobs gets killed randonmly. +# concurrency: +# # Group workflow jobs so new commits cancels in-progress execution triggered by previous commits. +# # Source: https://mail.python.org/archives/list/pypa-committers@python.org/thread/PCBCQMJF64JGRBOX7E2EE4YLKHT4DI55/ +# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} +# cancel-in-progress: true + +jobs: + + labeller: + uses: kdeldycke/workflows/.github/workflows/labeller-file-based.yaml@v4.4.3 \ No newline at end of file diff --git a/.github/workflows/labeller-file-based.yaml b/.github/workflows/labeller-file-based.yaml new file mode 100644 index 00000000..5a3c7d57 --- /dev/null +++ b/.github/workflows/labeller-file-based.yaml @@ -0,0 +1,16 @@ +--- +name: Labeller (file-based) +"on": + pull_request: + +# XXX Concurrency detection sucks and jobs gets killed randonmly. +# concurrency: +# # Group workflow jobs so new commits cancels in-progress execution triggered by previous commits. +# # Source: https://mail.python.org/archives/list/pypa-committers@python.org/thread/PCBCQMJF64JGRBOX7E2EE4YLKHT4DI55/ +# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} +# cancel-in-progress: true + +jobs: + + labeller: + uses: kdeldycke/workflows/.github/workflows/labeller-file-based.yaml@v4.4.3 diff --git a/.github/workflows/labels.yaml b/.github/workflows/labels.yaml new file mode 100644 index 00000000..b9a79f1b --- /dev/null +++ b/.github/workflows/labels.yaml @@ -0,0 +1,18 @@ +--- +name: Labels +"on": + push: + branches: + - main + +# XXX Concurrency detection sucks and jobs gets killed randonmly. +# concurrency: +# # Group workflow jobs so new commits cancels in-progress execution triggered by previous commits. +# # Source: https://mail.python.org/archives/list/pypa-committers@python.org/thread/PCBCQMJF64JGRBOX7E2EE4YLKHT4DI55/ +# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} +# cancel-in-progress: true + +jobs: + + labels: + uses: kdeldycke/workflows/.github/workflows/labels.yaml@v4.4.3 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 00000000..a645c6a2 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,19 @@ +--- +name: Lint +"on": + push: + branches: + - main + pull_request: + +# XXX Concurrency detection sucks and jobs gets killed randonmly. +# concurrency: +# # Group workflow jobs so new commits cancels in-progress execution triggered by previous commits. +# # Source: https://mail.python.org/archives/list/pypa-committers@python.org/thread/PCBCQMJF64JGRBOX7E2EE4YLKHT4DI55/ +# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} +# cancel-in-progress: true + +jobs: + + lint: + uses: kdeldycke/workflows/.github/workflows/lint.yaml@v4.4.3 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..5f093d57 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,15 @@ +--- +name: Build & release +"on": + # Target are chosen so that all commits get a chance to have their build tested. + push: + branches: + - main + pull_request: + +jobs: + + release: + uses: kdeldycke/workflows/.github/workflows/release.yaml@v4.4.3 + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 00000000..258b61a0 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,179 @@ +--- +name: Tests +"on": + push: + branches: + - main + pull_request: + schedule: + # Run tests every Monday at 9:17 to catch regressions. + - cron: "17 9 * * 1" + +# XXX Concurrency detection sucks and jobs gets killed randonmly. +# concurrency: +# # Group workflow jobs so new commits cancels in-progress execution triggered by previous commits. +# # Source: https://mail.python.org/archives/list/pypa-committers@python.org/thread/PCBCQMJF64JGRBOX7E2EE4YLKHT4DI55/ +# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} +# cancel-in-progress: true + +jobs: + + test-matrix: + # There is no way to selective flags collections of elements in a matrix, without having to flag all combinations. + # This will became unmaintainable and tedious so we use this job to pre-compute which jobs is going to get our + # "stable" flag. + name: "OS/Python/stable matrix pre-compute" + runs-on: ubuntu-22.04 + outputs: + test_matrix: ${{ steps.create_matrix.outputs.matrix }} + steps: + - name: Create JSON matrix + id: create_matrix + shell: python + run: | + import json + import os + from itertools import product + from pathlib import Path + + variants: dict[str, set[str]] = { + "os": { + # Available OSes: https://github.com/actions/runner-images#available-images + "ubuntu-22.04", + "ubuntu-20.04", + "macos-14", + "macos-13", + "windows-2022", + "windows-2019", + }, + "python-version": { + "3.9", + "3.10", + "3.11", + "3.12", + "3.13-dev", + }, + "click-version": { + "released", + "8.1.x", + "main", + }, + "cloup-version": { + "released", + "master", + } + } + # TODO: List of additional variants to include in the matrix. + include: list[dict[str, str]] = [] + + # List of variants to exclude from the matrix. + exclude: list[dict[str, str]] = [] + + # List of unstable criterions. + unstable: list[dict[str, str]] = [ + # Ignore failing tests on Click development branch, because some top-level classes (BaseCommand, + # MultiCommand and OptionParser) have been removed. See: + # https://github.com/pallets/click/compare/8.1.x...main#diff-768bcdbbdaa3001d4905761c3eed38d5ce6a62b9127df80de90d9ca4e806cacc + {"click-version": "main"}, + ] + + # Removes from the matrix some combinations for development versions of Click and Cloup. This reduce the size + # of the matrix for tests on non-released versions. While keeping the full exhaustive tests on the released + # versions of Click and Cloup. + for dev_version in ( + {"click-version": "8.1.x"}, + {"click-version": "main"}, + {"cloup-version": "master"}, + ): + for criterion in ( + # Exclude old OSes. Only keeps the latest OSes of each family. + {"os": "ubuntu-20.04"}, + {"os": "macos-13"}, + {"os": "windows-2019"}, + # Exclude Python's dev version. + {"python-version": "3.13-dev"}, + # Exclude intermediate Python version. Only test on oldest and newest released Python versions. + {"python-version": "3.9"}, + {"python-version": "3.10"}, + {"python-version": "3.11"}, + ): + exclude.append({**dev_version, **criterion}) + + # Build the job matrix. + jobs: list[dict[str, str]] = [] + for variants in product(*[{(key, value) for value in values} for key, values in variants.items()]): + job = dict(variants) + + # Match the job against the exclude criterions. + exclude_job = False + for criterion in exclude: + if set(criterion.items()).issubset(job.items()): + exclude_job = True + break + if exclude_job: + continue + + # Match the job against the unstable criterions. + job["state"] = "stable" + for criterion in unstable: + if set(criterion.items()).issubset(job.items()): + job["state"] = "unstable" + break + + jobs.append(job) + + matrix = json.dumps({"include": jobs}) + + env_file = Path(os.getenv("GITHUB_OUTPUT")) + env_file.write_text(f"matrix={matrix}") + + - name: Print JSON matrix + run: | + echo '${{ steps.create_matrix.outputs.matrix }}' + jq -aR <<< echo '${{ steps.create_matrix.outputs.matrix }}' + + tests: + needs: + - test-matrix + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.test-matrix.outputs.test_matrix) }} + name: | + [${{ matrix.state }}] + ${{ matrix.os }}, + Python ${{ matrix.python-version }}, + Click: ${{ matrix.click-version }}, + Cloup: ${{ matrix.cloup-version }} + runs-on: ${{ matrix.os }} + # We keep going when a job flagged as not stable fails. + continue-on-error: ${{ matrix.state == 'unstable' }} + steps: + - uses: actions/checkout@v4.1.7 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5.1.1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install uv + run: | + python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/v4.4.3/requirements/uv.txt + - name: Install project + run: | + uv --no-progress venv --system + uv --no-progress pip install --all-extras --requirement ./pyproject.toml . + + - name: Unittests + run: > + uv --no-progress run + ${{ matrix.click-version != 'released' + && format('--with "git+https://github.com/pallets/click.git@{0}"', matrix.click-version) || '' }} + ${{ matrix.cloup-version != 'released' + && format('--with "git+https://github.com/janluke/cloup.git@{0}"', matrix.cloup-version) || ''}} + -- + pytest + + - name: Codecov upload + uses: codecov/codecov-action@v4.5.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..0e33ad81 --- /dev/null +++ b/.gitignore @@ -0,0 +1,384 @@ +# Created by https://www.toptal.com/developers/gitignore/api/certificates,emacs,git,gpg,linux,macos,nohup,python,ssh,vim,virtualenv,visualstudiocode,windows +# Edit at https://www.toptal.com/developers/gitignore?templates=certificates,emacs,git,gpg,linux,macos,nohup,python,ssh,vim,virtualenv,visualstudiocode,windows + +### certificates ### +*.pem +*.key +*.crt +*.cer +*.der +*.priv + +### Emacs ### +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + + +### Git ### +# Created by git for backups. To disable backups in Git: +# $ git config --global mergetool.keepBackup false +*.orig + +# Created by git when using merge tools for conflicts +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* +*_BACKUP_*.txt +*_BASE_*.txt +*_LOCAL_*.txt +*_REMOTE_*.txt + +### GPG ### +secring.* + + +### Linux ### + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### Nohup ### +nohup.out + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +### SSH ### +**/.ssh/id_* +**/.ssh/*_id_* +**/.ssh/known_hosts + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### VirtualEnv ### +# Virtualenv +# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +[Ss]cripts +pyvenv.cfg +pip-selfcheck.json + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/certificates,emacs,git,gpg,linux,macos,nohup,python,ssh,vim,virtualenv,visualstudiocode,windows diff --git a/changelog.md b/changelog.md new file mode 100644 index 00000000..bdb1f0ef --- /dev/null +++ b/changelog.md @@ -0,0 +1,8 @@ +# Changelog + +## [1.0.0 (unreleased)](https://github.com/kdeldycke/extra-platforms/compare/90ddb60...main) + +> \[!IMPORTANT\] +> This version is not released yet and is under active development. + +- First version as a stand alone package extracted from `click-extra`. diff --git a/citation.cff b/citation.cff new file mode 100644 index 00000000..21e08228 --- /dev/null +++ b/citation.cff @@ -0,0 +1,15 @@ +cff-version: 1.2.0 +title: "Extra Platforms" +message: "If you use this software, please cite it as below." +type: software +authors: + - family-names: "Deldycke" + given-names: "Kevin" + email: kevin@deldycke.com + orcid: "https://orcid.org/0000-0001-9748-9014" +doi: 10.5281/zenodo.7116050 +version: 1.0.0 +# The release date is kept up to date by the external workflows. See: +# https://github.com/kdeldycke/workflows/blob/33b704b489c1aa18b7b7efbf963e153e91e1c810/.github/workflows/changelog.yaml#L135-L137 +date-released: 2024-08-14 +url: "https://github.com/kdeldycke/extra-platforms" \ No newline at end of file diff --git a/license b/license new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/license @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..25b3a53f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,141 @@ +[project] +# Docs: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/ +name = "extra-platforms" +version = "1.0.0" +# Python versions and their status: https://devguide.python.org/versions/ +requires-python = ">= 3.8" +description = "Detect platforms and group them by family" +authors = [{ name = "Kevin Deldycke", email = "kevin@deldycke.com" }] +readme = "readme.md" +keywords = ['multiplatform', 'pytest', 'python'] +classifiers = [ + # See: https://pypi.org/pypi?%3Aaction=list_classifiers + 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'Framework :: Pytest', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', + 'Operating System :: MacOS :: MacOS X', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: POSIX :: Linux', + "Programming Language :: Python :: 3", + "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 :: Implementation :: CPython', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Utilities', + 'Typing :: Typed', +] +dependencies = ["boltons ~= 24.0.0", "distro ~= 1.9.0"] + +[project.optional-dependencies] +pytest = ["pytest >= 8"] +test = [ + "coverage [toml] ~= 7.6.0", + "pytest ~= 8.3.1", + # More pytest plugins at: https://docs.pytest.org/en/latest/reference/plugin_list.html + "pytest-cov ~= 5.0.0", + "pytest-github-actions-annotate-failures ~= 0.2.0", + "pytest-randomly ~= 3.15.0", +] +docs = [ + "furo ~= 2024.8.6", + "myst-parser ~= 3.0.0", + # Sphinx 7.2.0 is the first version to drop Python 3.8. + "sphinx >= 7.2.0", + "sphinx-autodoc-typehints ~= 2.2.2", + "sphinx-copybutton ~= 0.5.2", + # sphinx-design 0.5.0 is the first to allow Sphinx 7. + "sphinx-design ~= 0.6.0", + "sphinx-issues ~= 4.1.0", + "sphinxcontrib-mermaid ~= 0.9.2", + "sphinxext-opengraph ~= 0.9.0", + "tomli ~= 2.0.1 ; python_version < '3.11'", +] + +[project.urls] +"Homepage" = 'https://github.com/kdeldycke/extra-platforms' +"Documentation" = 'https://kdeldycke.github.io/extra-platforms' +"Repository" = 'https://github.com/kdeldycke/extra-platforms' +"Funding" = "https://github.com/sponsors/kdeldycke" +"Issues" = "https://github.com/kdeldycke/extra-platforms/issues" +"Changelog" = "https://kdeldycke.github.io/extra-platforms/changelog.html" + +[project.entry-points.pytest11] +# Make additional fixtures available to pytest. +# See: https://docs.pytest.org/en/latest/how-to/writing_plugins.html#making-your-plugin-installable-by-others +extra-platforms = "extra_platforms.pytest" + +[tool.mypy] +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true +warn_return_any = true +warn_unreachable = true +pretty = true + +[[tool.mypy.overrides]] +ignore_missing_imports = true +module = ["boltons.*", "furo"] + +[tool.pytest.ini_options] +# https://docs.pytest.org/en/latest/customize.html#pyproject-toml +addopts = ["--durations=10", "--cov-report=term", "--cov-report=xml"] +# Make sure tests that are expected to fail do not resurect and start working all of a sudden. +xfail_strict = true + +# https://coverage.readthedocs.io/en/latest/config.html +[tool.coverage.run] +branch = true +[tool.coverage.report] +precision = 2 + +[tool.bumpversion] +current_version = "1.0.0" +allow_dirty = true + +# TODO: Reuse the same search and replace patterns available in the reused workflows' pyproject.toml. + +[[tool.bumpversion.files]] +# Update Python package version in any __init__.py file. +glob = "./**/__init__.py" +ignore_missing_version = true + +[[tool.bumpversion.files]] +# Update version in project section. +filename = "./pyproject.toml" +search = 'version = "{current_version}"' +replace = 'version = "{new_version}"' + +[[tool.bumpversion.files]] +# Update the version in standard Markdown changelog. +filename = "./changelog.md" +search = "## [{current_version} (unreleased)](" +replace = "## [{new_version} (unreleased)](" + +[[tool.bumpversion.files]] +# Update the version in the citation file. +filename = "./citation.cff" +search = "version: {current_version}" +replace = "version: {new_version}" + +[[tool.bumpversion.files]] +# Update the release date in the citation file. +filename = "./citation.cff" +regex = true +search = "date-released: \\d{{4}}-\\d{{2}}-\\d{{2}}" +replace = "date-released: {utcnow:%Y-%m-%d}" + +[tool.typos] +default.extend-ignore-identifiers-re = [ + # error: `PASE` should be `PASS`, `PACE`, `PARSE` + # --> ./extra_platforms/platforms.py:416:8 + # | + # 416 | - `PASE` + # | ^^^^ + # | + "PASE", +] diff --git a/readme.md b/readme.md new file mode 100644 index 00000000..b2cc9233 --- /dev/null +++ b/readme.md @@ -0,0 +1,33 @@ +# Extra Platforms + +[![Last release](https://img.shields.io/pypi/v/extra-platforms.svg)](https://pypi.python.org/pypi/extra-platforms) +[![Python versions](https://img.shields.io/pypi/pyversions/extra-platforms.svg)](https://pypi.python.org/pypi/extra-platforms) +[![Downloads](https://static.pepy.tech/badge/extra_platforms/month)](https://pepy.tech/project/extra_platforms) +[![Unittests status](https://github.com/kdeldycke/extra-platforms/actions/workflows/tests.yaml/badge.svg?branch=main)](https://github.com/kdeldycke/extra-platforms/actions/workflows/tests.yaml?query=branch%3Amain) +[![Coverage status](https://codecov.io/gh/kdeldycke/extra-platforms/branch/main/graph/badge.svg)](https://app.codecov.io/gh/kdeldycke/extra-platforms) +[![Documentation status](https://github.com/kdeldycke/extra-platforms/actions/workflows/docs.yaml/badge.svg?branch=main)](https://github.com/kdeldycke/extra-platforms/actions/workflows/docs.yaml?query=branch%3Amain) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7116050.svg)](https://doi.org/10.5281/zenodo.7116050) + +## What is Extra Platforms? + +> [!NOTE] +> TODO + +## Example + +> [!NOTE] +> TODO + + +## Used in + +Check these projects to get real-life examples of `extra-platforms` usage: + +- ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/click-extra?label=%E2%AD%90&style=flat-square) [Click Extra](https://github.com/kdeldycke/click-extra#readme) + \- A ready-to-use wrapper for Click. + +Feel free to send a PR to add your project in this list if you are relying on Click Extra in any way. + +## Development + +[Development guidelines](https://github.com/kdeldycke/click-extra?tab=readme-ov-file#development) are the same as [parent project Click Extra](https://github.com/kdeldycke/click-extra), from which `extra-platforms` originated.