{"id":30240407,"url":"https://github.com/hypothesis/pip-sync-faster","last_synced_at":"2025-08-15T04:38:33.049Z","repository":{"id":43282802,"uuid":"511189931","full_name":"hypothesis/pip-sync-faster","owner":"hypothesis","description":"A wrapper that makes pip-sync faster.","archived":false,"fork":false,"pushed_at":"2025-06-13T12:43:20.000Z","size":63,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-13T13:29:21.096Z","etag":null,"topics":["pip","pip-tools","python-pip"],"latest_commit_sha":null,"homepage":"https://stackoverflow.com/questions/73503092/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hypothesis.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-07-06T15:20:25.000Z","updated_at":"2025-06-13T12:18:18.000Z","dependencies_parsed_at":"2023-02-13T21:45:58.096Z","dependency_job_id":"40a5a79c-6940-405b-ba75-414c1b98ad99","html_url":"https://github.com/hypothesis/pip-sync-faster","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/hypothesis/pip-sync-faster","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypothesis%2Fpip-sync-faster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypothesis%2Fpip-sync-faster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypothesis%2Fpip-sync-faster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypothesis%2Fpip-sync-faster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hypothesis","download_url":"https://codeload.github.com/hypothesis/pip-sync-faster/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypothesis%2Fpip-sync-faster/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270524432,"owners_count":24600195,"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","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["pip","pip-tools","python-pip"],"created_at":"2025-08-15T04:38:26.033Z","updated_at":"2025-08-15T04:38:33.028Z","avatar_url":"https://github.com/hypothesis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://github.com/hypothesis/pip-sync-faster/actions/workflows/ci.yml?query=branch%3Amain\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/hypothesis/pip-sync-faster/ci.yml?branch=main\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/pip-sync-faster\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/pip-sync-faster\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg src=\"https://img.shields.io/badge/python-3.12 | 3.11 | 3.10 | 3.9-success\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/hypothesis/pip-sync-faster/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-BSD--2--Clause-success\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/hypothesis/cookiecutters/tree/main/pypackage\"\u003e\u003cimg src=\"https://img.shields.io/badge/cookiecutter-pypackage-success\"\u003e\u003c/a\u003e\n\u003ca href=\"https://black.readthedocs.io/en/stable/\"\u003e\u003cimg src=\"https://img.shields.io/badge/code%20style-black-000000\"\u003e\u003c/a\u003e\n\n# pip-sync-faster\n\nA wrapper that makes pip-sync faster.\n\npip-sync-faster makes\n[pip-sync](https://pip-tools.readthedocs.io/en/latest/#example-usage-for-pip-sync)\nrun faster in the case where there's nothing to do because the virtualenv is\nalready up to date with the requirements files. On my machine, with my\nrequirements files, it shaves off over 500ms in the time taken to run pip-sync:\n\n```terminal\n$ time pip-sync requirements/foo.txt\nEverything up-to-date\n\nreal    0m0.569s\nuser    0m0.525s\nsys     0m0.045s\n\n$ time pip-sync-faster requirements/foo.txt\n\nreal    0m0.037s\nuser    0m0.029s\nsys     0m0.008s\n```\n\n`pip-sync-faster` does this by saving hashes of the given requirements files in a\nJSON file within the virtualenv and not calling pip-sync if the hashes haven't\nchanged.\nIf any of the given requirements files doesn't have a matching cached hash then\npip-sync-faster calls pip-sync forwarding all command line arguments and\noptions.\n\n## You need to add `pip-sync-faster` to your requirements file\n\nA command like `pip-sync-faster requirements.txt` will call\n`pip-sync requirements.txt` which will uninstall anything not in\n`requirements.txt` from the active venv, including `pip-sync-faster` itself!\n\nYou can add `pip-sync-faster` to `requirements.txt` so that it doesn't get\nuninstalled.\n\n### Running `pip-sync-faster` directly instead\n\nAlternatively as long as `pip-tools` is installed in the active venv you can\nrun `pip-sync-faster` directly with a command like:\n\n```bash\nPYTHONPATH=/path/to/pip-sync-faster/src python3 -m pip_sync_faster requirements.txt\n```\n\nThis doesn't rely on `pip-sync-faster` being installed so there's no issue with\n`pip-sync` uninstalling it.\n\n## pip-sync-faster doesn't sync modified virtualenvs\n\nIf you modify your requirements files pip-sync-faster will notice the change\nand call pip-sync. But if you modify your virtualenv without modifying your\nrequirements files (for example by running a manual `pip install` command in\nthe virtualenv) pip-sync-faster will *not* call pip-sync because the\nrequirements files haven't changed and still match their cached hashes.\n\nCalling pip-sync directly in this case would re-sync your virtualenv with your\nrequirements files, but calling pip-sync-faster won't.\n\nIf you can live with this limitation then you can use pip-sync-faster and save\nyourself a few hundred milliseconds. If not you should just use pip-sync.\n\n## Installing\n\nWe recommend using [pipx](https://pypa.github.io/pipx/) to install\npip-sync-faster.\nFirst [install pipx](https://pypa.github.io/pipx/#install-pipx) then run:\n\n```terminal\npipx install pip-sync-faster\n```\n\nYou now have pip-sync-faster installed! For some help run:\n\n```\npip-sync-faster --help\n```\n\n## Upgrading\n\nTo upgrade to the latest version run:\n\n```terminal\npipx upgrade pip-sync-faster\n```\n\nTo see what version you have run:\n\n```terminal\npip-sync-faster --version\n```\n\n## Uninstalling\n\nTo uninstall run:\n\n```\npipx uninstall pip-sync-faster\n```\n\n## Setting up Your pip-sync-faster Development Environment\n\nFirst you'll need to install:\n\n* [Git](https://git-scm.com/).\n  On Ubuntu: `sudo apt install git`, on macOS: `brew install git`.\n* [GNU Make](https://www.gnu.org/software/make/).\n  This is probably already installed, run `make --version` to check.\n* [pyenv](https://github.com/pyenv/pyenv).\n  Follow the instructions in pyenv's README to install it.\n  The **Homebrew** method works best on macOS.\n  The **Basic GitHub Checkout** method works best on Ubuntu.\n  You _don't_ need to set up pyenv's shell integration (\"shims\"), you can\n  [use pyenv without shims](https://github.com/pyenv/pyenv#using-pyenv-without-shims).\n\nThen to set up your development environment:\n\n```terminal\ngit clone https://github.com/hypothesis/pip-sync-faster.git\ncd pip-sync-faster\nmake help\n```\n\n## Releasing a New Version of the Project\n\n1. First, to get PyPI publishing working you need to go to:\n   \u003chttps://github.com/organizations/hypothesis/settings/secrets/actions/PYPI_TOKEN\u003e\n   and add pip-sync-faster to the `PYPI_TOKEN` secret's selected\n   repositories.\n\n2. Now that the pip-sync-faster project has access to the `PYPI_TOKEN` secret\n   you can release a new version by just [creating a new GitHub release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository).\n   Publishing a new GitHub release will automatically trigger\n   [a GitHub Actions workflow](.github/workflows/pypi.yml)\n   that will build the new version of your Python package and upload it to\n   \u003chttps://pypi.org/project/pip-sync-faster\u003e.\n\n## Changing the Project's Python Versions\n\nTo change what versions of Python the project uses:\n\n1. Change the Python versions in the\n   [cookiecutter.json](.cookiecutter/cookiecutter.json) file. For example:\n\n   ```json\n   \"python_versions\": \"3.10.4, 3.9.12\",\n   ```\n\n2. Re-run the cookiecutter template:\n\n   ```terminal\n   make template\n   ```\n\n3. Commit everything to git and send a pull request\n\n## Changing the Project's Python Dependencies\n\nTo change the production dependencies in the `setup.cfg` file:\n\n1. Change the dependencies in the [`.cookiecutter/includes/setuptools/install_requires`](.cookiecutter/includes/setuptools/install_requires) file.\n   If this file doesn't exist yet create it and add some dependencies to it.\n   For example:\n\n   ```\n   pyramid\n   sqlalchemy\n   celery\n   ```\n\n2. Re-run the cookiecutter template:\n\n   ```terminal\n   make template\n   ```\n\n3. Commit everything to git and send a pull request\n\nTo change the project's formatting, linting and test dependencies:\n\n1. Change the dependencies in the [`.cookiecutter/includes/tox/deps`](.cookiecutter/includes/tox/deps) file.\n   If this file doesn't exist yet create it and add some dependencies to it.\n   Use tox's [factor-conditional settings](https://tox.wiki/en/latest/config.html#factors-and-factor-conditional-settings)\n   to limit which environment(s) each dependency is used in.\n   For example:\n\n   ```\n   lint: flake8,\n   format: autopep8,\n   lint,tests: pytest-faker,\n   ```\n\n2. Re-run the cookiecutter template:\n\n   ```terminal\n   make template\n   ```\n\n3. Commit everything to git and send a pull request\n\nTesting Manually\n----------------\n\nNormally if you wanted to test a command manually in dev you'd do so through\ntox, for example:\n\n```terminal\n$ tox -qe dev --run-command 'pip-sync-faster --help'\nusage: pip-sync-faster [-h] [-v]\n\noptions:\n  -h, --help     show this help message and exit\n  -v, --version\n```\n\nBut there's a problem with running `pip-sync-faster` commands in this way: a\ncommand like `tox -e dev --run-command 'pip-sync-faster requirements.txt'` will\nrun `pip-sync requirements.txt` and `pip-sync` will sync the\ncurrent virtualenv (`.tox/dev/`) with the `requirements.txt` file. Everything\nin `requirements.txt` will get installed into `.tox/dev/`, which you probably\ndon't want. Even worse everything _not_ in `requirements.txt` will get\n_removed_ from `.tox/dev/` including `pip-sync-faster` itself!\n\nTo avoid this problem run `pip-sync-faster` in a temporary virtualenv instead.\nThis installs the contents of `requirements.txt` into the temporary venv so\nyour `.tox/dev/` env doesn't get messed up. And it does not install\n`pip-sync-faster` into the temporary venv so there's no issue with `pip-sync`\nuninstalling `pip-sync-faster`:\n\n```terminal\n# Make a temporary directory.\ntempdir=$(mktemp -d)\n\n# Create a virtualenv in the temporary directory.\npython3 -m venv $tempdir\n\n# Activate the virtualenv.\nsource $tempdir/bin/activate\n\n# Install pip-tools in the virtualenv (pip-sync-faster needs pip-tools).\npip install pip-tools\n\n# Call pip-sync-faster to install a requirements file into the temporary virtualenv.\nPYTHONPATH=src python3 -m pip_sync_faster /path/to/requirements.txt\n\n# When you're done testing deactivate the temporary virtualenv.\ndeactivate\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypothesis%2Fpip-sync-faster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhypothesis%2Fpip-sync-faster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypothesis%2Fpip-sync-faster/lists"}