Python port of Metaplex JS SDK - https://github.com/metaplex-foundation/js
Project description
original-metaplex-python
Python port of Metaplex JS SDK - https://github.com/metaplex-foundation/js
Installing this package
If you simply want to use this package, first clone this repository on your machine, then install it from your file system using pip:
pip install -e /path/to/your/directory/original-metaplex-python
or poetry:
poetry add -e /path/to/your/directory/original-metaplex-python
Note -e adds it in editable mode.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites
Before you begin, ensure you have the following installed:
- Python 3.10 or higher
- Poetry for dependency management and packaging
Setting Up the Development Environment
- Clone the repository
git clone https://github.com/getoriginal/original-metaplex-python.git
cd original-metaplex-python
- Install dependencies
Run the following command to install the project dependencies:
poetry install --no-root
This command reads the pyproject.toml
file and installs all necessary dependencies, including development dependencies, into a new virtual environment managed by Poetry.
- Activate the virtual environment
To activate the Poetry-managed virtual environment, use:
poetry shell
Alternatively, you can run commands within the virtual environment using poetry run <command>
without activating it.
- Set up pre-commit hooks
Install the pre-commit hooks with:
pre-commit install
This step ensures that the code linters and formatters run on every commit to maintain code quality and consistency.
Running the Application
First we need to create some wallets.
Use the Phantom wallet browser extension to create two new accounts. Then grab the private keys and put one in each of the files:
wallet_secret.txt // Used to mint NFTs
wallet_secret_friend.txt // The friend's wallet to test transferring.
Both files should be placed at the root of your project.
Ensure that the wallet_secret.txt account is topped up with DevNet SOL. You can get devnet SOL here: https://faucet.solana.com/ and pass the public key of the wallet.
Test flow
src/tests/e2e/test_create_update_flow.py
and src/tests/e2e/test_create_update_transfer_burn_flow.py
will be the files of most interest.
It is where the full creation of a collection, minting an NFT, updating it, transferring it and burning is tested.
The burn and transfer is separated in case you want to inspect the NFT before it is either transferred or burned.
If you use pycharm, you should be able to run the tests from the IDE.
Running Tests
To run the unit tests, use the following command:
poetry run pytest -m unit
And for the e2e test flow, use the following command:
poetry run pytest -m e2e
You can also just run this if you want to experiment with the flow outside the tests:
python -m original_metaplex_python.app
Tools & IDE
black: code formatter
https://black.readthedocs.io/
config: pyproject.toml
pre-commit & pre-push: enabled
black .
pre-commit run black --all-files
flake8: linter
https://flake8.pycqa.org/
config: .flake8
pre-commit & pre-push: enabled
flake8 .
pre-commit run flake8 --all-files
isort: import sorting
https://pycqa.github.io/isort/
config: pyproject.toml
pre-commit & pre-push: enabled
isort .
pre-commit run isort --all-files
mypy: type checking
https://mypy.readthedocs.io/
config: mypy.ini
pre-commit & pre-push: enabled
mypy .
pre-commit run mypy --all-files
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for original_metaplex_python-0.0.1a3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea79d864495b53d3ec1938322839b4bbb41d9cd696d942be4f12754af9cb048b |
|
MD5 | 14ae92a85a33a435ad1d3af84c8d1988 |
|
BLAKE2b-256 | c61519c13d600b8790a6d7bb4d89d0f8443b79a5f3c2dd3e8e1931393ebf5439 |
Hashes for original_metaplex_python-0.0.1a3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5ad1714877a07391c3904871c7707c575d26b2617147cb3234943268149513f |
|
MD5 | 59dada2a0bfa8f41e4ff340ec25f6ed0 |
|
BLAKE2b-256 | 87eab2df709bfcee4a6528fc4db5124d55c3c75a7f655b7f4375f9968cc51ece |