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!: 0.8 #2098

Merged
merged 23 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d510ba4
refactor!: remove goerli and mumbai (#1993)
NotPeopling2day Apr 16, 2024
8cfd743
fix!: handle missing size with computed lookup (#1980)
antazoey Apr 16, 2024
7fee741
refactor: misc 08 changes (#1984)
antazoey Apr 16, 2024
71cbad6
refactor: make `.config`` the network cfg (#1981)
antazoey Apr 16, 2024
6670ed7
refactor: swap out github with http
antazoey Apr 16, 2024
15ebf35
feat!: add automine abstract property to TestProviderAPI (#1974)
antazoey Apr 17, 2024
64f939e
refactor!: rename geth to node (#1982)
antazoey Apr 18, 2024
0617484
refactor!: TraceAPI (#1864)
antazoey Apr 18, 2024
011ca9d
refactor: drop 3.8 support
antazoey Apr 20, 2024
cea8900
feat!: contract creation metadata (#2001)
banteg Apr 22, 2024
f7e7db5
refactor: separate CORE_PLUGINS from setup.py
antazoey Apr 23, 2024
f20487e
refactor!: use `ContractSource` type requirement (#2029)
antazoey Apr 29, 2024
8bfe292
refactor!: use `name` instead of `data_folder` for accounts (#2025)
antazoey Apr 29, 2024
49864e1
refactor: remove data_folder from networkapis (#2038)
antazoey Apr 30, 2024
c9b357d
feat: hide home dir in project.path and all paths in `ape console` (#…
antazoey May 7, 2024
1450e0c
refactor!: rename `ape pm remove` to `ape pm uninstall` (#2059)
antazoey May 7, 2024
0829558
refactor: delete deprecated constructs (#2057)
antazoey May 7, 2024
1be2708
refactor!: In CompilerAPI, use Iterable and Iterator instead of Seque…
antazoey May 9, 2024
668b9ae
fix: call trace trace fix (#2090)
antazoey May 15, 2024
debb86d
fix: trace API fixes (#2093)
antazoey May 17, 2024
e2bd433
refactor!: trace API use iter for struct logs (#2095)
antazoey May 17, 2024
90e038d
chore!: update pytest (#2097)
antazoey May 20, 2024
b458100
refactor!: project system refactors (#1960)
antazoey May 28, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
# TODO: Replace with macos-latest when works again.
# https://github.com/actions/setup-python/issues/808
os: [ubuntu-latest, macos-12] # eventually add `windows-latest`
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: [3.9, "3.10", "3.11", "3.12"]

env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Read our [academic platform](https://academy.apeworx.io/) will help you master A
In the latest release, Ape requires:

- Linux or macOS
- Python 3.8 up to 3.12
- Python 3.9 up to 3.12
- **Windows**: Install Windows Subsystem Linux [(WSL)](https://docs.microsoft.com/en-us/windows/wsl/install)

Check your python version in a terminal with `python3 --version`.
Expand Down
5 changes: 2 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import sys
from functools import lru_cache
from pathlib import Path
from typing import List

import requests
from packaging.version import Version
Expand Down Expand Up @@ -45,7 +44,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns: List[str] = ["_build", ".DS_Store"]
exclude_patterns: list[str] = ["_build", ".DS_Store"]


# The suffix(es) of source filenames.
Expand Down Expand Up @@ -115,7 +114,7 @@ def fixpath(path: str) -> str:


@lru_cache(maxsize=None)
def get_versions() -> List[str]:
def get_versions() -> list[str]:
"""
Get all the versions from the Web.
"""
Expand Down
14 changes: 12 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
userguides/scripts
userguides/publishing
userguides/logging
userguides/trace
```

```{eval-rst}
Expand All @@ -45,11 +46,10 @@

```{eval-rst}
.. toctree::
:caption: Python Reference
:caption: Core Python Reference
:maxdepth: 1

methoddocs/ape.md
methoddocs/ape_accounts.md
methoddocs/api.md
methoddocs/cli.md
methoddocs/contracts.md
Expand All @@ -59,3 +59,13 @@
methoddocs/types.md
methoddocs/utils.md
```

```{eval-rst}
.. toctree::
:caption: Plugin Python Reference
:maxdepth: 1

methoddocs/ape_accounts.md
methoddocs/ape_compile.md
methoddocs/ape_pm.md
```
6 changes: 6 additions & 0 deletions docs/methoddocs/ape_compile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ape-compile

```{eval-rst}
.. automodule:: ape_compile
:members:
```
6 changes: 6 additions & 0 deletions docs/methoddocs/ape_pm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ape-pm

```{eval-rst}
.. automodule:: ape_pm
:members:
```
26 changes: 1 addition & 25 deletions docs/methoddocs/managers.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,7 @@
## Project

```{eval-rst}
.. automodule:: ape.managers.project.manager
:members:
:special-members:
```

```{eval-rst}
.. automodule:: ape.managers.project.dependency
:members:
:special-members:
```

```{eval-rst}
.. autoclass:: ape.managers.project.types.BaseProject
:members:
:special-members:
```

```{eval-rst}
.. autoclass:: ape.managers.project.types.ApeProject
:members:
:special-members:
```

```{eval-rst}
.. autoclass:: ape.managers.project.types.BrownieProject
.. automodule:: ape.managers.project
:members:
:special-members:
```
Expand Down
33 changes: 17 additions & 16 deletions docs/userguides/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,8 @@ compile:
## Settings

Generally, configure compiler plugins using your `ape-config.yaml` file.
One setting that applies to many compiler plugins is `cache_folder`, which holds dependency source files the compiler uses when compiling your contracts.
By default, the folder is in your `contracts/.cache` folder but there are times you may want to move this to another location.
Paths are relative to the project directory.
For instance, to move the dependency cache to the root project directory:

```yaml
compile:
cache_folder: .cache
```

```{caution}
Changing the location of the dependency cache folder may alter the the output bytecode of your contracts from some compilers.
Specifically, the [solc compiler will apend a hash of the input metadata to the contract bytecode](https://docs.soliditylang.org/en/latest/metadata.html#encoding-of-the-metadata-hash-in-the-bytecode) which will change with contract path or compiler settings changes.
This may impact things like contract verification on existing projects.
```

As another example, when using the `vyper` plugin, you can configure settings under the `vyper` key:
For example, when using the `vyper` plugin, you can configure settings under the `vyper` key:

```yaml
vyper:
Expand Down Expand Up @@ -158,3 +143,19 @@ owner = accounts.test_accounts[0]

instance = container.deploy(sender=owner)
```

## Output Extra

Sometimes, there are extra output styles you may want.
For example, to output minified ABI JSONs, use the following config:

```yaml
compile:
output_extra:
- ABI
```

Then, after compiling, you should notice minified ABI json files in your `.build/abi` folder.
This is useful if hosting these files on a web-server.

To see the full list of supported output-extra, see [the OutpuExtra enum documentation](../methoddocs/ape_compile.html#ape_compile.OutputExtras).
4 changes: 2 additions & 2 deletions docs/userguides/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ geth:
uri: http://localhost:5030
```

Now, the `ape-geth` core plugin will use the URL `http://localhost:5030` to connect and make requests.
Now, the `ape-node` core plugin will use the URL `http://localhost:5030` to connect and make requests.

**WARN**: Instead of using `ape-geth` to connect to an Infura or Alchemy node, use the [ape-infura](https://github.com/ApeWorX/ape-infura) or [ape-alchemy](https://github.com/ApeWorX/ape-alchemy) provider plugins instead, which have their own way of managing API keys via environment variables.
**WARN**: Instead of using `ape-node` to connect to an Infura or Alchemy node, use the [ape-infura](https://github.com/ApeWorX/ape-infura) or [ape-alchemy](https://github.com/ApeWorX/ape-alchemy) provider plugins instead, which have their own way of managing API keys via environment variables.

For more information on networking as a whole, see [this guide](./networks.html).

Expand Down
2 changes: 1 addition & 1 deletion docs/userguides/contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ _ = contract.withdraw(sender=account, value="1 wei")

Notice that transacting returns a [ReceiptAPI](../methoddocs/api.html#ape.api.transactions.ReceiptAPI) object which contains all the receipt data, such as `gas_used`.

**NOTE**: If you need the `return_value` from a transaction, you have to either treat transaction as a call (see the section below!) or use a provider with tracing-features enabled (such as `ape-foundry` or `ape-geth`) and access the [return_value](../methoddocs/api.html#ape.api.transactions.ReceiptAPI.return_value) property on the receipt.
**NOTE**: If you need the `return_value` from a transaction, you have to either treat transaction as a call (see the section below!) or use a provider with tracing-features enabled (such as `ape-foundry` or `ape-node`) and access the [return_value](../methoddocs/api.html#ape.api.transactions.ReceiptAPI.return_value) property on the receipt.

```python
assert receipt.return_value == 123
Expand Down
53 changes: 31 additions & 22 deletions docs/userguides/dependencies.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Dependencies

Ape downloads and caches dependencies in the `.ape/packages/<name>/<version-id>` directory where `<name>` refers to the name of the dependency and `<version-id>` refers to the version or branch of the package.
When first downloading dependencies, Ape only places the source contents in the `sources` field of the `PackageManifest` and leaves the `contract_types` field untouched.
This is because dependencies may not compile by Ape's standard out-of-the-box but their contract types can still be used in projects that do.
Ape downloads and caches dependencies in the `.ape/packages` folder.
There are three sub-folders in `.ape/packages` for dependencies:

To use dependencies in your projects, you must configure them in your `ape-config.yaml` file.
1. `projects/` - contains the raw project files for each dependency in subsequent `/<name>/<version-id>` directories (where `<name>` refers to the path-ified full-name of the dependency, e.g. `"OpenZeppelin_openzeppelin-contracts"`, and `<version-id>` refers to the version or branch of the package).
This location is where local project compilation looks for additional sources from import statements.
2. `manifests/` - much like your local projects' `.build/__local__.json`, this is where dependencies cache their manifests.
When you compile a dependency, the contract types are stored in the dependency manifest's JSON file.
3. `api/` - for caching the API data placed in `dependencies:` config or `ape pm install` commands, allowing dependency usage and management from anywhere in the file system.

*NOTE*: You can install dependencies that don't compile out-of-the-box.
Sometimes, dependencies are only collections of source files not meant to compile on their own but instead be used in projects via import statements.
You can change the settings of a dependency using `config_override:` to compile dependencies after installed, if needed, and the `api/` cache always refers to the latest used during installation or compilation.

## Types of Dependencies

Expand Down Expand Up @@ -93,26 +100,17 @@ You can also install and / or compile dependencies using the `pm` CLI.

### list

To list information about the dependencies in your local project, run:
To list information about installed dependencies, run:

```shell
ape pm list
```

To list information about all installed dependencies across all projects, run:

```shell
ape pm list --all
```

You should see information like:

```shell
Packages:
OpenZeppelin v4.6.0, compiled!
vault master
vault v0.4.5
gnosis v1.3.0
NAME VERSION COMPILED
openzeppelin 4.9.3 -
```

### install
Expand Down Expand Up @@ -149,25 +147,35 @@ ape pm install gh:OpenZeppelin/openzeppelin-contracts \
--config-override '{"solidity": {"version": "0.8.12"}}'
```

### remove
You can also use Python to install dependencies, using `**kwargs` as the same fields you put in your `dependencies:` config:

```python
from ape import project

project.dependencies.install(
github="OpenZeppelin/openzeppelin-contracts", name="openzeppelin", version="4.4.2"
)
```

### uninstall

Remove previously installed packages using the `remove` command:
Remove previously installed packages using the `uninstall` command:

```shell
ape pm remove OpenZeppelin
ape pm uninstall OpenZeppelin
```

If there is a single version installed, the command will remove the single version.
If multiple versions are installed, pass additional arguments specifying the version(s) to be removed:

```shell
ape pm remove OpenZeppelin 4.5.0 4.6.0
ape pm uninstall OpenZeppelin 4.5.0 4.6.0
```

To skip the confirmation prompts, use the `--yes` flag (abbreviated as `-y`):

```shell
ape pm remove OpenZeppelin all --yes
ape pm uninstall OpenZeppelin all --yes
```

**NOTE**: Additionally, use the `all` special version key to delete all versions.
Expand Down Expand Up @@ -285,7 +293,8 @@ You can achieve this using the project manager:
from ape import accounts, project

# NOTE: This will compile the dependency
dependency_contract = project.dependencies["my_dependency"]["1.0.0"].DependencyContractType
dependency_project = project.dependencies["my_dependency"]["1.0.0"]
dependency_contract = dependency_project.DependencyContractType
my_account = accounts.load("alias")
deployed_contract = my_account.deploy(dependency_contract, "argument")
print(deployed_contract.address)
Expand Down
Loading
Loading