Skip to content

Commit

Permalink
fixing sdk only installation (#1487)
Browse files Browse the repository at this point in the history
Co-authored-by: Alejandro Esquivel <[email protected]>
  • Loading branch information
wjcunningham7 and AlejandroEsquivel authored Jan 17, 2023
1 parent 27709cc commit 46fd7e9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- MNIST tutorial now shows non-Null outputs and the classifier training log image has been updated.
- Minor changes to tutorials: autoencoder, quantum and classical svm, ensemble classification, iris classification with Pennylane, quantum chemistry, DNN tutorial, qaoa, spacetime tutorial etc.
- The range of `networkx` versions in requirements.txt weren't compatible with each other, thus it is pinned to `2.8.6` now
- SDK-only sdist and installation should now work as expected, not packaging the server

### Added

Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
include VERSION
include requirements.txt
include requirements-client.txt
include covalent_ui/log_config.yml
recursive-include covalent/executor/executor_plugins/ *
recursive-include covalent_dispatcher/_service/ *
recursive-include covalent_migrations/ *
Expand Down
49 changes: 41 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from setuptools import Command, find_packages, setup
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
from setuptools.command.egg_info import egg_info, manifest_maker

site.ENABLE_USER_SITE = "--user" in sys.argv[1:]

Expand All @@ -33,9 +34,20 @@


requirements_file = "requirements.txt"
sdk_only = os.environ.get("COVALENT_SDK_ONLY")
if sdk_only == "True":
exclude_modules = [
"tests",
"tests.*",
]
sdk_only = os.environ.get("COVALENT_SDK_ONLY") == "1"
if sdk_only:
requirements_file = "requirements-client.txt"
exclude_modules += [
"covalent_dispatcher",
"covalent_dispatcher.*",
"covalent_ui",
"covalent_ui.*",
"covalent_migrations",
]

with open(requirements_file) as f:
required = f.read().splitlines()
Expand Down Expand Up @@ -151,9 +163,34 @@ def run(self):
)


class EggInfoCovalent(egg_info):
def find_sources(self):
manifest_filename = os.path.join(self.egg_info, "SOURCES.txt")
mm = manifest_maker(self.distribution)
mm.manifest = manifest_filename

if os.path.exists("MANIFEST.in") and sdk_only:
with open("MANIFEST.in", "r") as f:
lines = f.readlines()
with open("MANIFEST_SDK.in", "w") as f:
for line in lines:
if not any(excluded in line for excluded in exclude_modules):
f.write(line)

mm.template = "MANIFEST_SDK.in"

mm.run()
self.filelist = mm.filelist

try:
os.remove("MANIFEST_SDK.in")
except OSError:
pass


setup_info = {
"name": "covalent",
"packages": find_packages(exclude=["tests"]),
"packages": find_packages(exclude=exclude_modules),
"version": version,
"maintainer": "Agnostiq",
"url": "https://github.com/AgnostiqHQ/covalent",
Expand All @@ -166,11 +203,6 @@ def run(self):
"long_description_content_type": "text/markdown",
"include_package_data": True,
"zip_safe": False,
"package_data": {
"covalent": ["executor/executor_plugins/local.py"],
"covalent_dispatcher": ["_service/app.py"],
"covalent_ui": recursively_append_files("covalent_ui/webapp/build"),
},
"install_requires": required,
"extras_require": {
"aws": ["boto3>=1.20.48"],
Expand Down Expand Up @@ -199,6 +231,7 @@ def run(self):
"Topic :: System :: Distributed Computing",
],
"cmdclass": {
"egg_info": EggInfoCovalent,
"build_py": BuildCovalent,
"develop": DevelopCovalent,
"docs": Docs,
Expand Down

0 comments on commit 46fd7e9

Please sign in to comment.