Added cookiecutter.
Some checks failed
Tests / tests 3.10 / macos-latest (push) Has been cancelled
Tests / docs-build 3.10 / ubuntu-latest (push) Has been cancelled
Tests / mypy 3.10 / ubuntu-latest (push) Has been cancelled
Tests / pre-commit 3.10 / ubuntu-latest (push) Has been cancelled
Tests / safety 3.10 / ubuntu-latest (push) Has been cancelled
Tests / tests 3.10 / ubuntu-latest (push) Has been cancelled
Tests / typeguard 3.10 / ubuntu-latest (push) Has been cancelled
Tests / xdoctest 3.10 / ubuntu-latest (push) Has been cancelled
Tests / mypy 3.7 / ubuntu-latest (push) Has been cancelled
Tests / tests 3.7 / ubuntu-latest (push) Has been cancelled
Tests / mypy 3.8 / ubuntu-latest (push) Has been cancelled
Tests / tests 3.8 / ubuntu-latest (push) Has been cancelled
Tests / mypy 3.9 / ubuntu-latest (push) Has been cancelled
Tests / tests 3.9 / ubuntu-latest (push) Has been cancelled
Tests / tests 3.10 / windows-latest (push) Has been cancelled
Tests / coverage (push) Has been cancelled
Some checks failed
Tests / tests 3.10 / macos-latest (push) Has been cancelled
Tests / docs-build 3.10 / ubuntu-latest (push) Has been cancelled
Tests / mypy 3.10 / ubuntu-latest (push) Has been cancelled
Tests / pre-commit 3.10 / ubuntu-latest (push) Has been cancelled
Tests / safety 3.10 / ubuntu-latest (push) Has been cancelled
Tests / tests 3.10 / ubuntu-latest (push) Has been cancelled
Tests / typeguard 3.10 / ubuntu-latest (push) Has been cancelled
Tests / xdoctest 3.10 / ubuntu-latest (push) Has been cancelled
Tests / mypy 3.7 / ubuntu-latest (push) Has been cancelled
Tests / tests 3.7 / ubuntu-latest (push) Has been cancelled
Tests / mypy 3.8 / ubuntu-latest (push) Has been cancelled
Tests / tests 3.8 / ubuntu-latest (push) Has been cancelled
Tests / mypy 3.9 / ubuntu-latest (push) Has been cancelled
Tests / tests 3.9 / ubuntu-latest (push) Has been cancelled
Tests / tests 3.10 / windows-latest (push) Has been cancelled
Tests / coverage (push) Has been cancelled
Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
This commit is contained in:
14
.cookiecutter.json
Normal file
14
.cookiecutter.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"_output_dir": "/home/darkhelm/Projects/DarkHelm.org/plex-playlist/temp",
|
||||
"_template": "gh:cjolowicz/cookiecutter-hypermodern-python",
|
||||
"author": "Cliff Hill",
|
||||
"copyright_year": "2025",
|
||||
"development_status": "Development Status :: 2 - Pre-Alpha",
|
||||
"email": "xlorep@darkhelm.org",
|
||||
"friendly_name": "Plex Playlist",
|
||||
"github_user": "xlorepdarkhelm",
|
||||
"license": "Apache-2.0",
|
||||
"package_name": "playlist",
|
||||
"project_name": "plex-playlist",
|
||||
"version": "0.0.0"
|
||||
}
|
||||
9
.flake8
Normal file
9
.flake8
Normal file
@@ -0,0 +1,9 @@
|
||||
[flake8]
|
||||
select = B,B9,C,D,DAR,E,F,N,RST,S,W
|
||||
ignore = E203,E501,RST201,RST203,RST301,W503
|
||||
max-line-length = 80
|
||||
max-complexity = 10
|
||||
docstring-convention = google
|
||||
per-file-ignores = tests/*:S101
|
||||
rst-roles = class,const,func,meth,mod,ref
|
||||
rst-directives = deprecated
|
||||
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* text=auto eol=lf
|
||||
3
.github/dependabot.yml
vendored
3
.github/dependabot.yml
vendored
@@ -16,3 +16,6 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
versioning-strategy: lockfile-only
|
||||
allow:
|
||||
- dependency-type: "all"
|
||||
|
||||
10
.github/workflows/constraints.txt
vendored
10
.github/workflows/constraints.txt
vendored
@@ -1,5 +1,5 @@
|
||||
pip==21.0.1
|
||||
nox==2020.12.31
|
||||
nox-poetry==0.8.2
|
||||
poetry==1.1.5
|
||||
virtualenv==20.4.2
|
||||
pip==22.1.2
|
||||
nox==2022.1.7
|
||||
nox-poetry==1.0.0
|
||||
poetry==1.1.13
|
||||
virtualenv==20.14.1
|
||||
|
||||
4
.github/workflows/labeler.yml
vendored
4
.github/workflows/labeler.yml
vendored
@@ -11,9 +11,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v2.3.3
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Run Labeler
|
||||
uses: crazy-max/ghaction-github-labeler@v3.1.1
|
||||
uses: crazy-max/ghaction-github-labeler@v4.0.0
|
||||
with:
|
||||
skip-delete: true
|
||||
|
||||
12
.github/workflows/release.yml
vendored
12
.github/workflows/release.yml
vendored
@@ -12,14 +12,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v2.3.4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2.2.1
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: "3.9"
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Upgrade pip
|
||||
run: |
|
||||
@@ -57,21 +57,21 @@ jobs:
|
||||
|
||||
- name: Publish package on PyPI
|
||||
if: steps.check-version.outputs.tag
|
||||
uses: pypa/gh-action-pypi-publish@v1.4.2
|
||||
uses: pypa/gh-action-pypi-publish@v1.5.0
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.PYPI_TOKEN }}
|
||||
|
||||
- name: Publish package on TestPyPI
|
||||
if: "! steps.check-version.outputs.tag"
|
||||
uses: pypa/gh-action-pypi-publish@v1.4.2
|
||||
uses: pypa/gh-action-pypi-publish@v1.5.0
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.TEST_PYPI_TOKEN }}
|
||||
repository_url: https://test.pypi.org/legacy/
|
||||
|
||||
- name: Publish the release notes
|
||||
uses: release-drafter/release-drafter@v5.14.0
|
||||
uses: release-drafter/release-drafter@v5.20.0
|
||||
with:
|
||||
publish: ${{ steps.check-version.outputs.tag != '' }}
|
||||
tag: ${{ steps.check-version.outputs.tag }}
|
||||
|
||||
85
.github/workflows/tests.yml
vendored
85
.github/workflows/tests.yml
vendored
@@ -6,53 +6,65 @@ on:
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: ${{ matrix.session }} ${{ matrix.python-version }} / ${{ matrix.os }}
|
||||
name: ${{ matrix.session }} ${{ matrix.python }} / ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { python-version: 3.9, os: ubuntu-latest, session: "pre-commit" }
|
||||
- { python-version: 3.9, os: ubuntu-latest, session: "safety" }
|
||||
- { python-version: 3.9, os: ubuntu-latest, session: "mypy" }
|
||||
- { python-version: 3.8, os: ubuntu-latest, session: "mypy" }
|
||||
- { python-version: 3.7, os: ubuntu-latest, session: "mypy" }
|
||||
- { python-version: 3.6, os: ubuntu-latest, session: "mypy" }
|
||||
- { python-version: 3.9, os: ubuntu-latest, session: "tests" }
|
||||
- { python-version: 3.8, os: ubuntu-latest, session: "tests" }
|
||||
- { python-version: 3.7, os: ubuntu-latest, session: "tests" }
|
||||
- { python-version: 3.6, os: ubuntu-latest, session: "tests" }
|
||||
- { python-version: 3.9, os: windows-latest, session: "tests" }
|
||||
- { python-version: 3.9, os: macos-latest, session: "tests" }
|
||||
- { python-version: 3.9, os: ubuntu-latest, session: "typeguard" }
|
||||
- { python-version: 3.9, os: ubuntu-latest, session: "xdoctest" }
|
||||
- { python-version: 3.8, os: ubuntu-latest, session: "docs-build" }
|
||||
- { python: "3.10", os: "ubuntu-latest", session: "pre-commit" }
|
||||
- { python: "3.10", os: "ubuntu-latest", session: "safety" }
|
||||
- { python: "3.10", os: "ubuntu-latest", session: "mypy" }
|
||||
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
|
||||
- { python: "3.8", os: "ubuntu-latest", session: "mypy" }
|
||||
- { python: "3.7", os: "ubuntu-latest", session: "mypy" }
|
||||
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
|
||||
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
|
||||
- { python: "3.8", os: "ubuntu-latest", session: "tests" }
|
||||
- { python: "3.7", os: "ubuntu-latest", session: "tests" }
|
||||
- { python: "3.10", os: "windows-latest", session: "tests" }
|
||||
- { python: "3.10", os: "macos-latest", session: "tests" }
|
||||
- { python: "3.10", os: "ubuntu-latest", session: "typeguard" }
|
||||
- { python: "3.10", os: "ubuntu-latest", session: "xdoctest" }
|
||||
- { python: "3.10", os: "ubuntu-latest", session: "docs-build" }
|
||||
|
||||
env:
|
||||
NOXSESSION: ${{ matrix.session }}
|
||||
FORCE_COLOR: "1"
|
||||
PRE_COMMIT_COLOR: "always"
|
||||
|
||||
steps:
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v2.3.4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2.2.1
|
||||
- name: Set up Python ${{ matrix.python }}
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
python-version: ${{ matrix.python }}
|
||||
|
||||
- name: Upgrade pip
|
||||
run: |
|
||||
pip install --constraint=.github/workflows/constraints.txt pip
|
||||
pip --version
|
||||
|
||||
- name: Upgrade pip in virtual environments
|
||||
shell: python
|
||||
run: |
|
||||
import os
|
||||
import pip
|
||||
|
||||
with open(os.environ["GITHUB_ENV"], mode="a") as io:
|
||||
print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
|
||||
|
||||
- name: Install Poetry
|
||||
run: |
|
||||
pip install --constraint=.github/workflows/constraints.txt poetry
|
||||
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
|
||||
poetry --version
|
||||
|
||||
- name: Install Nox
|
||||
run: |
|
||||
pip install --constraint=.github/workflows/constraints.txt nox nox-poetry
|
||||
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
|
||||
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
|
||||
nox --version
|
||||
|
||||
- name: Compute pre-commit cache key
|
||||
@@ -71,7 +83,7 @@ jobs:
|
||||
print("::set-output name=result::{}".format(result))
|
||||
|
||||
- name: Restore pre-commit cache
|
||||
uses: actions/cache@v2.1.4
|
||||
uses: actions/cache@v3
|
||||
if: matrix.session == 'pre-commit'
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
@@ -81,18 +93,18 @@ jobs:
|
||||
|
||||
- name: Run Nox
|
||||
run: |
|
||||
nox --force-color --python=${{ matrix.python-version }}
|
||||
nox --python=${{ matrix.python }}
|
||||
|
||||
- name: Upload coverage data
|
||||
if: always() && matrix.session == 'tests'
|
||||
uses: "actions/upload-artifact@v2.2.2"
|
||||
uses: "actions/upload-artifact@v3"
|
||||
with:
|
||||
name: coverage-data
|
||||
path: ".coverage.*"
|
||||
|
||||
- name: Upload documentation
|
||||
if: matrix.session == 'docs-build'
|
||||
uses: actions/upload-artifact@v2.2.2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: docs
|
||||
path: docs/_build
|
||||
@@ -102,12 +114,12 @@ jobs:
|
||||
needs: tests
|
||||
steps:
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v2.3.4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python 3.9
|
||||
uses: actions/setup-python@v2.2.1
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: 3.9
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Upgrade pip
|
||||
run: |
|
||||
@@ -116,26 +128,27 @@ jobs:
|
||||
|
||||
- name: Install Poetry
|
||||
run: |
|
||||
pip install --constraint=.github/workflows/constraints.txt poetry
|
||||
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
|
||||
poetry --version
|
||||
|
||||
- name: Install Nox
|
||||
run: |
|
||||
pip install --constraint=.github/workflows/constraints.txt nox nox-poetry
|
||||
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
|
||||
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
|
||||
nox --version
|
||||
|
||||
- name: Download coverage data
|
||||
uses: actions/download-artifact@v2.0.8
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: coverage-data
|
||||
|
||||
- name: Combine coverage data and display human readable report
|
||||
run: |
|
||||
nox --force-color --session=coverage
|
||||
nox --session=coverage
|
||||
|
||||
- name: Create coverage report
|
||||
run: |
|
||||
nox --force-color --session=coverage -- xml
|
||||
nox --session=coverage -- xml
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: codecov/codecov-action@v1.2.2
|
||||
uses: codecov/codecov-action@v3.1.0
|
||||
|
||||
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
.mypy_cache/
|
||||
/.coverage
|
||||
/.coverage.*
|
||||
/.nox/
|
||||
/.python-version
|
||||
/.pytype/
|
||||
/dist/
|
||||
/docs/_build/
|
||||
/src/*.egg-info/
|
||||
__pycache__/
|
||||
66
.pre-commit-config.yaml
Normal file
66
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,66 @@
|
||||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: black
|
||||
name: black
|
||||
entry: black
|
||||
language: system
|
||||
types: [python]
|
||||
require_serial: true
|
||||
- id: check-added-large-files
|
||||
name: Check for added large files
|
||||
entry: check-added-large-files
|
||||
language: system
|
||||
- id: check-toml
|
||||
name: Check Toml
|
||||
entry: check-toml
|
||||
language: system
|
||||
types: [toml]
|
||||
- id: check-yaml
|
||||
name: Check Yaml
|
||||
entry: check-yaml
|
||||
language: system
|
||||
types: [yaml]
|
||||
- id: darglint
|
||||
name: darglint
|
||||
entry: darglint
|
||||
language: system
|
||||
types: [python]
|
||||
stages: [manual]
|
||||
- id: end-of-file-fixer
|
||||
name: Fix End of Files
|
||||
entry: end-of-file-fixer
|
||||
language: system
|
||||
types: [text]
|
||||
stages: [commit, push, manual]
|
||||
- id: flake8
|
||||
name: flake8
|
||||
entry: flake8
|
||||
language: system
|
||||
types: [python]
|
||||
require_serial: true
|
||||
args: [--darglint-ignore-regex, .*]
|
||||
- id: isort
|
||||
name: isort
|
||||
entry: isort
|
||||
require_serial: true
|
||||
language: system
|
||||
types_or: [cython, pyi, python]
|
||||
args: ["--filter-files"]
|
||||
- id: pyupgrade
|
||||
name: pyupgrade
|
||||
description: Automatically upgrade syntax for newer versions.
|
||||
entry: pyupgrade
|
||||
language: system
|
||||
types: [python]
|
||||
args: [--py37-plus]
|
||||
- id: trailing-whitespace
|
||||
name: Trim Trailing Whitespace
|
||||
entry: trailing-whitespace-fixer
|
||||
language: system
|
||||
types: [text]
|
||||
stages: [commit, push, manual]
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v2.6.0
|
||||
hooks:
|
||||
- id: prettier
|
||||
12
.readthedocs.yml
Normal file
12
.readthedocs.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
version: 2
|
||||
build:
|
||||
os: ubuntu-20.04
|
||||
tools:
|
||||
python: "3.10"
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
formats: all
|
||||
python:
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
||||
- path: .
|
||||
132
CODE_OF_CONDUCT.md
Normal file
132
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,132 @@
|
||||
# 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, caste, color, 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 to the community leaders responsible for enforcement at
|
||||
[xlorep@darkhelm.org](mailto:xlorep@darkhelm.org).
|
||||
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.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][mozilla coc].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][faq]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[mozilla coc]: https://github.com/mozilla/diversity
|
||||
[faq]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
115
CONTRIBUTING.md
Normal file
115
CONTRIBUTING.md
Normal file
@@ -0,0 +1,115 @@
|
||||
# Contributor Guide
|
||||
|
||||
Thank you for your interest in improving this project.
|
||||
This project is open-source under the [Apache 2.0 license] and
|
||||
welcomes contributions in the form of bug reports, feature requests, and pull requests.
|
||||
|
||||
Here is a list of important resources for contributors:
|
||||
|
||||
- [Source Code]
|
||||
- [Documentation]
|
||||
- [Issue Tracker]
|
||||
- [Code of Conduct]
|
||||
|
||||
[apache 2.0 license]: https://opensource.org/licenses/Apache-2.0
|
||||
[source code]: https://github.com/xlorepdarkhelm/plex-playlist
|
||||
[documentation]: https://plex-playlist.readthedocs.io/
|
||||
[issue tracker]: https://github.com/xlorepdarkhelm/plex-playlist/issues
|
||||
|
||||
## How to report a bug
|
||||
|
||||
Report bugs on the [Issue Tracker].
|
||||
|
||||
When filing an issue, make sure to answer these questions:
|
||||
|
||||
- Which operating system and Python version are you using?
|
||||
- Which version of this project are you using?
|
||||
- What did you do?
|
||||
- What did you expect to see?
|
||||
- What did you see instead?
|
||||
|
||||
The best way to get your bug fixed is to provide a test case,
|
||||
and/or steps to reproduce the issue.
|
||||
|
||||
## How to request a feature
|
||||
|
||||
Request features on the [Issue Tracker].
|
||||
|
||||
## How to set up your development environment
|
||||
|
||||
You need Python 3.7+ and the following tools:
|
||||
|
||||
- [Poetry]
|
||||
- [Nox]
|
||||
- [nox-poetry]
|
||||
|
||||
Install the package with development requirements:
|
||||
|
||||
```console
|
||||
$ poetry install
|
||||
```
|
||||
|
||||
You can now run an interactive Python session,
|
||||
or the command-line interface:
|
||||
|
||||
```console
|
||||
$ poetry run python
|
||||
$ poetry run plex-playlist
|
||||
```
|
||||
|
||||
[poetry]: https://python-poetry.org/
|
||||
[nox]: https://nox.thea.codes/
|
||||
[nox-poetry]: https://nox-poetry.readthedocs.io/
|
||||
|
||||
## How to test the project
|
||||
|
||||
Run the full test suite:
|
||||
|
||||
```console
|
||||
$ nox
|
||||
```
|
||||
|
||||
List the available Nox sessions:
|
||||
|
||||
```console
|
||||
$ nox --list-sessions
|
||||
```
|
||||
|
||||
You can also run a specific Nox session.
|
||||
For example, invoke the unit test suite like this:
|
||||
|
||||
```console
|
||||
$ nox --session=tests
|
||||
```
|
||||
|
||||
Unit tests are located in the _tests_ directory,
|
||||
and are written using the [pytest] testing framework.
|
||||
|
||||
[pytest]: https://pytest.readthedocs.io/
|
||||
|
||||
## How to submit changes
|
||||
|
||||
Open a [pull request] to submit changes to this project.
|
||||
|
||||
Your pull request needs to meet the following guidelines for acceptance:
|
||||
|
||||
- The Nox test suite must pass without errors and warnings.
|
||||
- Include unit tests. This project maintains 100% code coverage.
|
||||
- If your changes add functionality, update the documentation accordingly.
|
||||
|
||||
Feel free to submit early, though—we can always iterate on this.
|
||||
|
||||
To run linting and code formatting checks before committing your change, you can install pre-commit as a Git hook by running the following command:
|
||||
|
||||
```console
|
||||
$ nox --session=pre-commit -- install
|
||||
```
|
||||
|
||||
It is recommended to open an issue before starting work on anything.
|
||||
This will allow a chance to talk it over with the owners and validate your approach.
|
||||
|
||||
[pull request]: https://github.com/xlorepdarkhelm/plex-playlist/pulls
|
||||
|
||||
<!-- github-only -->
|
||||
|
||||
[code of conduct]: CODE_OF_CONDUCT.md
|
||||
217
LICENSE
Normal file
217
LICENSE
Normal file
@@ -0,0 +1,217 @@
|
||||
Copyright 2025 Cliff Hill
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
73
README.md
Normal file
73
README.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# Plex Playlist
|
||||
|
||||
[][pypi_]
|
||||
[][status]
|
||||
[][python version]
|
||||
[][license]
|
||||
|
||||
[][read the docs]
|
||||
[][tests]
|
||||
[][codecov]
|
||||
|
||||
[][pre-commit]
|
||||
[][black]
|
||||
|
||||
[pypi_]: https://pypi.org/project/plex-playlist/
|
||||
[status]: https://pypi.org/project/plex-playlist/
|
||||
[python version]: https://pypi.org/project/plex-playlist
|
||||
[read the docs]: https://plex-playlist.readthedocs.io/
|
||||
[tests]: https://github.com/xlorepdarkhelm/plex-playlist/actions?workflow=Tests
|
||||
[codecov]: https://app.codecov.io/gh/xlorepdarkhelm/plex-playlist
|
||||
[pre-commit]: https://github.com/pre-commit/pre-commit
|
||||
[black]: https://github.com/psf/black
|
||||
|
||||
## Features
|
||||
|
||||
- TODO
|
||||
|
||||
## Requirements
|
||||
|
||||
- TODO
|
||||
|
||||
## Installation
|
||||
|
||||
You can install _Plex Playlist_ via [pip] from [PyPI]:
|
||||
|
||||
```console
|
||||
$ pip install plex-playlist
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Please see the [Command-line Reference] for details.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are very welcome.
|
||||
To learn more, see the [Contributor Guide].
|
||||
|
||||
## License
|
||||
|
||||
Distributed under the terms of the [Apache 2.0 license][license],
|
||||
_Plex Playlist_ is free and open source software.
|
||||
|
||||
## Issues
|
||||
|
||||
If you encounter any problems,
|
||||
please [file an issue] along with a detailed description.
|
||||
|
||||
## Credits
|
||||
|
||||
This project was generated from [@cjolowicz]'s [Hypermodern Python Cookiecutter] template.
|
||||
|
||||
[@cjolowicz]: https://github.com/cjolowicz
|
||||
[pypi]: https://pypi.org/
|
||||
[hypermodern python cookiecutter]: https://github.com/cjolowicz/cookiecutter-hypermodern-python
|
||||
[file an issue]: https://github.com/xlorepdarkhelm/plex-playlist/issues
|
||||
[pip]: https://pip.pypa.io/
|
||||
|
||||
<!-- github-only -->
|
||||
|
||||
[license]: https://github.com/xlorepdarkhelm/plex-playlist/blob/main/LICENSE
|
||||
[contributor guide]: https://github.com/xlorepdarkhelm/plex-playlist/blob/main/CONTRIBUTING.md
|
||||
[command-line reference]: https://plex-playlist.readthedocs.io/en/latest/usage.html
|
||||
9
codecov.yml
Normal file
9
codecov.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
comment: false
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
target: "100"
|
||||
patch:
|
||||
default:
|
||||
target: "100"
|
||||
3
docs/codeofconduct.md
Normal file
3
docs/codeofconduct.md
Normal file
@@ -0,0 +1,3 @@
|
||||
```{include} ../CODE_OF_CONDUCT.md
|
||||
|
||||
```
|
||||
12
docs/conf.py
Normal file
12
docs/conf.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""Sphinx configuration."""
|
||||
project = "Plex Playlist"
|
||||
author = "Cliff Hill"
|
||||
copyright = "2025, Cliff Hill"
|
||||
extensions = [
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.napoleon",
|
||||
"sphinx_click",
|
||||
"myst_parser",
|
||||
]
|
||||
autodoc_typehints = "description"
|
||||
html_theme = "furo"
|
||||
7
docs/contributing.md
Normal file
7
docs/contributing.md
Normal file
@@ -0,0 +1,7 @@
|
||||
```{include} ../CONTRIBUTING.md
|
||||
---
|
||||
end-before: <!-- github-only -->
|
||||
---
|
||||
```
|
||||
|
||||
[code of conduct]: codeofconduct
|
||||
23
docs/index.md
Normal file
23
docs/index.md
Normal file
@@ -0,0 +1,23 @@
|
||||
```{include} ../README.md
|
||||
---
|
||||
end-before: <!-- github-only -->
|
||||
---
|
||||
```
|
||||
|
||||
[license]: license
|
||||
[contributor guide]: contributing
|
||||
[command-line reference]: usage
|
||||
|
||||
```{toctree}
|
||||
---
|
||||
hidden:
|
||||
maxdepth: 1
|
||||
---
|
||||
|
||||
usage
|
||||
reference
|
||||
contributing
|
||||
Code of Conduct <codeofconduct>
|
||||
License <license>
|
||||
Changelog <https://github.com/xlorepdarkhelm/plex-playlist/releases>
|
||||
```
|
||||
7
docs/license.md
Normal file
7
docs/license.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# License
|
||||
|
||||
```{literalinclude} ../LICENSE
|
||||
---
|
||||
language: none
|
||||
---
|
||||
```
|
||||
8
docs/reference.md
Normal file
8
docs/reference.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Reference
|
||||
|
||||
## playlist
|
||||
|
||||
```{eval-rst}
|
||||
.. automodule:: playlist
|
||||
:members:
|
||||
```
|
||||
4
docs/requirements.txt
Normal file
4
docs/requirements.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
furo==2022.4.7
|
||||
sphinx==4.5.0
|
||||
sphinx-click==4.1.0
|
||||
myst_parser==0.17.2
|
||||
7
docs/usage.md
Normal file
7
docs/usage.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Usage
|
||||
|
||||
```{eval-rst}
|
||||
.. click:: playlist.__main__:main
|
||||
:prog: plex-playlist
|
||||
:nested: full
|
||||
```
|
||||
236
noxfile.py
Normal file
236
noxfile.py
Normal file
@@ -0,0 +1,236 @@
|
||||
"""Nox sessions."""
|
||||
import os
|
||||
import shlex
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from textwrap import dedent
|
||||
|
||||
import nox
|
||||
|
||||
|
||||
try:
|
||||
from nox_poetry import Session
|
||||
from nox_poetry import session
|
||||
except ImportError:
|
||||
message = f"""\
|
||||
Nox failed to import the 'nox-poetry' package.
|
||||
|
||||
Please install it using the following command:
|
||||
|
||||
{sys.executable} -m pip install nox-poetry"""
|
||||
raise SystemExit(dedent(message)) from None
|
||||
|
||||
|
||||
package = "playlist"
|
||||
python_versions = ["3.10", "3.9", "3.8", "3.7"]
|
||||
nox.needs_version = ">= 2021.6.6"
|
||||
nox.options.sessions = (
|
||||
"pre-commit",
|
||||
"safety",
|
||||
"mypy",
|
||||
"tests",
|
||||
"typeguard",
|
||||
"xdoctest",
|
||||
"docs-build",
|
||||
)
|
||||
|
||||
|
||||
def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
|
||||
"""Activate virtualenv in hooks installed by pre-commit.
|
||||
|
||||
This function patches git hooks installed by pre-commit to activate the
|
||||
session's virtual environment. This allows pre-commit to locate hooks in
|
||||
that environment when invoked from git.
|
||||
|
||||
Args:
|
||||
session: The Session object.
|
||||
"""
|
||||
assert session.bin is not None # noqa: S101
|
||||
|
||||
# Only patch hooks containing a reference to this session's bindir. Support
|
||||
# quoting rules for Python and bash, but strip the outermost quotes so we
|
||||
# can detect paths within the bindir, like <bindir>/python.
|
||||
bindirs = [
|
||||
bindir[1:-1] if bindir[0] in "'\"" else bindir
|
||||
for bindir in (repr(session.bin), shlex.quote(session.bin))
|
||||
]
|
||||
|
||||
virtualenv = session.env.get("VIRTUAL_ENV")
|
||||
if virtualenv is None:
|
||||
return
|
||||
|
||||
headers = {
|
||||
# pre-commit < 2.16.0
|
||||
"python": f"""\
|
||||
import os
|
||||
os.environ["VIRTUAL_ENV"] = {virtualenv!r}
|
||||
os.environ["PATH"] = os.pathsep.join((
|
||||
{session.bin!r},
|
||||
os.environ.get("PATH", ""),
|
||||
))
|
||||
""",
|
||||
# pre-commit >= 2.16.0
|
||||
"bash": f"""\
|
||||
VIRTUAL_ENV={shlex.quote(virtualenv)}
|
||||
PATH={shlex.quote(session.bin)}"{os.pathsep}$PATH"
|
||||
""",
|
||||
# pre-commit >= 2.17.0 on Windows forces sh shebang
|
||||
"/bin/sh": f"""\
|
||||
VIRTUAL_ENV={shlex.quote(virtualenv)}
|
||||
PATH={shlex.quote(session.bin)}"{os.pathsep}$PATH"
|
||||
""",
|
||||
}
|
||||
|
||||
hookdir = Path(".git") / "hooks"
|
||||
if not hookdir.is_dir():
|
||||
return
|
||||
|
||||
for hook in hookdir.iterdir():
|
||||
if hook.name.endswith(".sample") or not hook.is_file():
|
||||
continue
|
||||
|
||||
if not hook.read_bytes().startswith(b"#!"):
|
||||
continue
|
||||
|
||||
text = hook.read_text()
|
||||
|
||||
if not any(
|
||||
Path("A") == Path("a") and bindir.lower() in text.lower() or bindir in text
|
||||
for bindir in bindirs
|
||||
):
|
||||
continue
|
||||
|
||||
lines = text.splitlines()
|
||||
|
||||
for executable, header in headers.items():
|
||||
if executable in lines[0].lower():
|
||||
lines.insert(1, dedent(header))
|
||||
hook.write_text("\n".join(lines))
|
||||
break
|
||||
|
||||
|
||||
@session(name="pre-commit", python=python_versions[0])
|
||||
def precommit(session: Session) -> None:
|
||||
"""Lint using pre-commit."""
|
||||
args = session.posargs or [
|
||||
"run",
|
||||
"--all-files",
|
||||
"--hook-stage=manual",
|
||||
"--show-diff-on-failure",
|
||||
]
|
||||
session.install(
|
||||
"black",
|
||||
"darglint",
|
||||
"flake8",
|
||||
"flake8-bandit",
|
||||
"flake8-bugbear",
|
||||
"flake8-docstrings",
|
||||
"flake8-rst-docstrings",
|
||||
"isort",
|
||||
"pep8-naming",
|
||||
"pre-commit",
|
||||
"pre-commit-hooks",
|
||||
"pyupgrade",
|
||||
)
|
||||
session.run("pre-commit", *args)
|
||||
if args and args[0] == "install":
|
||||
activate_virtualenv_in_precommit_hooks(session)
|
||||
|
||||
|
||||
@session(python=python_versions[0])
|
||||
def safety(session: Session) -> None:
|
||||
"""Scan dependencies for insecure packages."""
|
||||
requirements = session.poetry.export_requirements()
|
||||
session.install("safety")
|
||||
session.run("safety", "check", "--full-report", f"--file={requirements}")
|
||||
|
||||
|
||||
@session(python=python_versions)
|
||||
def mypy(session: Session) -> None:
|
||||
"""Type-check using mypy."""
|
||||
args = session.posargs or ["src", "tests", "docs/conf.py"]
|
||||
session.install(".")
|
||||
session.install("mypy", "pytest")
|
||||
session.run("mypy", *args)
|
||||
if not session.posargs:
|
||||
session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py")
|
||||
|
||||
|
||||
@session(python=python_versions)
|
||||
def tests(session: Session) -> None:
|
||||
"""Run the test suite."""
|
||||
session.install(".")
|
||||
session.install("coverage[toml]", "pytest", "pygments")
|
||||
try:
|
||||
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
|
||||
finally:
|
||||
if session.interactive:
|
||||
session.notify("coverage", posargs=[])
|
||||
|
||||
|
||||
@session(python=python_versions[0])
|
||||
def coverage(session: Session) -> None:
|
||||
"""Produce the coverage report."""
|
||||
args = session.posargs or ["report"]
|
||||
|
||||
session.install("coverage[toml]")
|
||||
|
||||
if not session.posargs and any(Path().glob(".coverage.*")):
|
||||
session.run("coverage", "combine")
|
||||
|
||||
session.run("coverage", *args)
|
||||
|
||||
|
||||
@session(python=python_versions[0])
|
||||
def typeguard(session: Session) -> None:
|
||||
"""Runtime type checking using Typeguard."""
|
||||
session.install(".")
|
||||
session.install("pytest", "typeguard", "pygments")
|
||||
session.run("pytest", f"--typeguard-packages={package}", *session.posargs)
|
||||
|
||||
|
||||
@session(python=python_versions)
|
||||
def xdoctest(session: Session) -> None:
|
||||
"""Run examples with xdoctest."""
|
||||
if session.posargs:
|
||||
args = [package, *session.posargs]
|
||||
else:
|
||||
args = [f"--modname={package}", "--command=all"]
|
||||
if "FORCE_COLOR" in os.environ:
|
||||
args.append("--colored=1")
|
||||
|
||||
session.install(".")
|
||||
session.install("xdoctest[colors]")
|
||||
session.run("python", "-m", "xdoctest", *args)
|
||||
|
||||
|
||||
@session(name="docs-build", python=python_versions[0])
|
||||
def docs_build(session: Session) -> None:
|
||||
"""Build the documentation."""
|
||||
args = session.posargs or ["docs", "docs/_build"]
|
||||
if not session.posargs and "FORCE_COLOR" in os.environ:
|
||||
args.insert(0, "--color")
|
||||
|
||||
session.install(".")
|
||||
session.install("sphinx", "sphinx-click", "furo", "myst-parser")
|
||||
|
||||
build_dir = Path("docs", "_build")
|
||||
if build_dir.exists():
|
||||
shutil.rmtree(build_dir)
|
||||
|
||||
session.run("sphinx-build", *args)
|
||||
|
||||
|
||||
@session(python=python_versions[0])
|
||||
def docs(session: Session) -> None:
|
||||
"""Build and serve the documentation with live reloading on file changes."""
|
||||
args = session.posargs or ["--open-browser", "docs", "docs/_build"]
|
||||
session.install(".")
|
||||
session.install("sphinx", "sphinx-autobuild", "sphinx-click", "furo", "myst-parser")
|
||||
|
||||
build_dir = Path("docs", "_build")
|
||||
if build_dir.exists():
|
||||
shutil.rmtree(build_dir)
|
||||
|
||||
session.run("sphinx-autobuild", *args)
|
||||
1709
poetry.lock
generated
Normal file
1709
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
81
pyproject.toml
Normal file
81
pyproject.toml
Normal file
@@ -0,0 +1,81 @@
|
||||
[tool.poetry]
|
||||
name = "plex-playlist"
|
||||
version = "0.0.0"
|
||||
description = "Plex Playlist"
|
||||
authors = ["Cliff Hill <xlorep@darkhelm.org>"]
|
||||
license = "Apache-2.0"
|
||||
readme = "README.md"
|
||||
homepage = "https://github.com/xlorepdarkhelm/plex-playlist"
|
||||
repository = "https://github.com/xlorepdarkhelm/plex-playlist"
|
||||
documentation = "https://plex-playlist.readthedocs.io"
|
||||
packages = [
|
||||
{ include = "playlist", from = "src" },
|
||||
]
|
||||
classifiers = [
|
||||
"Development Status :: 2 - Pre-Alpha",
|
||||
]
|
||||
|
||||
[tool.poetry.urls]
|
||||
Changelog = "https://github.com/xlorepdarkhelm/plex-playlist/releases"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.7"
|
||||
click = ">=8.0.1"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
Pygments = ">=2.10.0"
|
||||
black = ">=21.10b0"
|
||||
coverage = {extras = ["toml"], version = ">=6.2"}
|
||||
darglint = ">=1.8.1"
|
||||
flake8 = ">=4.0.1"
|
||||
flake8-bandit = ">=2.1.2"
|
||||
flake8-bugbear = ">=21.9.2"
|
||||
flake8-docstrings = ">=1.6.0"
|
||||
flake8-rst-docstrings = ">=0.2.5"
|
||||
furo = ">=2021.11.12"
|
||||
isort = ">=5.10.1"
|
||||
mypy = ">=0.930"
|
||||
pep8-naming = ">=0.12.1"
|
||||
pre-commit = ">=2.16.0"
|
||||
pre-commit-hooks = ">=4.1.0"
|
||||
pytest = ">=6.2.5"
|
||||
pyupgrade = ">=2.29.1"
|
||||
safety = ">=1.10.3"
|
||||
sphinx = ">=4.3.2"
|
||||
sphinx-autobuild = ">=2021.3.14"
|
||||
sphinx-click = ">=3.0.2"
|
||||
typeguard = ">=2.13.3"
|
||||
xdoctest = {extras = ["colors"], version = ">=0.15.10"}
|
||||
myst-parser = {version = ">=0.16.1"}
|
||||
|
||||
[tool.poetry.scripts]
|
||||
plex-playlist = "playlist.__main__:main"
|
||||
|
||||
[tool.coverage.paths]
|
||||
source = ["src", "*/site-packages"]
|
||||
tests = ["tests", "*/tests"]
|
||||
|
||||
[tool.coverage.run]
|
||||
branch = true
|
||||
source = ["playlist", "tests"]
|
||||
|
||||
[tool.coverage.report]
|
||||
show_missing = true
|
||||
fail_under = 100
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
force_single_line = true
|
||||
lines_after_imports = 2
|
||||
|
||||
[tool.mypy]
|
||||
strict = true
|
||||
warn_unreachable = true
|
||||
pretty = true
|
||||
show_column_numbers = true
|
||||
show_error_codes = true
|
||||
show_error_context = true
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
1
src/playlist/__init__.py
Normal file
1
src/playlist/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Plex Playlist."""
|
||||
12
src/playlist/__main__.py
Normal file
12
src/playlist/__main__.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""Command-line interface."""
|
||||
import click
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.version_option()
|
||||
def main() -> None:
|
||||
"""Plex Playlist."""
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(prog_name="plex-playlist") # pragma: no cover
|
||||
0
src/playlist/py.typed
Normal file
0
src/playlist/py.typed
Normal file
1
tests/__init__.py
Normal file
1
tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Test suite for the playlist package."""
|
||||
17
tests/test_main.py
Normal file
17
tests/test_main.py
Normal file
@@ -0,0 +1,17 @@
|
||||
"""Test cases for the __main__ module."""
|
||||
import pytest
|
||||
from click.testing import CliRunner
|
||||
|
||||
from playlist import __main__
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def runner() -> CliRunner:
|
||||
"""Fixture for invoking command-line interfaces."""
|
||||
return CliRunner()
|
||||
|
||||
|
||||
def test_main_succeeds(runner: CliRunner) -> None:
|
||||
"""It exits with a status code of zero."""
|
||||
result = runner.invoke(__main__.main)
|
||||
assert result.exit_code == 0
|
||||
Reference in New Issue
Block a user