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

feat: added option to generate basic ape-config.yaml file if [tool.ape.plugins] property is specified inside pyproject.toml file [APE-1312] #1618

Closed
wants to merge 16 commits into from

Conversation

Aviksaikat
Copy link
Contributor

What I did

Added option to specify plugins in the ape-config.yaml file based on the [tool.ape.plugins] property of pyproject.toml file.

fixes: #1571

How I did it

Added functions for parsing the pyproject.toml file & look for lines which have the ape- initials & then stripping them & put them inside the ape-config.yaml file with proper formatting

How to verify it

  1. Create a new folder with this pyproject.toml file
[tool.poetry]
name = "testing ape-config"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
readme = "README.md"
packages = [{include = "Flash_loan_arbritage"}]

[tool.poetry.dependencies]
python = ">=3.10,<3.11"
eth-ape = "*"
ape-alchemy = "^0.6.2"
ape-solidity= "^0.6.7"
ape-foundry = "^0.6.14"
ape-etherscan = "*"


[tool.ape.plugins]
ape-alchemy = "*"
ape-solidity = "*"
ape-foundry = "*"
ape-etherscan = "*"

# working on adding support for this property
[tool.ape.network]
ecosystem = "ethereum"
default_network = "mainnet-fork"
default_provider = "foundry"

# working on adding support for this property
[tool.ape.tests]
mnemonic = "test test test test test test test test test test test junk"
number_of_test_accounts = 10

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
  1. Then create a new virtual environment by doing poetry install && poetry shell
  2. Then run pip install -e <path/to/the/cloned/repo/with/this/revision/
  3. Then run ape init
  4. Done

POC

image
image

Checklist

  • All changes are completed
  • New test cases have been added
  • Documentation has been updated

…e.plugins] property is specified inside pyproject.toml file
@vany365 vany365 changed the title feat: added option to generate basic ape-config.yaml file if [tool.ape.plugins] property is specified inside pyproject.toml file feat: added option to generate basic ape-config.yaml file if [tool.ape.plugins] property is specified inside pyproject.toml file [APE-1312] Aug 23, 2023
Copy link
Member

@antazoey antazoey left a comment

Choose a reason for hiding this comment

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

Some missing things,
and I think there is a helpful standard library to assist with this and simplify the code we have to manage

src/ape_init/_cli.py Outdated Show resolved Hide resolved
src/ape_init/_cli.py Outdated Show resolved Hide resolved
src/ape_init/_cli.py Outdated Show resolved Hide resolved
src/ape_init/_cli.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
Copy link
Member

@antazoey antazoey left a comment

Choose a reason for hiding this comment

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

nice work but things are in the wrong spot and we should be configuring the tool directly instead of generating a config from a config


def read_dependencies_from_toml(file_path, cli_ctx) -> List[str]:

with open("./pyproject.toml", "rb") as file:
Copy link
Member

Choose a reason for hiding this comment

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

this should all happen in the config manage, not in ape-init plugin.
And then you can use the project_manager.path as the base here instead of cwd

return ape_plugins


def write_ape_config_yml(dependencies: List[str], file_to_write: Path):
Copy link
Member

Choose a reason for hiding this comment

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

instead of writing an ape file, the ConfigManager should read the values from the pyproject.toml and treat it the same as if the config file had existed. There is not reason to configure twice, even if one is auto-generated.

@github-actions
Copy link

github-actions bot commented Oct 6, 2023

This pull request is considered stale because it has been open 30 days with no activity. Remove stale label, add a comment, or make a new commit, otherwise this PR will be closed in 5 days.

@github-actions github-actions bot added the stale No activity for 30 days label Oct 6, 2023
@Aviksaikat
Copy link
Contributor Author

any update on this one ?

@antazoey
Copy link
Member

antazoey commented Oct 6, 2023

any update on this one ?

There is a quite a lot of unaddressed feedback. Basically, we want this to be another source of config rather than creating a config file from it

@Aviksaikat
Copy link
Contributor Author

Aviksaikat commented Oct 6, 2023

so let's make it a draft and wait for further feedback?

@github-actions github-actions bot removed the stale No activity for 30 days label Oct 7, 2023
@antazoey
Copy link
Member

antazoey commented Oct 9, 2023

so let's make it a draft and wait for further feedback?

We are not able to provide any more feedback until the approach matches more with the design of having the pyproject.toml be source of config rather than it generating a new config file.

@fubuloubu
Copy link
Member

so let's make it a draft and wait for further feedback?

We are not able to provide any more feedback until the approach matches more with the design of having the pyproject.toml be source of config rather than it generating a new config file.

to expand on this, make it look something like this I suppose:

[tools.ape]
plugins = [
    etherscan,
    vyper,
]

Copy link

github-actions bot commented Nov 9, 2023

This pull request is considered stale because it has been open 30 days with no activity. Remove stale label, add a comment, or make a new commit, otherwise this PR will be closed in 5 days.

@github-actions github-actions bot added the stale No activity for 30 days label Nov 9, 2023
@fubuloubu
Copy link
Member

I think this approach should be closed for now. I am in favor of migrating the ape-config.yaml file actually into pyproject.toml but it needs a lot of further thought

@fubuloubu fubuloubu closed this Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale No activity for 30 days
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pyproject.toml based ape configuration [APE-1238]
4 participants