Repository: delvtech/pypechain (language: python)

Issue:
[ISSUE] Package does not work as expected
I have tried running it several times on different abis, including the Example.json which worked with some error:

```
❯ pypechain abi/Example.json
WARNING:root:Unknown Solidity type: InnerStruct
WARNING:root:Unknown Solidity type: InnerStruct
WARNING:root:Unknown Solidity type: InnerStruct
WARNING:root:Unknown Solidity type: InnerStruct
WARNING:root:Unknown Solidity type: InnerStruct
WARNING:root:Unknown Solidity type: InnerStruct
WARNING:root:Unknown Solidity type: InnerStruct
WARNING:root:Unknown Solidity type: InnerStruct
WARNING:root:Unknown Solidity type: InnerStruct
WARNING:root:Unknown Solidity type: InnerStruct
autoflake --remove-all-unused-imports pypechain_types/ExampleContract.py
/bin/sh: autoflake: command not found
Error creating types for abi/Example.json
Traceback (most recent call last):
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/bin/pypechain", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/lib/python3.11/site-packages/pypechain/main.py", line 60, in main
    raise err
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/lib/python3.11/site-packages/pypechain/main.py", line 53, in main
    rendered_file_names = render_files(str(json_file), output_dir, line_length)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/lib/python3.11/site-packages/pypechain/render/main.py", line 31, in render_files
    format_file(contract_file_path, line_length)
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/lib/python3.11/site-packages/pypechain/utilities/format.py", line 124, in format_file
    subprocess.run(f"autoflake --in-place --remove-all-unused-imports {file_path}", shell=True, check=True)
  File "/Users/daniel.zarifpour/.pyenv/versions/3.11.5/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'autoflake --in-place --remove-all-unused-imports pypechain_types/ExampleContract.py' returned non-zero exit status 127.
```

---

For other abis, it seems impossible to run.

```
❯ pypechain abi/RebalanceContractMock.json
Error creating types for abi/RebalanceContractMock.json
Traceback (most recent call last):
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/bin/pypechain", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/lib/python3.11/site-packages/pypechain/main.py", line 60, in main
    raise err
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/lib/python3.11/site-packages/pypechain/main.py", line 53, in main
    rendered_file_names = render_files(str(json_file), output_dir, line_length)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/lib/python3.11/site-packages/pypechain/render/main.py", line 23, in render_files
    rendered_contract_code = render_contract_file(contract_name, file_path)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/lib/python3.11/site-packages/pypechain/render/contract.py", line 51, in render_contract_file
    abi, bytecode = load_abi_from_file(abi_file_path)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/lib/python3.11/site-packages/pypechain/utilities/abi.py", line 449, in load_abi_from_file
    abi = get_abi_from_json(json_file)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daniel.zarifpour/rebalance_bot/.venv/lib/python3.11/site-packages/pypechain/utilities/abi.py", line 704, in get_abi_from_json
    raise ValueError("Unable to identify an ABI for the given JSON.")
ValueError: Unable to identify an ABI for the given JSON.
```

Also, when I try running as a standalone file (as provided in the README, it is impossible to fix this error.

```
usage: pychain.py [-h] [--output_dir OUTPUT_DIR]
                  [--line_length LINE_LENGTH]
                  abi_file_path
pychain.py: error: the following arguments are required: abi_file_path
```
---

It also seems it's not installing as expected as I had to manually install iSort and in Example.json it's complaining about autoflake.


Discussion / hints:
Thanks for alerting us to this @zarifpour! We will look into it and report back.

Fix patch:
diff --git a/.env.sample b/.env.sample
index a789490b..74d33755 100644
--- a/.env.sample
+++ b/.env.sample
@@ -1,2 +1,2 @@
-TWINE_USERNAME=pypi_username
-TWINE_PASSWORD=pypi_password
\ No newline at end of file
+TWINE_USERNAME=__token__
+TWINE_PASSWORD=YOUR_PYPI_API_TOKEN
\ No newline at end of file
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 59295d33..b793d4aa 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -18,7 +18,7 @@ jobs:
       - name: set up python
         uses: actions/setup-python@v4
         with:
-          python-version: "3.10"
+          python-version: "3.11"
           cache: "pip"
           token: ${{github.token}}
 
@@ -26,8 +26,9 @@ jobs:
         run: python -m pip install --upgrade pip
 
       - name: install requirements
+        # include toml because a file in scripts/ needs it.
         run: |
-          python -m pip install --upgrade .[all]
+          python -m pip install --upgrade .[test] && python -m pip install toml
 
       - name: run black
         run: python -m black --config pyproject.toml --check --diff .
diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml
index c5b1ae61..e011c887 100644
--- a/.github/workflows/static.yml
+++ b/.github/workflows/static.yml
@@ -18,7 +18,7 @@ jobs:
       - name: set up python
         uses: actions/setup-python@v4
         with:
-          python-version: "3.10"
+          python-version: "3.11"
           cache: "pip"
           token: ${{github.token}}
 
@@ -27,7 +27,7 @@ jobs:
 
       - name: install requirements
         run: |
-          python -m pip install --upgrade .[all]
+          python -m pip install --upgrade .[test]
 
       - name: get all Python files
         id: list_files
diff --git a/README.md b/README.md
index cedda8aa..389543ec 100644
--- a/README.md
+++ b/README.md
@@ -39,14 +39,14 @@ For development install instructions, see toplevel [INSTALL.md](https://github.c
 
 ## Packages 📦
 
-| Package Name | Version                                                                                  | Description                                      |
-| ------------ | ---------------------------------------------------------------------------------------- | ------------------------------------------------ |
-| pypechain    | [![](https://img.shields.io/pypi/v/pypechain.svg)](<(https://pypi.org/pypi/pypechain/)>) | Codegen python interfaces for web3.py contracts. |
-| flit         | [![](https://img.shields.io/pypi/v/flit.svg)](<(https://pypi.org/pypi/flit/)>)           | A simple packaging tool for simple packages.     |
-| black        | [![](https://img.shields.io/pypi/v/black.svg)](<(https://pypi.org/pypi/black/)>)         | The uncompromising code formatter.               |
-| jinja2       | [![](https://img.shields.io/pypi/v/jinja2.svg)](<(https://pypi.org/pypi/jinja2/)>)       | A very fast and expressive template engine.      |
-| web3         | [![](https://img.shields.io/pypi/v/web3.svg)](<(https://pypi.org/pypi/web3/)>)           | web3.py                                          |
-
+| Package Name | Version | Description |
+|--------------|---------|-------------|
+| pypechain | [![](https://img.shields.io/pypi/v/pypechain.svg)]((https://pypi.org/pypi/pypechain/)) | Codegen python interfaces for web3.py contracts. |
+| autoflake | [![](https://img.shields.io/pypi/v/autoflake.svg)]((https://pypi.org/pypi/autoflake/)) | Removes unused imports and unused variables |
+| black | [![](https://img.shields.io/pypi/v/black.svg)]((https://pypi.org/pypi/black/)) | The uncompromising code formatter. |
+| isort | [![](https://img.shields.io/pypi/v/isort.svg)]((https://pypi.org/pypi/isort/)) | A Python utility / library to sort Python imports. |
+| jinja2 | [![](https://img.shields.io/pypi/v/jinja2.svg)]((https://pypi.org/pypi/jinja2/)) | A very fast and expressive template engine. |
+| web3 | [![](https://img.shields.io/pypi/v/web3.svg)]((https://pypi.org/pypi/web3/)) | web3.py |
 ## Usage
 
 Pypechain is primarily to be used via the CLI:
diff --git a/pyproject.toml b/pyproject.toml
index f4cbfebe..dafdf335 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,7 +1,7 @@
 [project]
 
 name = "pypechain"
-version = "0.0.21"
+version = "0.0.23"
 authors = [
     { name = "Matthew Brown", email = "matt@delv.tech" },
     { name = "Dylan Paiton", email = "dylan@delv.tech" },
@@ -10,31 +10,29 @@ authors = [
 ]
 description = "Codegen python interfaces for web3.py contracts."
 readme = "README.md"
-requires-python = ">=3.10"
+requires-python = ">=3.11"
 classifiers = [
     "Programming Language :: Python :: 3",
     "License :: OSI Approved :: Apache Software License",
     "Operating System :: OS Independent",
 ]
-dependencies = ["flit", "black", "jinja2", "web3"]
+dependencies = ["autoflake", "black", "isort", "jinja2", "web3"]
 
 [project.scripts]
 pypechain = "pypechain.main:main"
 
 [project.optional-dependencies]
 # This flag installs all dependencies and should be ran when installing this package
-all = ["pypechain[base,build,test]"]
-base = ["black", "isort", "jinja2", "web3", "autoflake"]
-build = ["build", "setuptools", "wheel", "twine", "toml"]
+all = ["pypechain[test,build]"]
 test = [
-    "pytest",
-    "pytest-snapshot",
-    "pyright",
-    "pylint",
     "coverage",
-    "isort",
     "factory-boy",
+    "pylint",
+    "pyright",
+    "pytest",
+    "pytest-snapshot",
 ]
+build = ["build", "flit", "request", "setuptools", "toml", "twine", "wheel"]
 
 [project.urls]
 "Homepage" = "https://github.com/delvtech/pypechain"


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index c6d2a7ff..481f5ecd 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -18,7 +18,7 @@ jobs:
       - name: set up python
         uses: actions/setup-python@v4
         with:
-          python-version: "3.10"
+          python-version: "3.11"
           cache: "pip"
           token: ${{github.token}}
 
@@ -27,7 +27,7 @@ jobs:
 
       - name: install requirements
         run: |
-          python -m pip install --upgrade .[all]
+          python -m pip install --upgrade .[test]
 
       - name: Install Foundry
         uses: foundry-rs/foundry-toolchain@v1