From 3e67389abda04e7ef098bcbe246e96d165bc16c1 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Sat, 10 Aug 2024 16:42:54 +0200 Subject: [PATCH] chore: run copier copy again (#258) * chore: add copier as dev dep * chore: run poetry update * chore: run copier copy and solve issues * chore: clean up stale commitlint config file * chore: add ruff dev dep * chore: add codespell dev dep * chore: fail ci if codecov fails --- .all-contributorsrc | 4 +- .codespellrc | 2 + .copier-answers.yml | 22 + .github/CODE_OF_CONDUCT.md | 127 ++ .github/ISSUE_TEMPLATE/1-bug-report.yml | 62 + .github/ISSUE_TEMPLATE/2-feature-request.yml | 48 + .github/ISSUE_TEMPLATE/config.yml | 8 + .github/PULL_REQUEST_TEMPLATE.md | 48 + .github/labels.toml | 5 + .github/workflows/ci.yml | 112 +- .github/workflows/labels.yml | 2 +- .github/workflows/poetry-upgrade.yml | 12 + .gitignore | 6 +- .idea/watcherTasks.xml | 2 +- .pre-commit-config.yaml | 53 +- .readthedocs.yml | 12 +- README.md | 16 +- commitlint.config.js => commitlint.config.mjs | 2 +- docs/Makefile | 6 +- docs/__init__.py | 1 + docs/changelog.md | 2 + docs/conf.py | 35 +- docs/contributing.md | 2 + docs/installation.md | 4 + poetry.lock | 1836 +++++++++-------- pyproject.toml | 191 +- setup.py | 6 +- src/aiovlc/__main__.py | 5 + src/aiovlc/{cli/client_command.py => cli.py} | 61 +- src/aiovlc/cli/__init__.py | 27 - src/aiovlc/client.py | 26 +- src/aiovlc/model/command.py | 19 +- templates/CHANGELOG.md.j2 | 17 + tests/conftest.py | 2 +- tests/model/test_command.py | 28 +- tests/test_cli.py | 14 + tests/test_client.py | 3 +- tests/test_dunder_main.py | 15 + tests/test_pytest.py | 6 - 39 files changed, 1742 insertions(+), 1107 deletions(-) create mode 100644 .codespellrc create mode 100644 .copier-answers.yml create mode 100644 .github/CODE_OF_CONDUCT.md create mode 100644 .github/ISSUE_TEMPLATE/1-bug-report.yml create mode 100644 .github/ISSUE_TEMPLATE/2-feature-request.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/poetry-upgrade.yml rename commitlint.config.js => commitlint.config.mjs (92%) create mode 100644 docs/__init__.py mode change 100644 => 100755 setup.py create mode 100644 src/aiovlc/__main__.py rename src/aiovlc/{cli/client_command.py => cli.py} (51%) delete mode 100644 src/aiovlc/cli/__init__.py create mode 100644 templates/CHANGELOG.md.j2 create mode 100644 tests/test_cli.py create mode 100644 tests/test_dunder_main.py delete mode 100644 tests/test_pytest.py diff --git a/.all-contributorsrc b/.all-contributorsrc index 1bce057..0ce8cab 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -3,7 +3,9 @@ "projectOwner": "MartinHjelmare", "repoType": "github", "repoHost": "https://github.com", - "files": ["README.md"], + "files": [ + "README.md" + ], "imageSize": 80, "commit": true, "commitConvention": "angular", diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000..f76defe --- /dev/null +++ b/.codespellrc @@ -0,0 +1,2 @@ +[codespell] +ignore-words-list = socio-economic diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 0000000..b5e8b10 --- /dev/null +++ b/.copier-answers.yml @@ -0,0 +1,22 @@ +# Changes here will be overwritten by Copier +_commit: 6ea1260 +_src_path: https://github.com/browniebroke/pypackage-template +add_me_as_contributor: false +cli_name: aiovlc +copyright_year: '2023' +documentation: true +email: marhje52@gmail.com +full_name: Martin Hjelmare +github_username: MartinHjelmare +has_cli: true +initial_commit: false +is_django_package: false +open_source_license: Apache Software License 2.0 +package_name: aiovlc +project_name: aiovlc +project_short_description: Control VLC over telnet connection using asyncio +project_slug: aiovlc +run_poetry_install: false +setup_github: false +setup_pre_commit: true + diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..36875d5 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,127 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders 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, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting @MartinHjelmare. All complaints will be reviewed and +investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.yml b/.github/ISSUE_TEMPLATE/1-bug-report.yml new file mode 100644 index 0000000..de0c481 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1-bug-report.yml @@ -0,0 +1,62 @@ +name: Bug report +description: Create a report to help us improve +labels: [bug] +body: + - type: textarea + id: description + attributes: + label: Describe the bug + description: A clear and concise description of what the bug is. + placeholder: Describe the bug + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: To Reproduce + description: Steps to reproduce the behavior. + placeholder: To Reproduce + validations: + required: true + - type: textarea + id: context + attributes: + label: Additional context + description: Add any other context about the problem here. + placeholder: Additional context + - type: input + id: version + attributes: + label: Version + description: Version of the project. + placeholder: Version + validations: + required: true + - type: input + id: platform + attributes: + label: Platform + description: Platform where the bug was found. + placeholder: "Example: Windows 11 / macOS 12.0.1 / Ubuntu 20.04" + validations: + required: true + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our + [Code of Conduct](https://github.com/MartinHjelmare/aiovlc/blob/main/.github/CODE_OF_CONDUCT.md). + options: + - label: I agree to follow this project's Code of Conduct. + required: true + - type: checkboxes + id: no-duplicate + attributes: + label: No Duplicate + description: Please check [existing issues](https://github.com/MartinHjelmare/aiovlc/issues) to avoid duplicates. + options: + - label: I have checked existing issues to avoid duplicates. + required: true + - type: markdown + attributes: + value: 👋 Have a great day and thank you for the bug report! diff --git a/.github/ISSUE_TEMPLATE/2-feature-request.yml b/.github/ISSUE_TEMPLATE/2-feature-request.yml new file mode 100644 index 0000000..b30c6e3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2-feature-request.yml @@ -0,0 +1,48 @@ +name: Feature request +description: Suggest an idea for this project +labels: [enhancement] +body: + - type: textarea + id: description + attributes: + label: Is your feature request related to a problem? Please describe. + description: A clear and concise description of what the problem is. + value: I'm always frustrated when + validations: + required: true + - type: textarea + id: solution + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + placeholder: Describe alternatives you've considered + validations: + required: true + - type: textarea + id: context + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. + placeholder: Additional context + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our + [Code of Conduct](https://github.com/MartinHjelmare/aiovlc/blob/main/.github/CODE_OF_CONDUCT.md). + options: + - label: I agree to follow this project's Code of Conduct + required: true + - type: checkboxes + id: willing + attributes: + label: Are you willing to resolve this issue by submitting a Pull Request? + description: Remember that first-time contributors are welcome! 🙌 + options: + - label: Yes, I have the time, and I know how to start. + - label: Yes, I have the time, but I don't know how to start. I would need guidance. + - label: No, I don't have the time, although I believe I could do it if I had the time... + - label: No, I don't have the time and I wouldn't even know how to start. + - type: markdown + attributes: + value: 👋 Have a great day and thank you for the feature request! diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..d396ea9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +# Disabling blank issues to ensure all necessary information is provided +# Users should use the provided templates for specific issues +# For general questions, please refer to the contact links section +blank_issues_enabled: false +contact_links: + - name: Questions + url: https://github.com/MartinHjelmare/aiovlc/discussions/categories/q-a + about: Please ask and answer questions here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..b7187b1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,48 @@ + + +### Description of change + + + +### Pull-Request Checklist + + + +- [ ] Code is up-to-date with the `main` branch +- [ ] This pull request follows the [contributing guidelines](https://github.com/MartinHjelmare/aiovlc/blob/main/CONTRIBUTING.md). +- [ ] This pull request links relevant issues as `Fixes #0000` +- [ ] There are new or updated unit tests validating the change +- [ ] Documentation has been updated to reflect this change +- [ ] The new commits follow conventions outlined in the [conventional commit spec](https://www.conventionalcommits.org/en/v1.0.0/), such as "fix(api): prevent racing of requests". + +> - If pre-commit.ci is failing, try `pre-commit run -a` for further information. +> - If CI / test is failing, try `poetry run pytest` for further information. + + diff --git a/.github/labels.toml b/.github/labels.toml index 56865be..e166aef 100644 --- a/.github/labels.toml +++ b/.github/labels.toml @@ -92,3 +92,8 @@ description = "Automatically closes as answered after a delay" color = "5f7972" name = "waiting" description = "Automatically closes if no answer after a delay" + +[fund] +color = "0E8A16" +name = "fund" +description = "Add a section linking to polar.sh for funding the issue." diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1154449..9c3ef7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,112 @@ on: - "renovate/**" pull_request: +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: - psr-ci: - uses: MartinHjelmare/github-actions-workflows/.github/workflows/psr-ci.yml@main - secrets: - PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - uses: pre-commit/action@v3.0.1 + + # Make sure commit messages follow the conventional commits convention: + # https://www.conventionalcommits.org + commitlint: + name: Lint Commit Messages + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: wagoid/commitlint-github-action@v6.0.1 + + test: + strategy: + fail-fast: false + matrix: + python-version: + - "3.9" + - "3.10" + - "3.11" + - "3.12" + os: + - ubuntu-latest + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Install poetry + run: pipx install poetry + - name: Set up Python + uses: actions/setup-python@v5 + id: setup-python + with: + python-version: ${{ matrix.python-version }} + cache: poetry + - name: Install Dependencies + run: poetry install + shell: bash + - name: Test with Pytest + run: poetry run pytest + shell: bash + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + + release: + needs: + - test + - lint + - commitlint + + runs-on: ubuntu-latest + environment: release + concurrency: release + permissions: + id-token: write + attestations: write + contents: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.head_ref || github.ref_name }} + + # Do a dry run of PSR + - name: Test release + uses: python-semantic-release/python-semantic-release@v9.8.1 + if: github.ref_name != 'main' + with: + root_options: --noop + + # On main branch: actual PSR + upload to PyPI & GitHub + - name: Release + uses: python-semantic-release/python-semantic-release@v9.8.1 + id: release + if: github.ref_name == 'main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Attest build provenance + uses: actions/attest-build-provenance@v1 + if: steps.release.outputs.released == 'true' + with: + subject-path: "dist/*" + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: steps.release.outputs.released == 'true' + + - name: Publish package distributions to GitHub Releases + uses: python-semantic-release/upload-to-gh-release@main + if: steps.release.outputs.released == 'true' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index d67241f..db158e9 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: 3.x - name: Install labels run: pip install labels - name: Sync config with Github diff --git a/.github/workflows/poetry-upgrade.yml b/.github/workflows/poetry-upgrade.yml new file mode 100644 index 0000000..48251e9 --- /dev/null +++ b/.github/workflows/poetry-upgrade.yml @@ -0,0 +1,12 @@ +name: Upgrader + +on: + workflow_dispatch: + schedule: + - cron: "47 18 23 * *" + +jobs: + upgrade: + uses: browniebroke/github-actions/.github/workflows/poetry-upgrade.yml@v1 + secrets: + gh_pat: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 83ab52a..a9908e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +# Created by .ignore support plugin (hsz.mobi) +### Python template # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -113,11 +115,11 @@ ENV/ env.bak/ venv.bak/ -# Spyder project settings +# Spyder aiovlc settings .spyderproject .spyproject -# Rope project settings +# Rope aiovlc settings .ropeproject # mkdocs documentation diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml index 08066ab..22b6eba 100644 --- a/.idea/watcherTasks.xml +++ b/.idea/watcherTasks.xml @@ -42,7 +42,7 @@ -