Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use manifest project #47

Merged
merged 6 commits into from
Sep 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,10 @@ async def compile_project(project_root: Path, manifest: PackageManifest):
# Create a contracts directory
contracts_dir = project_root / "contracts"
contracts_dir.mkdir()

# add request contracts in temp directory
if manifest.sources:
for filename, source in manifest.sources.items():
path = contracts_dir / filename
# NOTE: In case there is a multi-level path
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(source.fetch_content())
project = Project.from_manifest(manifest)
Copy link
Member Author

@antazoey antazoey Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw when it comes time to add the dependencies, you can do it like this:

project = Project.from_manifest(manifest, config_override={"dependencies": [{"pypi": "snekmate"}]})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can config_override accept a list of DependencyAPI objects? that's how I was thinking to parse the incoming dependency specifications

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you can pass in objects as well but you dont have to: itll validate them if you use raw dicts

try:
project = Project(project_root)
compiled_manifest = project.extract_manifest()
results[project_root.name] = compiled_manifest
project.load_contracts()
results[project_root.name] = manifest
fubuloubu marked this conversation as resolved.
Show resolved Hide resolved
tasks[project_root.name] = TaskStatus.SUCCESS
except CompilerError as e:
results[project_root.name] = [
Expand Down
Loading