dlmidpack 1.0.1
A simple Python package
Requires Python: >=3.6

Felt cute, will definitely delete later
MIT License

Copyright (c) [2026] [PingusTheTingus]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Don't forget to replace [year] with the current year and [full name] with your name or the names of the copyright holders.
Generate the distribution archives

One more step left to get our package ready for distribution: generating the distribution archives for our Python package. To do so, first we need to update our PyPA's build and then generate the source and built archives.

In the terminal/cmd, run the following commands from the same directory where the pyproject.toml file is located:

For Linux:

python3 -m pip install --upgrade build
python3 -m build

For Windows:

py -m pip install --upgrade build
py -m build

Once the process above is completed, a new directory is generated called dist/ with two files in it. The .tag.tz file is the source archive and the .whl* file is the built archive. These files represent the distribution archives of our Python package which will be uploaded to the Python Package Index and installed by pip in the following sections.
How to upload a package in Python

Python Package Index is where we should upload our project. Since our Python package is in test and we might add other functionalities to experiment with it, we should use a separate instance of PyPI called TestPyPI. This instance is specifically implemented for testing and experimentation. Then, once your package is ready and meets your expectations, you can upload it to PyPI as a real package.

Let's follow the instructions below to get our TestPyPI ready to upload our package:

    Go to TestPyPI and create an account.
    Verify your email address so you can upload packages.
    Update your profile settings (add your picture and so on).
    Go to api-tokens and create your API token to securely upload your packages.
    On the same page, set the scope to "entire account".
    Copy and save your token in a safe place on your disk.

Next, we need to upload our distribution archives. To do so, we have to use an upload tool to upload our package. The official PyPI upload tool is twine, so let's install twine and upload our distribution archives under the dist/ directory.

In the terminal/cmd, run the following commands from the same directory where the pyproject.toml file is located:

For Linux:

python3 -m pip install --upgrade twine
python3 -m twine upload --repository testpypi dist/*

For Windows:

py -m pip install --upgrade twine
py -m twine upload --repository testpypi dist/*

Then, enter __token__. as username, and the token (pypi- prefix included) you saved as a password. Press Enter to upload the distributions.
How to install the uploaded Python package

Now, it's time to install our package. You can create a new virtual environment and use pip to install it from TestPyPI:

For Linux:

python3 -m venv env
source env/bin/activate
(env) python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps basicpkg

For Windows:

py -m venv env
.\env\Scripts\activate
(env) py -m pip install --index-url https://test.pypi.org/simple/ --no-deps basicpkg

Make sure your virtual environment is activated before you verify if our package works properly.

In the terminal/command, run python3 for Linux users or run py for Windows users. Then, type the following code to make sure that the multiply and divide packages work as expected:

from multiply.by_three import multiply_by_three
from divide.by_three import divide_by_three

multiply_by_three(9)
divide_by_three(21)

# Output: 27
# Output: 7

Remember that we need to import the methods from our modules that we need to perform the desired operations, as we did above.

Hooray! Our package works as expected.

So, once you test and experiment with your package, follow the instructions below to upload your package to the real PyPI:

    Go to PyPI and create an account.
    Run twine upload dist/* in the terminal/command line.
    Enter the account credentials you registered for on the actual PyPI.
    Then, run pip install [package_name] to install your package.

Congratulations! Your package was installed from the real PyPI.
What's next?

It would be great if you come up with a simple idea and build with it your first real Python package. In this blog post, I focused only on the basics you need to get started, but there is a lot to learn in the world of packaging.

Hopefully, my first experience with developing Python packages helps you learn what you need to get building. If you have any questions, feel free to connect and hit me up at any time on LinkedIn. Also, you can subscribe to my channel on YouTube where I share videos on what I'm learning and building with code.

See you in the next post and keep moving forward!
References

Here are some references that helped me develop my first Python package:

    Packaging Python Projects
    Configuring metadata
    PEP 621 – Storing project metadata in pyproject.toml
    Glossary - Python Packaging User Guide