{"id":21713735,"url":"https://github.com/blurstudio/virtualenvconfig","last_synced_at":"2026-04-10T16:53:45.521Z","repository":{"id":62587522,"uuid":"195128027","full_name":"blurstudio/virtualenvconfig","owner":"blurstudio","description":"Customize abi resolution for a given virtualenv setup.","archived":false,"fork":false,"pushed_at":"2020-03-24T23:47:18.000Z","size":34,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T17:24:44.872Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blurstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-03T21:22:09.000Z","updated_at":"2020-12-26T04:34:03.000Z","dependencies_parsed_at":"2022-11-03T22:42:32.749Z","dependency_job_id":null,"html_url":"https://github.com/blurstudio/virtualenvconfig","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blurstudio%2Fvirtualenvconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blurstudio%2Fvirtualenvconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blurstudio%2Fvirtualenvconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blurstudio%2Fvirtualenvconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blurstudio","download_url":"https://codeload.github.com/blurstudio/virtualenvconfig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244675783,"owners_count":20491824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T00:20:03.304Z","updated_at":"2026-04-10T16:53:40.497Z","avatar_url":"https://github.com/blurstudio.png","language":"Python","readme":"# virtualenvconfig\n\nModifies pip for a virtualenv to prefer a custom abi tag. This is used to make it easy to install\ncompiled c++ packages like numpy and scipy that work for a given Digital Content Creation software\n(DCC) like Maya, 3ds Max, Nuke, Houdini, etc.\n\n## installing\n\nHere is a example of creating a virtualenv designed to install wheels compatible with DCC's compiled\nwith Visual Studio 2015. Create the virtual environment and activate it.\n\n```\n$ virtualenv msvc2015_64\n$ msvc2015_64\\Scripts\\activate\n(python) $ pip install virtualenvconfig\n```\n\n## Setting the abi\n\nYou can specify the abi(s) that pip will try to download before the normal wheels. In this example pip\nwill try to download wheels with a abi of `vc2015`. If no matching package is found, it will try to\ndownload wheels with a abi of `vc2010`. If no matching package is found, it will attempt to find a package\nas pip normally does. Make sure to call python so you use the virtualenv's python, not the system python.\n\n```\n(python) $ cd msvc2015_64\\lib\\site-packages\n(python) $ python virtualenvconfig.py --set-abi vc2015 --set-abi vc2010\n```\n\n## Activating\n\nUp to this point, we haven't actually updated pip's behavior. We need to monkey patch pip so it respects\nour custom abi settings. This is done by adding/updating sitecustomize.py. When python is being initialized\nit will attempt to import `sitecustomize`. Any errors in this file being imported are suppressed.\n\nThis command will create sitecustomize.py\n```\n(python) $ virtualenvconfig.py --install\n```\nIf sitecustomize.py already exists, you need to pass the `--overwrite` or `-o` argument\n\n```\n(python) $ python virtualenvconfig.py --install -o\n```\n\nThis creates sitecustomize.py in the lib folder not the site-packages folder. This makes it so\nthe sitecustomize python script is only run when activating the virtualenv, not if the site-packages\ndirectory is used without activating the virtualenv.\n\n# Building custom abi wheels\n\nNow that we can force pip to prefer a given set of abi's, we need to be able to build pip packages for\nthose custom abi's. This can be done by updating your pip package's setup.py file to use a the custom\n``bdist_wheel`` class ``abi_bdist_wheel``. This will add a required command line argument to setup.py\n``--abi [abi_name]`` allowing you to specify the abi used when building the wheel.\n\n**An example setup.py:**\n```py\nfrom setuptools import setup, find_packages\nimport virtualenvconfig\n\nsetup(\n\t...,\n\t# Force the build command to be passed the target abi as a command line argument\n\tcmdclass={'bdist_wheel': virtualenvconfig.abi_bdist_wheel()},\n)\n```\n\n# Virtualenv setup at Blur\n\nBlur creates a virtualenv for each required Microsoft Visual C++ compiled version required for\nthe DCC software's we need. For example to support Maya 2018/2019, 3ds Max 2018/19, houdini16.5/17\nwe create ``C:\\blur\\lib\\msvc2015_64_qt5\\{release}\\python`` as a python 2.7 virtualenv. We then\nactivate and pip install all the packages we want access to in python for these DCC's. This\nincludes numpy/scipy compiled for msvc2010, and our custom PyQt and database code compiled with\nmsvc2015 to be compatible with the DCC's. Then as part of our startup scripts we insert\n``C:\\blur\\lib\\msvc2015_64_qt5\\{release}\\python\\Lib\\site-packages`` at the start of ``sys.path``\nallowing the DCC to use the python modules installed there.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblurstudio%2Fvirtualenvconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblurstudio%2Fvirtualenvconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblurstudio%2Fvirtualenvconfig/lists"}