Skip to content

Commit

Permalink
Merge pull request #87 from aaraney/move-development-deps-to-subpacka…
Browse files Browse the repository at this point in the history
…ge-79

Move development deps concern from namespace to subpackage concern
  • Loading branch information
jarq6c authored Jun 14, 2021
2 parents 4ae4ffa + e3b24bf commit 8927b92
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ DESCRIPTION = "{{ SHORT_DESCRIPTION }}"
# Package dependency requirements
REQUIREMENTS = []

# Development requirements
DEVELOPMENT_REQUIREMENTS = ["pytest"]

setup(
name=SUBPACKAGE_SLUG,
version=VERSION,
Expand All @@ -157,6 +160,7 @@ setup(
include=[f"{NAMESPACE_PACKAGE_NAME}.*"]
),
install_requires=REQUIREMENTS,
extras_require={"develop": DEVELOPMENT_REQUIREMENTS},
)
```

Expand Down
4 changes: 4 additions & 0 deletions python/events/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"pandas",
]

# Development requirements
DEVELOPMENT_REQUIREMENTS = ["pytest"]

setup(
name=SUBPACKAGE_SLUG,
version=VERSION,
Expand All @@ -53,4 +56,5 @@
namespace_packages=[NAMESPACE_PACKAGE_NAME],
packages=find_namespace_packages(include=[f"{NAMESPACE_PACKAGE_NAME}.*"]),
install_requires=REQUIREMENTS,
extras_require={"develop": DEVELOPMENT_REQUIREMENTS},
)
4 changes: 4 additions & 0 deletions python/gcp_client/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"numpy>=1.20.0"
]

# Development requirements
DEVELOPMENT_REQUIREMENTS = ["pytest"]

setup(
name=SUBPACKAGE_SLUG,
version=VERSION,
Expand Down Expand Up @@ -66,4 +69,5 @@
]
},
install_requires=REQUIREMENTS,
extras_require={"develop": DEVELOPMENT_REQUIREMENTS},
)
4 changes: 4 additions & 0 deletions python/metrics/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"numpy>=1.20.0"
]

# Development requirements
DEVELOPMENT_REQUIREMENTS = ["pytest"]

setup(
name=SUBPACKAGE_SLUG,
version=VERSION,
Expand All @@ -54,4 +57,5 @@
namespace_packages=[NAMESPACE_PACKAGE_NAME],
packages=find_namespace_packages(include=[f"{NAMESPACE_PACKAGE_NAME}.*"]),
install_requires=REQUIREMENTS,
extras_require={"develop": DEVELOPMENT_REQUIREMENTS},
)
17 changes: 4 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
LONG_DESCRIPTION = Path("README.md").read_text()
LICENSE = Path("LICENSE").read_text()

# Development requirements
DEVELOPMENT_REQUIREMENTS = ["pytest"]


def get_subpackage_names() -> List[str]:
# This assumes that each subpackage has a setup.py and is located under python/
Expand Down Expand Up @@ -90,9 +87,7 @@ def build_subpackage_mapping() -> Dict[str, str]:
return subpackage_mapping


def install_subpackages(
sources: dict,
) -> None:
def install_subpackages(sources: dict, develop_flag: bool = False) -> None:
"""Install all subpackages in a namespace package
Parameters
Expand All @@ -107,6 +102,8 @@ def install_subpackages(
for k, v in sources.items():
try:
subpackage_dir = str(ROOT_DIR / v)
if develop_flag:
subpackage_dir = f"{subpackage_dir}[develop]"
subprocess.check_call(
[
sys.executable,
Expand All @@ -128,12 +125,7 @@ def install_subpackages(
# Development installation
class Develop(develop):
def run(self):
install_subpackages(SUBPACKAGES)
# Install development requirements
for dev_requirement in DEVELOPMENT_REQUIREMENTS:
subprocess.check_call(
[sys.executable, "-m", "pip", "install", dev_requirement]
)
install_subpackages(SUBPACKAGES, develop_flag=True)


setup(
Expand All @@ -155,7 +147,6 @@ def run(self):
url=URL,
license=LICENSE,
install_requires=REQUIREMENTS,
extras_require={"test": DEVELOPMENT_REQUIREMENTS},
python_requires=">=3.7",
cmdclass={"develop": Develop},
)

0 comments on commit 8927b92

Please sign in to comment.