BigRoy / usd-qtpy

Python Qt components for building custom USD tools.
MIT License
57 stars 8 forks source link

pip install support #12

Closed hannesdelbeke closed 7 months ago

hannesdelbeke commented 7 months ago

test with

python -m pip install git+https://github.com/hannesdelbeke/usd-qtpy.git@main

includes automated pip install build with github action when you make release.

hannesdelbeke commented 7 months ago

~if that all looks good, can you give it a test with pip installing it? see if that works for you~

WRONG BRANCH

python -m pip install git+https://github.com/hannesdelbeke/usd-qtpy.git@main
hannesdelbeke commented 7 months ago

actually nvm that wont work, i didnt merge in main, use this

python -m pip install git+https://github.com/hannesdelbeke/usd-qtpy.git@py-package
BigRoy commented 7 months ago

Haha, was just about to comment on that line. Will give it a go - wait a sec.

BigRoy commented 7 months ago
python -m venv .venv
.venv/Scripts/activate.bat
python -m pip install git+https://github.com/hannesdelbeke/usd-qtpy.git@py-package

I could then do:

python -m usd_qtpy

Which gives me:

usage: usd_qtpy [-h] filepath
usd_qtpy: error: the following arguments are required: filepath

So that package installed correctly, but of course I now have no usd-core, so then I did:

python -m pip install usd_qtpy[usd] git+https://github.com/hannesdelbeke/usd-qtpy.git@py-package

But ended up hitting this error:

Requirement already satisfied: usd_qtpy[usd] in e:\tmp\pytest\.venv\lib\site-packages (0.0.1)
ERROR: Cannot install usd-qtpy 0.0.1 (from git+https://github.com/hannesdelbeke/usd-qtpy.git@py-package) and usd-qtpy[usd]==0.0.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested usd-qtpy 0.0.1 (from git+https://github.com/hannesdelbeke/usd-qtpy.git@py-package)
    usd-qtpy[usd] 0.0.1 depends on usd-qtpy 0.0.1 (Installed)

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

But that was resolved if I first did python -m pip install --upgrade pip to update pip. Then running the same command succeeded (so note that an up-to-date pip might be crucial there if re-running with optional dependencies after installing).

Since qtpy does not install Qt dependencies itself (e.g. PySide2):

qtpy.QtBindingsNotFoundError: No Qt bindings could be found

I had to install myself:

python -m pip install PySide2

After that we're good to go!

python -m usd_qtpy "\path\to\asset.usda"

So yes, this works as intended currently. ✅

hannesdelbeke commented 7 months ago

anything remaining before merging this?

BigRoy commented 7 months ago

anything remaining before merging this?

Yes, just me and the PyPi setup with the repository secrets.

With this merged - could you walk me through the steps I need to take to push a (first version) update to PyPi?

hannesdelbeke commented 7 months ago

for security, it's also recommended to create a new PYPI token once the initial upload created the PYPI project. give this token only access to this pypi project. so if your github repo ever get hacked they only have access to that project on pypi instead of all pypi projects