A small example package
Project description
graphpy_example_package
Installation
You can use this Python package by following these steps:
Step 1: Installation
From PyPI:
You can install the package from PyPI using pip: https://pypi.org/project/graphpy-example-package/
pip install graphpy-example-package
From Local:
If you have the package locally, navigate to the root folder with pyproject.toml
and run:
pip install ./
Step 2: Import
You can import the package's modules as follows:
from graphpy_example_package import gp_apis
Testing
To run the package's test file located in the test folder, execute the following command:
python3 GCN_graphpy_test.py --gdir /mnt/huge_26TB/data/test2/cora/ --category 7 --graph binary
Building the Python Package
To build the Python package, first install the necessary tools:
python3 -m pip install --upgrade build
Then build the package:
python3 -m build
Uploading the Package to PyPI
To upload the package to PyPI, ensure you have the twine
tool installed:
python3 -m pip install --upgrade twine
Then upload the package distribution:
python3 -m twine upload dist/*
Instructions for Creating Python Packages
This is a sample project demonstrating how to create a Python library and publish it on PyPI. The structure and steps to create and distribute a Python package are outlined here.
Reference Documentation
For detailed information on packaging and distributing Python projects, refer to the Packaging Python Projects tutorial on the official Python packaging website.
Project Structure
Ensure your project follows the following structure:
graphpy_example_package/
├── LICENSE
├── pyproject.toml
├── README.md
├── src/
│ └── graphpy_example_package/
│ ├── __init__.py
│ └── gp_apis.py
└── tests/
- The
src
directory contains your project's source code, and you should have an__init__.py
file inside theproject_name
folder to mark it as a Python package. - Include a
LICENSE
file to specify the licensing terms of your project. - Write your project's README in Markdown format in the
README.md
file. - Place your project's tests in the
tests
directory. - The
pyproject.toml
file contains the project metadata and configuration. - All reference to local modules need to be import using package name: ex.
import kernel as gpk
need to befrom graphpy_example_package import kernel as gpk
pyproject.toml Configuration
Here's an example of a pyproject.toml
configuration for your project:
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "graphpy_example_package"
version = "0.0.1"
authors = [
{ name = "Your Name", email = "your@email.com" },
]
description = "A small example package"
readme = "README.md"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
[project.urls]
homepage = "https://github.com/yourusername/graphpy_example_package"
bug-tracker = "https://github.com/yourusername/graphpy_example_package"
Building and Distributing
To build and distribute your package, follow these steps:
- Install the required tools:
sudo apt install python3-pip
pip3 install build
sudo apt install python3.10-venv
- Build source distribution (sdist) and/or build distribution (wheel):
python3 -m build --sdist /path/to/your/project
python3 -m build --wheel /path/to/your/project
- Install Twine for uploading:
sudo apt install twine
- Upload your distribution files to PyPI:
twine upload dist/graphpy_example_package-0.0.1.tar.gz dist/graphpy_example_package-0.0.1-py3-none-any.whl
API Token for PyPI Upload
If you encounter an API token issue during upload, create an API token on PyPI:
- Username:
__token__
- Password: Your generated token
Project details
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 graphpy_example_package-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 507a355bbf9918277c3cd6f222fb1a3134db9558ba302e328c0c7db407f2e5aa |
|
MD5 | eb5e0f95c81e445e81fcb671ea9948f5 |
|
BLAKE2b-256 | 903ec45d3eb17ff02e0e232a2726477a87be6a44152669e765dd9f1b11793718 |
Hashes for graphpy_example_package-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfee736375ee9330f5fac266eecc620bd3f910a90fb1ebf8c0bb40aaeac424b3 |
|
MD5 | 5cc89959eae3b6407eb06735756e27f8 |
|
BLAKE2b-256 | 390ce4ee1dae9278f6593d0f81847db3c76145415a64131f6fb01fcfd20f89cb |