diff --git a/.gitignore b/.gitignore index c1504c9..284c008 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ var/ *.egg-info/ .installed.cfg *.egg +uv.lock # Installer logs pip-log.txt @@ -56,4 +57,4 @@ docs/_build/ # virtualenv /.ve - +/.venv diff --git a/README.md b/README.md index 8741c42..bb4216e 100644 --- a/README.md +++ b/README.md @@ -30,34 +30,6 @@ Mujin Controller Python Client is Licensed under the Apache License, Version 2.0 ### How to re-generate `webstackgraphclient.py` -First, set up a virtualenv to install required pip packages: - -```bash -# create a new virtualenv, you can also delete it afterwards -virtualenv .venv - -# install required packages -./.venv/bin/pip install six==1.16.0 requests==2.27.1 graphql-core==3.2.0 typing_extensions==4.2.0 - -# install mujinwebstackclient -./.venv/bin/pip install . -``` - -Then, use `mujin_webstackclientpy_generategraphclient.py` to generate the content of the `webstackgraphclient.py` file. - -```bash -./.venv/bin/python devbin/mujin_webstackclientpy_generategraphclient.py --url http://controller123 > python/mujinwebstackclient/webstackgraphclient.py -``` - -## Troubleshooting - -### Jhbuild fails due to flake8 - -If Jhbuild fails on building mujinwebstackclientpy due to a flake8 violation (most likely with a several hundred errors and warnings), this could be happening due to flake8 running a default configuration within a virtual environment. - -If this seems to be the case, you can delete the virtual environment. - ```bash -# delete the virtual environment -rm -rf ./.venv +PYTHONPATH=python uv run --extra graphql devbin/mujin_webstackclientpy_generategraphclient.py --url http://controller123 > python/mujinwebstackclient/webstackgraphclient.py ``` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..da573f4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,36 @@ +[project] +name = "mujinwebstackclient" +dependencies = [ + "six~=1.16", + "requests~=2.32.2", + "typing_extensions~=4.2", + "websockets~=15.0", +] +license = "Apache-2.0" +readme = "README.md" +dynamic = ["version"] + +[project.optional-dependencies] +graphql = [ + "graphql-core~=3.2.0", +] + +[tool.setuptools] +include-package-data = false +packages = ["mujinwebstackclient"] + +[tool.setuptools.package-dir] +mujinwebstackclient = "python/mujinwebstackclient" + +[tool.setuptools.package-data] +mujinwebstackclient = ["py.typed"] + +[tool.setuptools.data-files] +bin = [ + "bin/mujin_webstackclientpy_applyconfig.py", + "bin/mujin_webstackclientpy_runshell.py", + "bin/mujin_webstackclientpy_downloaddata.py", +] + +[tool.setuptools.dynamic] +version = {attr = "python.mujinwebstackclient.version.__version__"} diff --git a/setup.py b/setup.py index f7231b4..5b759fb 100644 --- a/setup.py +++ b/setup.py @@ -1,43 +1,16 @@ # -*- coding: utf-8 -*- # Copyright (C) 2012-2014 MUJIN Inc -from distutils.core import setup +from setuptools import setup try: from mujincommon.setuptools import Distribution except (ImportError, SyntaxError): - from distutils.dist import Distribution - -version = {} -exec(open('python/mujinwebstackclient/version.py').read(), version) + from setuptools.dist import Distribution setup( distclass=Distribution, - name='mujinwebstackclient', - version=version['__version__'], - packages=['mujinwebstackclient'], - package_dir={'mujinwebstackclient': 'python/mujinwebstackclient'}, - package_data={ - 'mujinwebstackclient': ['py.typed'], - }, - data_files=[ - # using scripts= will cause the first line of the script being modified for python2 or python3 - # put the scripts in data_files will copy them as-is - ( - 'bin', - [ - 'bin/mujin_webstackclientpy_applyconfig.py', - 'bin/mujin_webstackclientpy_runshell.py', - 'bin/mujin_webstackclientpy_downloaddata.py', - ], - ), - ], locale_dir='locale', - license='Apache License, Version 2.0', - long_description=open('README.md').read(), # flake8 compliance configuration enable_flake8=True, # Enable checks fail_on_flake=True, # Fail builds when checks fail - install_requires=[ - 'websockets==15.0.1', - ], )