Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change name of devtools to choreographer #142

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
src: './app'
- uses: chartboost/ruff-action@v1
with:
src: './devtools'
src: './choreographer'
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install chromium-browser xvfb
#- uses: ./.github/actions/ # it would be nice but it doesn't support timeout-minutes
- name: Install devtools
- name: Install choreographer
run: pip install .[dev]
- name: DTDoctor
run: dtdoctor --no-run
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Install Dependencies
run: choco install googlechrome -y --ignore-checksums
#- uses: ./.github/actions/
- name: Install devtools
- name: Install choreographer
run: pip install .[dev]
- name: DTDoctor
run: dtdoctor --no-run
Expand All @@ -58,7 +58,7 @@ jobs:
- name: Install Dependencies
run: brew install google-chrome
#- uses: ./.github/actions/
- name: Install devtools
- name: Install choreographer
run: pip install .[dev]
- name: DTDoctor
run: dtdoctor --no-run
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ __pycache__
# builds
results/*
!results/placeholder
dist/
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Devtools Protocol

`devtools` allows remote control of browsers from Python.
`choreographer` allows remote control of browsers from Python.
It is a work in progress:
only Chrome-ish browsers are supported at the moment,
and the name will change before the first release to PyPI.
Expand Down Expand Up @@ -49,11 +49,11 @@ Save the following code to `example-01.py` and run with Python.

```
import asyncio
import devtools
import choreographer as choreo


async def example():
browser = await devtools.Browser(headless=False)
browser = await choreo.Browser(headless=False)
tab = await browser.create_tab("https://google.com")
await asyncio.sleep(3)
await tab.send_command("Page.navigate", params={"url": "https://github.com"})
Expand All @@ -69,7 +69,7 @@ Step by step, this example:
1. Imports the required libraries.
1. Defines an `async` function
(because `await` can only be used inside `async` functions).
1. Asks `devtools` to create a browser.
1. Asks `choreographer` to create a browser.
`headless=False` tells it to display the browser on the screen;
the default is no display.
1. Wait three seconds for the browser to be created.
Expand Down Expand Up @@ -113,7 +113,7 @@ Try adding the following to the example shown above:
You can use this library without `asyncio`,

```
my_browser = devtools.Browser() # blocking until open
my_browser = choreo.Browser() # blocking until open
```

However,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 15 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
[build-system]
requires = ["setuptools>=65.0.0", "wheel"]
requires = ["setuptools>=65.0.0", "wheel", "setuptools-git-versioning"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages]
find = {namespaces = false}

[tool.setuptools-git-versioning]
enabled = true

[project]
name = "devtools"
description = "Devtools protocol"
name = "choreographer"
description = "Devtools Protocol implementation for chrome."
readme = "README.md"
requires-python = ">=3.9"
dynamic = ["version"]
authors = [
{name = "Andrew Pikul", email="[email protected]"},
{name = "Neyberson Atencio", email="[email protected]"}
]
maintainers = [
{name = "Andrew Pikul", email = "[email protected]"},
]

[project.optional-dependencies]
dev = [
Expand All @@ -20,14 +31,11 @@ dev = [
]

[project.scripts]
dtdoctor = "devtools.browser:diagnose"
dtdoctor = "choreographer.browser:diagnose"

[tool.ruff.lint]
ignore = ["E701"]

[tool.setuptools-git-versioning]
enabled = true

[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function"

6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import pytest
import pytest_asyncio
import devtools
import choreographer as choreo

@pytest.fixture(params=[True, False], ids=["headless", ""])
def headless(request):
Expand All @@ -28,15 +28,15 @@ async def browser(request):
headless = request.config.getoption("--headless")
debug = request.config.get_verbosity() > 2

browser = await devtools.Browser(
browser = await choreo.Browser(
headless=headless, debug=debug, debug_browser=debug
)
yield browser
await browser.close()

@pytest_asyncio.fixture(scope="function", loop_scope="function")
async def browser_verbose():
browser = await devtools.Browser(debug=True, debug_browser=True)
browser = await choreo.Browser(debug=True, debug_browser=True)
yield browser
await browser.close()

Expand Down
10 changes: 5 additions & 5 deletions tests/test_process.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio

import devtools
import choreographer as choreo

import pytest
from async_timeout import timeout


@pytest.mark.asyncio(loop_scope="function")
async def test_context(capteesys, headless, debug, debug_browser):
async with devtools.Browser(
async with choreo.Browser(
headless=headless,
debug=debug,
debug_browser=debug_browser,
Expand All @@ -17,7 +17,7 @@ async def test_context(capteesys, headless, debug, debug_browser):
assert "result" in response and "targetInfos" in response["result"]
assert (len(response["result"]["targetInfos"]) != 0) != headless
if not headless:
assert isinstance(browser.get_tab(), devtools.tab.Tab)
assert isinstance(browser.get_tab(), choreo.tab.Tab)
assert len(browser.get_tab().sessions) == 1
print("") # this makes sure that capturing is working
# stdout should be empty, but not because capsys is broken, because nothing was print
Expand All @@ -27,7 +27,7 @@ async def test_context(capteesys, headless, debug, debug_browser):

@pytest.mark.asyncio(loop_scope="function")
async def test_no_context(capteesys, headless, debug, debug_browser):
browser = await devtools.Browser(
browser = await choreo.Browser(
headless=headless,
debug=debug,
debug_browser=debug_browser,
Expand All @@ -38,7 +38,7 @@ async def test_no_context(capteesys, headless, debug, debug_browser):
assert "result" in response and "targetInfos" in response["result"]
assert (len(response["result"]["targetInfos"]) != 0) != headless
if not headless:
assert isinstance(browser.get_tab(), devtools.tab.Tab)
assert isinstance(browser.get_tab(), choreo.tab.Tab)
assert len(browser.get_tab().sessions) == 1
finally:
await browser.close()
Expand Down
Loading