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
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"tqdm>=4.62.3,<5.0",
"traitlets>=5.3.0",
"watchdog>=3.0,<4",
"tomli>=2.0.1",
Aviksaikat marked this conversation as resolved.
Show resolved Hide resolved
# ** Dependencies maintained by Ethereum Foundation **
"eth-abi>=4.1.0,<5",
"eth-account>=0.8,<0.9",
Expand Down
6 changes: 3 additions & 3 deletions src/ape_init/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ape.utils import github_client

try:
import tomllib
import tomllib # type: ignore[import]
# backwards compatibility
except ModuleNotFoundError:
import tomli as tomllib
Expand All @@ -25,7 +25,7 @@ def read_dependencies_from_toml(file_path, cli_ctx) -> List[str]:
f"Unable to populate contnets from pyproject.toml file. {file_path} doesn't exists."
)

except tomli.TOMLDecodeError:
except tomllib.TOMLDecodeError:
cli_ctx.logger.warning(f"Error reading {file_path} file.")

# Extract the 'tool.poetry.dependencies' section
Expand All @@ -37,7 +37,7 @@ def read_dependencies_from_toml(file_path, cli_ctx) -> List[str]:
return ape_plugins


def write_ape_config_yml(dependencies: List[str], file_to_write: pathlib.PosixPath):
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.

dependency_text = "plugins:\n" + "\n".join(
[f" - name: {dependency}" for dependency in dependencies]
)
Expand Down
Loading