Skip to content

Commit

Permalink
Merge pull request ScreenPyHQ#6 from bandophahita/project_standardiza…
Browse files Browse the repository at this point in the history
…tion

Project standardization
  • Loading branch information
perrygoy authored Feb 20, 2024
2 parents b7018a6 + 6ea739b commit aba843c
Show file tree
Hide file tree
Showing 20 changed files with 694 additions and 286 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,23 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -e .[dev-all]
pip install -e .[dev]
- name: Lint with black
run: |
black --check --diff screenpy_playwright
black --check --diff tests
- name: Lint with mypy
run: |
mypy screenpy_playwright
mypy tests
black --check --diff .
- name: Lint with ruff
run: |
ruff check .
- name: Lint with mypy
run: |
mypy .
6 changes: 3 additions & 3 deletions .github/workflows/poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
poetry-version: ["1.6.1"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -34,6 +34,6 @@ jobs:

- name: Check toml structure
run: poetry check

- name: Check lock file
run: poetry lock --check
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Poetry
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,6 @@ dmypy.json

# Pyre type checker
.pyre/

# ruff linter
.ruff_cache/
32 changes: 16 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
exclude: 'docs'
files: '(screenpy_playwright|tests)/.*'
fail_fast: false
repos:
- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black
language_version: python3.12
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
hooks:
- id: ruff
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
language_version: python3.12

- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black
language_version: python3.12
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.0
hooks:
- id: ruff
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
language_version: python3.12
5 changes: 4 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ sphinx:

python:
install:
- requirements: docs/rtd-requirements.txt
- method: pip
path: .
extra_requirements:
- docs
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022-2023 Perry Goy
Copyright (c) 2022-2024 Perry Goy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
39 changes: 26 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
# shortcuts to help manage flipping between branches with different dependencies
sync:
poetry install --extras dev_all --sync
poetry install --extras dev --sync

update_lock_only:
poetry update --lock

update: update_lock_only
poetry install --extras dev_all
poetry install --extras dev

check:
poetry check

requirements:
poetry export --without-hashes --with dev -f requirements.txt > requirements.txt

.PHONY: sync update_lock_only update check requirements
.PHONY: sync update_lock_only update check

black-check:
black --check .

black:
black-fix:
black .

ruff:
ruff-check:
ruff check .

ruff-fix:
Expand All @@ -31,12 +28,28 @@ ruff-fix:
mypy:
mypy .

lint: ruff mypy

.PHONY: black-check black ruff ruff-fix mypy lint
.PHONY: black-check black-fix ruff-check ruff-fix mypy

pre-check-in: black-check lint
pre-check-in: black-check ruff-check mypy

pre-check-in-fix: black ruff-fix mypy
pre-check-in-fix: black-fix ruff-fix mypy

.PHONY: pre-check-in pre-check-in-fix

# requires poetry-plugin-export
requirements:
poetry export --without-hashes --extras dev -f requirements.txt > requirements.txt

.PHONY: requirements

################################################################################
# sub-package specific

trunk_screenpy:
poetry add screenpy git+ssh://git@github.com:ScreenPyHQ/screenpy.git#trunk

local_screenpy:
pip uninstall screenpy
pip install -e ~/projects/screenpy

.PHONY: trunk_screenpy local_screenpy
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
ScreenPy Playwright
===================

[![Build Status](../../actions/workflows/tests.yml/badge.svg)](../../actions/workflows/tests.yml)
[![Build Status](../../actions/workflows/lint.yml/badge.svg)](../../actions/workflows/lint.yml)

[![Supported Versions](https://img.shields.io/pypi/pyversions/screenpy_playwright.svg)](https://pypi.org/project/screenpy_playwright)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

```
TITLE CARD:
"ScreenPy Playwright"
Expand Down Expand Up @@ -59,17 +69,23 @@ or


Documentation
----------
Please check out the [Read The Docs documentation](https://screenpy-playwright-docs.readthedocs.io/en/latest/)
for the latest information about this module!
-------------
Please check out the [Read The Docs documentation](https://screenpy-playwright-docs.readthedocs.io/en/latest/) for the latest information about this module!

You can also read the [ScreenPy Docs](https://screenpy-docs.readthedocs.io/en/latest/) for more information about ScreenPy in general.


Contributing
------------
You want to contribute? Great! Here are the things you should do before submitting your PR:

1. Install [`pre-commit`](https://pre-commit.com/)
1. run `pre-commit install` once.
1. run `tox` to perform tests frequently.
1. Fork the repo and git clone your fork.
1. `dev` install the project package:
1. `pip install -e .[dev]`
1. Optional (poetry users):
1. `poetry install --extras dev`
1. Run `pre-commit install` once.
1. Run `tox` to perform tests frequently.
1. Create pull-request from your branch.

That's it! :)
62 changes: 27 additions & 35 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,78 +1,70 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.

#
import os
import sys


sys.path.insert(0, os.path.abspath("./ext"))
sys.path.insert(0, os.path.abspath("../"))

from screenpy_playwright.__version__ import __version__ # noqa: need the path first
from screenpy_playwright.__version__ import __version__, __author__, __copyright__

autodoc_mock_imports = ["playwright", "screenpy", ]
autodoc_mock_imports = ["playwright", "screenpy"]


# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'screenpy_playwright'
copyright = '2022-2023, Perry Goy'
author = 'Perry Goy'

# The full version, including alpha/beta/rc tags
project = "screenpy_playwright"
copyright = __copyright__
author = __author__
release = __version__


# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.intersphinx",
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
"sphinx.ext.intersphinx",
"sphinx_rtd_theme",
"autodoc_skip_protocols",
]

intersphinx_mapping = {
"screenpy": ("https://screenpy-docs.readthedocs.io/en/latest/", None),
"selenium": ("https://selenium-python.readthedocs.io/", None),
}
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']






autodoc_member_order = "bysource"

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_static_path = []

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Other HTML settings
autodoc_member_order = "bysource"
add_module_names = False


# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"screenpy": ("https://screenpy-docs.readthedocs.io/en/latest/", None),
}
4 changes: 3 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[mypy]
show_error_codes = True
exclude = (?x)(
docs/
setup\.py
| docs/
)

[mypy-screenpy_playwright.*]
disallow_untyped_defs = True

[mypy-tests.*]
disallow_untyped_defs = True
ignore_missing_imports = True
Loading

0 comments on commit aba843c

Please sign in to comment.