Skip to content

Commit

Permalink
Project standardization (#51)
Browse files Browse the repository at this point in the history
* rearrange pyproject for easier sync between packages
* sync tox.ini
* sync mypy.ini
* sync lint.yaml
* sync poetry.yml
* sync .gitignore
* test__version__.py
* avoiding #36
* adding copyright year test
* sync conf.py
* setting up docs installation via pyproject.toml
* centering ascii art
* adjusting boilerplate pyproject.toml
* cleaner test format
* sync conf.py
* adding license copyright test
* sync pyproject.toml
* adding test for copyright in `__init__.py`
  • Loading branch information
bandophahita authored Feb 20, 2024
1 parent a6eed1a commit 19a9862
Show file tree
Hide file tree
Showing 14 changed files with 253 additions and 186 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ jobs:
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_selenium
black --check --diff tests
black --check --diff .
- name: Lint with ruff
run: |
ruff check .
- name: Lint with mypy
run: |
mypy screenpy_selenium
mypy tests
mypy .
2 changes: 1 addition & 1 deletion .github/workflows/poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ jobs:

- name: Check toml structure
run: poetry check

- name: Check lock file
run: poetry lock --check
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/
7 changes: 5 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ version: 2
build:
os: "ubuntu-20.04"
tools:
python: "3.11"
python: "3.12"

sphinx:
configuration: docs/conf.py

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
33 changes: 22 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
# shortcuts
# 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

trunk_screenpy:
poetry add screenpy git+ssh://[email protected]:ScreenPyHQ/screenpy.git#trunk

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

.PHONY: sync update trunk_screenpy local_screenpy
.PHONY: sync update_lock_only update check

black-check:
black --check .
Expand All @@ -42,3 +35,21 @@ pre-check-in: black-check ruff-check 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://[email protected]:ScreenPyHQ/screenpy.git#trunk

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

.PHONY: trunk_screenpy local_screenpy
59 changes: 23 additions & 36 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,57 +1,47 @@
# 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_selenium.__version__ import __version__, __author__, __copyright__ # noqa: need the path first
from screenpy_selenium.__version__ import __version__, __author__, __copyright__

autodoc_mock_imports = ["selenium", "screenpy", "screenpy_pyotp"]


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

project = 'screenpy_selenium'
project = "screenpy_selenium"
copyright = __copyright__
author = __author__

# The full version, including alpha/beta/rc tags
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),
"screenpy_pyotp": ("https://screenpy-pyotp-docs.readthedocs.io/en/latest/", None),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

rst_prolog = """.. Substitutions
Expand All @@ -62,24 +52,21 @@
.. |ActionChains| replace:: :external+selenium:class:`~selenium.webdriver.common.action_chains.ActionChains`
"""

# 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 = 'default'
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),
"selenium": ("https://selenium-python.readthedocs.io/", None),
"screenpy_pyotp": ("https://screenpy-pyotp-docs.readthedocs.io/en/latest/", None),
}
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
show_error_codes = True
exclude = (?x)(
setup\.py
; | tests/
| docs/
)

[mypy-screenpy_selenium.*]
disallow_untyped_defs = True

[mypy-tests.*]
disallow_untyped_defs = True
ignore_missing_imports = True
39 changes: 36 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 19a9862

Please sign in to comment.