Giter Site home page Giter Site logo

Comments (5)

mxschmitt avatar mxschmitt commented on May 12, 2024

I made some research. There is no good native way of having a postinstall script. It could be implemented like that with egg_info which is super hacky, not sure how it performs: https://stackoverflow.com/a/45021666/6512681

from playwright-python.

pavelfeldman avatar pavelfeldman commented on May 12, 2024

I actually made it work as described here: https://stackoverflow.com/questions/20288711/post-install-script-with-python-setuptools

But pip is suppressing the I/O, so there are no progress bars visible, which defeats the purpose of this UX improvement.

from playwright-python.

mxschmitt avatar mxschmitt commented on May 12, 2024

I thought about the following design when we compare it with other tools like .

  • They have a command line interface which they use to download files. In their case language models spacy download en_core_web_sm
  • It can be exposed via setup.py like package.json>bin in the Node.js world
  • If no browsers are persistent, I would download the used browser on launch() instead of all browsers

So the user can decide, either use the CLI to download the browser or the used browser get's downloaded on launch.

from playwright-python.

pavelfeldman avatar pavelfeldman commented on May 12, 2024

That's probably it, we'll have the plagwright install for now

from playwright-python.

ColdHeat avatar ColdHeat commented on May 12, 2024

Thanks for working on playwright, it's much needed for automated tests!

I personally think that I would rather have browsers installed during the pip install step even if it didn't have progress bars.

I looked around for a way to automatically install browsers on first test run perhaps and it looks like you would have to modify sys.argv to use the existing main() install.

def main() -> None:
if "install" not in sys.argv:
print('Run "python -m playwright install" to complete installation')
return
package_path = get_file_dirname()
driver_name = compute_driver_name()
driver_executable = package_path / "drivers" / driver_name
print("Installing the browsers...")
subprocess.check_call(f"{driver_executable} install", shell=True)
print("Playwright is now ready for use")

Could the install function perhaps be extracted this into a separate function that can be called without modifying sys.argv?

from playwright-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.