Skip to content

Commit

Permalink
rearrange pyproject for easier sync between packages
Browse files Browse the repository at this point in the history
  • Loading branch information
bandophahita committed Feb 14, 2024
1 parent b7018a6 commit d90db84
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ 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_playwright
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://[email protected]:ScreenPyHQ/screenpy.git#trunk

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

.PHONY: trunk_screenpy local_screenpy
200 changes: 106 additions & 94 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[tool.black]
target-version = ['py312']

# This pyproject.toml is setup so it can be used with or without poetry and also
# supports editable installs (PEP 660) without breaking IDE and linter inspection.

Expand All @@ -10,6 +7,18 @@ target-version = ['py312']
# PIP:
# pip install -e .[dev]

################################################################################
# the following sections do not contain unique configurations to this package.
################################################################################


[build-system]
requires = ["poetry-core>=1.2.0"]
build-backend = "poetry.core.masonry.api"


[tool.black]
target-version = ['py312']
extend-exclude = '''
# A regex preceded with ^/ will apply only to files and directories
# in the root of the project.
Expand All @@ -24,90 +33,15 @@ extend-exclude = '''
'''

[tool.poetry]
name = "screenpy_playwright"
version = "0.0.2"
description = "ScreenPy extension to enable interacting with Playwright."
authors = ["Perry Goy <[email protected]>"]
maintainers = ["Marcel Wilson"]
license = "MIT"
repository = "https://github.com/ScreenPyHQ/screenpy_playwright"
documentation = "https://screenpy-playwright-docs.readthedocs.io"
readme = "README.md"
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Testing :: BDD",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
]


# It's possible to add optional dependencies with the poetry CLI tool using:
# poetry add --optional some_dev_pkg
# This will set `optional = true` flag in [tool.poetry.dependencies], as seen below
# But then you need to remember to manually edit the [tool.poetry.extras] dev section
# and declare the package. This allows `pip install .[dev]` to work as expected
# Poetry users will need to use the `--extras dev` option rather than the `--with dev`
# so we dont have two different sets of package versions to update.

[tool.poetry.dependencies]
python = "^3.8"
screenpy = ">=4.0.2"
playwright = ">=1.39.0"
importlib_metadata = {version = "*", python = "3.8.*"}

# convenience packages for development of screenpy_playwright only
black = {version = "*", optional = true}
coverage = {version = "*", optional = true}
mypy = {version = "*", optional = true}
pre-commit = {version = "*", optional = true}
pytest = {version = "*", optional = true}
ruff = {version = "*", optional = true}
sphinx = {version = "*", optional = true}
tox = {version = "*", optional = true}


[tool.poetry.extras]
dev = [
"pre-commit",
"pytest",
"tox",
]
dev_all = [
"black",
"coverage",
"mypy",
"pre-commit",
"pytest",
"ruff",
"sphinx",
"tox",
]
test = [
"coverage",
"pytest",
]


[tool.ruff]
target-version = "py38" # minimum supported version
line-length = 88 # same as Black.
extend-exclude = [
"screenpy_playwright/__init__.py",
"screenpy_playwright/__version__.py",
"__init__.py",
"__version__.py",
"docs",
]
fix = true

[tool.ruff.lint]
select = [
Expand Down Expand Up @@ -154,9 +88,34 @@ ignore = [
"D203", # one blank line before class docstring, no thanks!
"D212", # multi line summary first line, we want a one line summary.
"ANN101", # missing self annotation, we only annotate self when we return it.
"ANN102", # missing cls annotation, we only annotate cls when we return it
"ANN102", # missing cls annotation, we only annotate cls when we return it.
]

extend-safe-fixes = [
"EM101", "EM102",
"TCH001", "TCH002", "TCH003", "TCH004",
"C419",
"D200", "D205", "D415",
"PT003", "PT006", "PT018",
"RET504",
"UP006", "UP007",
]

[tool.ruff.lint.flake8-pytest-style]
mark-parentheses = false

[tool.ruff.lint.pycodestyle]
ignore-overlong-task-comments = true

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.flake8-type-checking]
strict = true

[tool.ruff.lint.isort]
combine-as-imports = true
split-on-trailing-comma = false

[tool.ruff.lint.per-file-ignores]
"tests/**" = [
Expand All @@ -166,24 +125,77 @@ ignore = [
]


[tool.ruff.lint.isort]
combine-as-imports = true
split-on-trailing-comma = true
known-first-party = ["screenpy_playwright", "tests"]
################################################################################
# the following sections contain unique configurations to this package.
################################################################################


[tool.ruff.lint.flake8-pytest-style]
mark-parentheses = false
[tool.poetry]
name = "screenpy_playwright"
version = "0.0.2"
description = "ScreenPy extension to enable interacting with Playwright."
authors = ["Perry Goy <[email protected]>"]
maintainers = ["Marcel Wilson"]
license = "MIT"
repository = "https://github.com/ScreenPyHQ/screenpy_playwright"
documentation = "https://screenpy-playwright-docs.readthedocs.io"
readme = "README.md"
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Testing :: BDD",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
]


[tool.ruff.lint.pycodestyle]
ignore-overlong-task-comments = true
# It's possible to add optional dependencies with the poetry CLI tool using:
# poetry add --optional some_dev_pkg
# This will set `optional = true` flag in [tool.poetry.dependencies], as seen below
# But then you need to remember to manually edit the [tool.poetry.extras] dev section
# and declare the package. This allows `pip install .[dev]` to work as expected
# Poetry users will need to use the `--extras dev` option rather than the `--with dev`
# so we dont have two different sets of package versions to update.

[tool.poetry.dependencies]
python = "^3.8"

[tool.ruff.lint.pydocstyle]
convention = "google"
screenpy = ">=4.0.2"
playwright = ">=1.39.0"
importlib_metadata = {version = "*", python = "3.8.*"}

# convenience packages for development of screenpy_playwright only
black = {version = "*", optional = true}
coverage = {version = "*", optional = true}
mypy = {version = "*", optional = true}
pre-commit = {version = "*", optional = true}
pytest = {version = "*", optional = true}
ruff = {version = "*", optional = true}
sphinx = {version = "*", optional = true}
tox = {version = "*", optional = true}

[build-system]
requires = ["poetry-core>=1.2.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.extras]
dev = [
"black",
"coverage",
"mypy",
"pre-commit",
"pytest",
"ruff",
"sphinx",
"tox",
]
test = [
"coverage",
"pytest",
]

0 comments on commit d90db84

Please sign in to comment.