A small reusable Python utilities package
Project description
🚀 Full Guide: Publish a Python Package to PyPI
1. Setup Your Project Structure
mlopspypi/
├── mlopspypi/ # Main package code
│ ├── __init__.py
│ └── main.py
├── tests/ # (Optional) tests
│ └── test_main.py
├── pyproject.toml # Build configuration (like package.json)
├── README.md # Long description
├── LICENSE # License (MIT recommended for open source)
└── .gitignore
2. Write Your Code
Inside mlopspypi/main.py:
def hello(name: str) -> str:
return f"Hello, {name}!"
Inside mlopspypi/init.py:
from .main import hello
Now anyone installing can use:
from mlopspypi import hello
print(hello("World"))
3. Add pyproject.toml
This tells PyPI how to build your package. Use Hatchling (modern tool).
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "mlopspypi" # must be unique on PyPI
version = "0.1.0"
description = "A small reusable Python utilities package"
readme = "README.md"
requires-python = ">=3.8"
license = { text = "MIT" }
authors = [
{ name="Your Name", email="you@example.com" }
]
keywords = ["utility", "example", "reusable"]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = [
# "requests>=2.0.0", # example dependency
]
[project.urls]
"Homepage" = "https://github.com/kimhabkhun/mlopspypi"
"Bug Tracker" = "https://github.com/kimhabkhun/mlopspypi/issues"
[tool.hatch.build.targets.wheel]
packages = ["mlopspypi"]
⚠️ Important: The folder name (mlopspypi/) must match the packages = [...].
4. Build Your Package
First install build tools:
pip install build twine
python -m build
You’ll get:
dist/
mlopspypi-0.1.0.tar.gz
mlopspypi-0.1.0-py3-none-any.whl
5. Upload to PyPI
Create an account: https://pypi.org/account/register/ Config in .pypirc
username: __token__
password: pypi-AgEIcHlwaS5vcmcCJDJXXXXXXXXXXXXXXXXXXXXXXXX
Run this to upload and fill the API Token if require (passsword= API Token)
python -m twine upload dist/*
or if not use .pypirc run command:
python -m twine upload -u __token__ -p pypi-AgEIcHlwaS5vcmcCJDJXXXXXXXXXXXXXXXXXXXXXXXX dist/*
*** remember every publish must change version ***
6. Installation & Usage
A simple Python utilities package.
Installation
pip install mlopspypi
Usage
from mlopspypi import hello
print(hello("World"))
7. 🛠 Development
git clone https://github.com/kimhabkhun/mlopspypi.git
cd mlopspypi
pip install -e .
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlopspypi-0.1.1.tar.gz.
File metadata
- Download URL: mlopspypi-0.1.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d680b7101a292b0956a13500240081fcdc3cc96456922c8282dda93a070d1d1e
|
|
| MD5 |
6e068d3c63b29cef0600278abcdd2003
|
|
| BLAKE2b-256 |
a6e4d58a0d3286f5a678f7393cf1bb4746dbb91eb115a79c2e3bc3cca9830016
|
File details
Details for the file mlopspypi-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mlopspypi-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9adb79ce9464e3dee402fe25477d73d2c4e2478c1a14f6090c7ce472d342338d
|
|
| MD5 |
65a21346c953072e42c2f0ab3538c1a9
|
|
| BLAKE2b-256 |
8686419dd724eb9efc6ce7d050a086ab950b8f64754935ec6e993b516835ee4a
|