-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add create-network cli command #524
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code review ACK, looks good. I do think its worth changing warnet create
to mean create a network
in this PR, and either only having warnet init
or warnet new
and init
for starting a project.
src/warnet/graph.py
Outdated
|
||
|
||
@click.command() | ||
def create_network(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! @willcl-ark had suggested previously we use warnet init
and warnet new
for initialising or creating new project directories. this matches cargo's new/init.
if we did that, we could just use warnet create
for creating a new network? I prefer the smaller cli command names and I don't envision a user creating anything but a new network.
we could also just have one command for initialising, e.g. warnet init
and use warnet create
for creating a network, which would be easy enough to do in this PR, and then we can add warnet new
later if we feel its needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about dropping create / new?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id be fine to only have warnet init
. initially I was thinking warnet create
would be helpful when you want to manage multiple warnet directories, but starting to feel like no one uses it and it was premature optimisation.
id much rather we have warnet init
and then have warnet create
for creating networks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in df2856d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cargo
has cargo init
and cargo new
which IMO make sense. Both make a new project, one in current dir, and one in the dir provided as arg.
No strong opinion though
src/warnet/graph.py
Outdated
yaml.dump(network_yaml_data, f, default_flow_style=False) | ||
|
||
# Generate defaults.yaml | ||
default_yaml_path = files("resources.networks").joinpath("6_node_bitcoin/node-defaults.yaml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self: we should move all the hardcoded values into something like config.py or constants.py , so these can be something like default_yaml_path = config.DEFAULT_YAML_PATH
etc
not sure what to make of this....?
|
5336cdb
to
e829dad
Compare
hmm, not sure, could be that the timeout needs to be longer. I assumed it was seconds but perhaps it's milliseconds. |
3bda429
to
05bdefe
Compare
Care to give it another go @pinheadmz ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code review ACK, thanks for taking the naming suggestion for the cli command
# Check if the project has a networks directory | ||
if not (project_path / "networks").exists(): | ||
click.secho( | ||
"The current directory does not have a 'networks' directory. Please run 'warnet init' or 'warnet create' first.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to update this help text now that we only have warnet init
Test passed for me locally now, but CI doesnt look happy even though its green: Quick guess is test_base tries to call "warnet down" even though it was never up |
ACK, modulo weird test down thing. can be fixed in follow up |
was also running into this on a diff branch, iirc. I think we just need to fix warnet down so that if you call down and there's nothing there, it just gracefully exits (assuming that's actually the issue here) |
would be nice to get this in, can you rebase @m3dwards ? otherwise I can take a crack at resolving the merge conflicts |
df2856d
to
da58ade
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
da58ade
to
7e605db
Compare
7e605db
to
45c071a
Compare
Rebased after #536 |
Look @pinheadmz, a test!