Skip to content
Snippets Groups Projects
Commit ff21177e authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

1.3.2

parent 32c2eb2b
No related branches found
No related tags found
No related merge requests found
# v1.3.2
* _TBA_
* added `read_requirements_txt`
# v1.3.1
......
......@@ -73,3 +73,23 @@ logger = logging.getLogger(__name__)
Otherwise `PyInit` won't be generated by Cython
and such module will be unimportable in Python. Normal import won't suffice.
Further streamlining your builds
--------------------------------
If you add a MANIFEST.in file with contents:
```
include requirements.txt
```
Then you can write the following in your setup.py:
```python
from snakehouse import read_requirements_txt
setup(install_requires=read_requirements_txt())
```
This will read in your requirements.txt and extract packages from there.
Be sure to entertain it's [pydoc](snakehouse/requirements.py)!
......@@ -6,7 +6,7 @@ setup(keywords=['cython', 'extension', 'multiple', 'pyx'],
packages=find_packages(include=['snakehouse']),
version=__version__,
install_requires=[
'Cython', 'mako', 'satella',
'Cython', 'mako', 'satella>=2.14.46',
],
python_requires='!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
package_data={
......
from .build import build
from .multibuild import Multibuild
from .faster_builds import monkey_patch_parallel_compilation
from .requirements import read_requirements_txt
__version__ = '1.3.2a1'
__version__ = '1.3.2'
from satella.files import read_lines
def read_requirements_txt(path: str = 'requirements.txt'):
"""
Read requirements.txt and parse it into a list of packages
as given by setup(install_required=).
This means it will read in all lines, discard empty and commented ones,
and discard all those who are an URL.
Remember to include your requirements.txt inside your MANIFEST.in!
:param path: path to requirements.txt. Default is `requirements.txt`.
:return: list of packages ready to be fed to setup(install_requires=)
"""
lines = read_lines(path)
lines = (line.strip() for line in lines)
lines = (line for line in lines if not line.startswith('#'))
lines = (line for line in lines if not line.startswith('git+'))
lines = (line for line in lines if not line.startswith('http'))
lines = (line for line in lines if line)
return list(lines)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment