diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 13016a84..5563bc9a 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -10,4 +10,4 @@ jobs: src: './app' - uses: chartboost/ruff-action@v1 with: - src: './devtools' \ No newline at end of file + src: './choreographer' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 05af74bf..232408a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index ebd9bc2a..4aba6eff 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ __pycache__ # builds results/* !results/placeholder +dist/ diff --git a/README.md b/README.md index 1b7807e1..5a188aef 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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"}) @@ -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. @@ -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, diff --git a/devtools/__init__.py b/choreographer/__init__.py similarity index 100% rename from devtools/__init__.py rename to choreographer/__init__.py diff --git a/devtools/browser.py b/choreographer/browser.py similarity index 100% rename from devtools/browser.py rename to choreographer/browser.py diff --git a/devtools/chrome_wrapper.py b/choreographer/chrome_wrapper.py similarity index 100% rename from devtools/chrome_wrapper.py rename to choreographer/chrome_wrapper.py diff --git a/devtools/pipe.py b/choreographer/pipe.py similarity index 100% rename from devtools/pipe.py rename to choreographer/pipe.py diff --git a/devtools/protocol.py b/choreographer/protocol.py similarity index 100% rename from devtools/protocol.py rename to choreographer/protocol.py diff --git a/devtools/session.py b/choreographer/session.py similarity index 100% rename from devtools/session.py rename to choreographer/session.py diff --git a/devtools/system.py b/choreographer/system.py similarity index 100% rename from devtools/system.py rename to choreographer/system.py diff --git a/devtools/tab.py b/choreographer/tab.py similarity index 100% rename from devtools/tab.py rename to choreographer/tab.py diff --git a/devtools/target.py b/choreographer/target.py similarity index 100% rename from devtools/target.py rename to choreographer/target.py diff --git a/pyproject.toml b/pyproject.toml index d263bb64..b92a2f59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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="ajpikul@gmail.com"}, + {name = "Neyberson Atencio", email="neyberatencio@gmail.com"} + ] +maintainers = [ + {name = "Andrew Pikul", email = "ajpikul@gmail.com"}, +] [project.optional-dependencies] dev = [ @@ -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" diff --git a/tests/conftest.py b/tests/conftest.py index 161809bd..eaeb2edb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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): @@ -28,7 +28,7 @@ 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 @@ -36,7 +36,7 @@ async def browser(request): @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() diff --git a/tests/test_process.py b/tests/test_process.py index fd14004e..c2ccde43 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -1,6 +1,6 @@ import asyncio -import devtools +import choreographer as choreo import pytest from async_timeout import timeout @@ -8,7 +8,7 @@ @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, @@ -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 @@ -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, @@ -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()