1234567891011121314151617181920212223242526272829 |
- #!/usr/bin/env python
- import sys
- import requirements
- def main():
- """
- We cannot have non-specifier requirements if we want to publish to PyPI
- due to security concerns. This check ensures we don't have/add any URL/VCS
- dependencies in the base requirements file.
- """
- with open("requirements-base.txt") as reqs_file:
- if any(not req.specifier for req in requirements.parse(reqs_file)):
- print(
- "\n".join(
- [
- "You cannot use dependencies that are not on PyPI directly.",
- "See PEP440: https://www.python.org/dev/peps/pep-0440/#direct-references",
- ]
- ),
- file=sys.stderr,
- )
- sys.exit(1)
- if __name__ == "__main__":
- main()
|