Skip to content

Commit

Permalink
ignore version constraints in setup.py's
Browse files Browse the repository at this point in the history
AdeelH committed Feb 28, 2024
1 parent 22a794f commit afaac58
Showing 10 changed files with 267 additions and 113 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# flake8: noqa

from os import path as op
import io
from setuptools import (setup, find_namespace_packages)
from os.path import abspath, dirname, join
from setuptools import setup, find_namespace_packages
import re

here = op.abspath(op.dirname(__file__))
with io.open(op.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
name = 'rastervision_{{cookiecutter.project_name}}'
version = '{{cookiecutter.version}}'
description = '{{cookiecutter.description}}'
requirement_constraints = {}

here = abspath(dirname(__file__))


def parse_requirements(requirements_path: str) -> list[str]:
requirements = []
with open(requirements_path, 'r', encoding='utf-8') as f:
for line in f:
if 'git+' in line:
continue
# match package name, ignoring version constraints
match = re.match(r'^\s*([^\s<=>]+)', line)
if not match:
continue
package_name = match.group(1)
if package_name in requirement_constraints:
constraint = requirement_constraints[package_name]
package_name = f'{package_name}{constraint}'
requirements.append(package_name)
return requirements

name='rastervision_{{cookiecutter.project_name}}'
version='{{cookiecutter.version}}'
description='{{cookiecutter.description}}'

setup(
name=name,
@@ -30,6 +47,5 @@
keywords=
'raster deep-learning ml computer-vision earth-observation geospatial geospatial-processing',
packages=find_namespace_packages(exclude=['integration_tests*', 'tests*']),
install_requires=install_requires,
zip_safe=False
)
install_requires=parse_requirements(join(here, 'requirements.txt')),
zip_safe=False)
35 changes: 26 additions & 9 deletions rastervision_aws_batch/setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# flake8: noqa

from os import path as op
import io
from setuptools import (setup, find_namespace_packages)

here = op.abspath(op.dirname(__file__))
with io.open(op.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
from os.path import abspath, dirname, join
from setuptools import setup, find_namespace_packages
import re

name = 'rastervision_aws_batch'
version = '0.21.4-dev'
description = 'A rastervision plugin that adds an AWS Batch pipeline runner'
requirement_constraints = {}

here = abspath(dirname(__file__))


def parse_requirements(requirements_path: str) -> list[str]:
requirements = []
with open(requirements_path, 'r', encoding='utf-8') as f:
for line in f:
if 'git+' in line:
continue
# match package name, ignoring version constraints
match = re.match(r'^\s*([^\s<=>]+)', line)
if not match:
continue
package_name = match.group(1)
if package_name in requirement_constraints:
constraint = requirement_constraints[package_name]
package_name = f'{package_name}{constraint}'
requirements.append(package_name)
return requirements


setup(
name=name,
@@ -30,5 +47,5 @@
keywords=
'raster deep-learning ml computer-vision earth-observation geospatial geospatial-processing',
packages=find_namespace_packages(exclude=['integration_tests*', 'tests*']),
install_requires=install_requires,
install_requires=parse_requirements(join(here, 'requirements.txt')),
zip_safe=False)
35 changes: 26 additions & 9 deletions rastervision_aws_s3/setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# flake8: noqa

from os import path as op
import io
from setuptools import (setup, find_namespace_packages)

here = op.abspath(op.dirname(__file__))
with io.open(op.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
from os.path import abspath, dirname, join
from setuptools import setup, find_namespace_packages
import re

name = 'rastervision_aws_s3'
version = '0.21.4-dev'
description = 'A rastervision plugin that adds an AWS S3 file system'
requirement_constraints = {}

here = abspath(dirname(__file__))


def parse_requirements(requirements_path: str) -> list[str]:
requirements = []
with open(requirements_path, 'r', encoding='utf-8') as f:
for line in f:
if 'git+' in line:
continue
# match package name, ignoring version constraints
match = re.match(r'^\s*([^\s<=>]+)', line)
if not match:
continue
package_name = match.group(1)
if package_name in requirement_constraints:
constraint = requirement_constraints[package_name]
package_name = f'{package_name}{constraint}'
requirements.append(package_name)
return requirements


setup(
name=name,
@@ -30,5 +47,5 @@
keywords=
'raster deep-learning ml computer-vision earth-observation geospatial geospatial-processing',
packages=find_namespace_packages(exclude=['integration_tests*', 'tests*']),
install_requires=install_requires,
install_requires=parse_requirements(join(here, 'requirements.txt')),
zip_safe=False)
35 changes: 26 additions & 9 deletions rastervision_aws_sagemaker/setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# flake8: noqa

from os import path as op
import io
from setuptools import (setup, find_namespace_packages)

here = op.abspath(op.dirname(__file__))
with io.open(op.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
from os.path import abspath, dirname, join
from setuptools import setup, find_namespace_packages
import re

name = 'rastervision_aws_sagemaker'
version = '0.21'
description = 'A rastervision plugin that adds an AWS SageMaker pipeline runner'
requirement_constraints = {}

here = abspath(dirname(__file__))


def parse_requirements(requirements_path: str) -> list[str]:
requirements = []
with open(requirements_path, 'r', encoding='utf-8') as f:
for line in f:
if 'git+' in line:
continue
# match package name, ignoring version constraints
match = re.match(r'^\s*([^\s<=>]+)', line)
if not match:
continue
package_name = match.group(1)
if package_name in requirement_constraints:
constraint = requirement_constraints[package_name]
package_name = f'{package_name}{constraint}'
requirements.append(package_name)
return requirements


setup(
name=name,
@@ -30,5 +47,5 @@
keywords=
'raster deep-learning ml computer-vision earth-observation geospatial geospatial-processing',
packages=find_namespace_packages(exclude=['integration_tests*', 'tests*']),
install_requires=install_requires,
install_requires=parse_requirements(join(here, 'requirements.txt')),
zip_safe=False)
35 changes: 26 additions & 9 deletions rastervision_core/setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# flake8: noqa

from os import path as op
import io
from setuptools import (setup, find_namespace_packages)

here = op.abspath(op.dirname(__file__))
with io.open(op.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
from os.path import abspath, dirname, join
from setuptools import setup, find_namespace_packages
import re

name = 'rastervision_core'
version = '0.21.4-dev'
description = 'A rastervision plugin that adds geospatial machine learning pipelines'
requirement_constraints = {}

here = abspath(dirname(__file__))


def parse_requirements(requirements_path: str) -> list[str]:
requirements = []
with open(requirements_path, 'r', encoding='utf-8') as f:
for line in f:
if 'git+' in line:
continue
# match package name, ignoring version constraints
match = re.match(r'^\s*([^\s<=>]+)', line)
if not match:
continue
package_name = match.group(1)
if package_name in requirement_constraints:
constraint = requirement_constraints[package_name]
package_name = f'{package_name}{constraint}'
requirements.append(package_name)
return requirements


setup(
name=name,
@@ -30,5 +47,5 @@
keywords=
'raster deep-learning ml computer-vision earth-observation geospatial geospatial-processing',
packages=find_namespace_packages(exclude=['integration_tests*', 'tests*']),
install_requires=install_requires,
install_requires=parse_requirements(join(here, 'requirements.txt')),
zip_safe=False)
35 changes: 26 additions & 9 deletions rastervision_gdal_vsi/setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# flake8: noqa

from os import path as op
import io
from setuptools import (setup, find_namespace_packages)

here = op.abspath(op.dirname(__file__))
with io.open(op.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
from os.path import abspath, dirname, join
from setuptools import setup, find_namespace_packages
import re

name = 'rastervision_gdal_vsi'
version = '0.21.4-dev'
description = 'A rastervision plugin that adds a GDAL VSI file system'
requirement_constraints = {}

here = abspath(dirname(__file__))


def parse_requirements(requirements_path: str) -> list[str]:
requirements = []
with open(requirements_path, 'r', encoding='utf-8') as f:
for line in f:
if 'git+' in line:
continue
# match package name, ignoring version constraints
match = re.match(r'^\s*([^\s<=>]+)', line)
if not match:
continue
package_name = match.group(1)
if package_name in requirement_constraints:
constraint = requirement_constraints[package_name]
package_name = f'{package_name}{constraint}'
requirements.append(package_name)
return requirements


setup(
name=name,
@@ -30,5 +47,5 @@
keywords=
'raster deep-learning ml computer-vision earth-observation geospatial geospatial-processing',
packages=find_namespace_packages(exclude=['integration_tests*', 'tests*']),
install_requires=install_requires,
install_requires=parse_requirements(join(here, 'requirements.txt')),
zip_safe=False)
37 changes: 28 additions & 9 deletions rastervision_pipeline/setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
# flake8: noqa

from os import path as op
import io
from setuptools import (setup, find_namespace_packages)

here = op.abspath(op.dirname(__file__))
with io.open(op.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
from os.path import abspath, dirname, join
from setuptools import setup, find_namespace_packages
import re

name = 'rastervision_pipeline'
version = '0.21.4-dev'
description = 'The main rastervision package for configuring, defining, and running pipelines'
requirement_constraints = {
'pydantic': '<2',
}

here = abspath(dirname(__file__))


def parse_requirements(requirements_path: str) -> list[str]:
requirements = []
with open(requirements_path, 'r', encoding='utf-8') as f:
for line in f:
if 'git+' in line:
continue
# match package name, ignoring version constraints
match = re.match(r'^\s*([^\s<=>]+)', line)
if not match:
continue
package_name = match.group(1)
if package_name in requirement_constraints:
constraint = requirement_constraints[package_name]
package_name = f'{package_name}{constraint}'
requirements.append(package_name)
return requirements


setup(
name=name,
@@ -30,7 +49,7 @@
keywords=
'raster deep-learning ml computer-vision earth-observation geospatial geospatial-processing',
packages=find_namespace_packages(exclude=['integration_tests*', 'tests*']),
install_requires=install_requires,
install_requires=parse_requirements(join(here, 'requirements.txt')),
zip_safe=False,
entry_points='''
[console_scripts]
35 changes: 26 additions & 9 deletions rastervision_pytorch_backend/setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# flake8: noqa

from os import path as op
import io
from setuptools import (setup, find_namespace_packages)

here = op.abspath(op.dirname(__file__))
with io.open(op.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
from os.path import abspath, dirname, join
from setuptools import setup, find_namespace_packages
import re

name = 'rastervision_pytorch_backend'
version = '0.21.4-dev'
description = 'A rastervision plugin that adds PyTorch backends for rastervision.core pipelines'
requirement_constraints = {}

here = abspath(dirname(__file__))


def parse_requirements(requirements_path: str) -> list[str]:
requirements = []
with open(requirements_path, 'r', encoding='utf-8') as f:
for line in f:
if 'git+' in line:
continue
# match package name, ignoring version constraints
match = re.match(r'^\s*([^\s<=>]+)', line)
if not match:
continue
package_name = match.group(1)
if package_name in requirement_constraints:
constraint = requirement_constraints[package_name]
package_name = f'{package_name}{constraint}'
requirements.append(package_name)
return requirements


setup(
name=name,
@@ -30,5 +47,5 @@
keywords=
'raster deep-learning ml computer-vision earth-observation geospatial geospatial-processing',
packages=find_namespace_packages(exclude=['integration_tests*', 'tests*']),
install_requires=install_requires,
install_requires=parse_requirements(join(here, 'requirements.txt')),
zip_safe=False)
35 changes: 26 additions & 9 deletions rastervision_pytorch_learner/setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# flake8: noqa

from os import path as op
import io
from setuptools import (setup, find_namespace_packages)

here = op.abspath(op.dirname(__file__))
with io.open(op.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
from os.path import abspath, dirname, join
from setuptools import setup, find_namespace_packages
import re

name = 'rastervision_pytorch_learner'
version = '0.21.4-dev'
description = 'A rastervision plugin that adds PyTorch training pipelines'
requirement_constraints = {}

here = abspath(dirname(__file__))


def parse_requirements(requirements_path: str) -> list[str]:
requirements = []
with open(requirements_path, 'r', encoding='utf-8') as f:
for line in f:
if 'git+' in line:
continue
# match package name, ignoring version constraints
match = re.match(r'^\s*([^\s<=>]+)', line)
if not match:
continue
package_name = match.group(1)
if package_name in requirement_constraints:
constraint = requirement_constraints[package_name]
package_name = f'{package_name}{constraint}'
requirements.append(package_name)
return requirements


setup(
name=name,
@@ -30,5 +47,5 @@
keywords=
'raster deep-learning ml computer-vision earth-observation geospatial geospatial-processing',
packages=find_namespace_packages(exclude=['integration_tests*', 'tests*']),
install_requires=install_requires,
install_requires=parse_requirements(join(here, 'requirements.txt')),
zip_safe=False)
56 changes: 28 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
# flake8: noqa

from os import path as op
import os
import json
import io
from os.path import abspath, dirname, join
from setuptools import setup, find_namespace_packages
import re
from setuptools import (setup, find_namespace_packages)
from imp import load_source

here = op.abspath(op.dirname(__file__))
__version__ = '0.21.4-dev'

# get the dependencies and installs
with io.open(op.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')

# The RTD build environment fails with the reqs in bad_reqs.
if 'READTHEDOCS' in os.environ:
bad_reqs = ['pyproj', 'h5py']
all_reqs = list(
filter(lambda r: r.split('==')[0] not in bad_reqs, all_reqs))

install_requires = [x.strip() for x in all_reqs if 'git+' not in x]


def replace_images(readme):
requirement_constraints = {}

here = abspath(dirname(__file__))


def parse_requirements(requirements_path: str) -> list[str]:
requirements = []
with open(requirements_path, 'r', encoding='utf-8') as f:
for line in f:
if 'git+' in line:
continue
# match package name, ignoring version constraints
match = re.match(r'^\s*([^\s<=>]+)', line)
if not match:
continue
package_name = match.group(1)
if package_name in requirement_constraints:
constraint = requirement_constraints[package_name]
package_name = f'{package_name}{constraint}'
requirements.append(package_name)
return requirements


def replace_images(readme) -> str:
"""Replaces image links in the README with static links to
the GitHub release branch."""
release_branch = '.'.join(__version__.split('.')[:2])
r = r'\((docs/)(.*\.png)'
rep = (r'(https://raw.githubusercontent.com/azavea/raster-vision/'
'{}/docs/\g<2>'.format(release_branch))

rep = rf'(https://raw.githubusercontent.com/azavea/raster-vision/{release_branch}/docs/\g<2>'
return re.sub(r, rep, readme)


# del extras_require['feature-extraction']

setup(
name='rastervision',
version=__version__,
@@ -58,4 +58,4 @@ def replace_images(readme):
'raster deep-learning ml computer-vision earth-observation geospatial geospatial-processing',
packages=[],
include_package_data=True,
install_requires=install_requires)
install_requires=parse_requirements(join(here, 'requirements.txt')))

0 comments on commit afaac58

Please sign in to comment.