Since we are looking to eventually publish the package on PyPi.org, I decided to start looking for a guide on publishing on the site.
Following the link, I ended up on a subdomain of python.org. This looks like the right place!
First, let's make sure that we have the latest version of Python installed.
Go to https://www.python.org/downloads/release and click on the Download Python 3.9.x. This may automatically detect the proper OS for your download.
Open the .pkg file and work through the installer. I am using a Mac so your installation process may be slightly different.
Next, after the installation is complete, open up a new terminal or command prompt.
Run the command
Python's interactive command shell should open and the latest Python version should appear in the first line.
Update & Install Needed Packages
We need to run a quick command that is important for packages that are used when building and packaging our package.
python3 -m pip install --upgrade pip setuptools wheel
Next, we need to install
pipenv is a package that let's us track the dependencies of our package. It allows use to create a virtual environment.
You can read more about
pipenv on the Managing Application Dependencies tutorial page.
pipenv, run the command
pip3 install --user pipenv.
Create Project Folder
Create a new folder for our project. I'm going to name mine
bea. I think I'm going to create a package for the Bureau of Economic Analysis API. There are a couple out there, but I'm not particularly fond of them.
Open up your text editor or IDE. I am using Visual Studio Code.
Inside the main project folder, create files with names:
Next, create two folders:
The folder structure will look like the below tree.
. ├── LICENSE ├── README.md ├── bea/ ├── setup.py └── tests/
Many of these files won't be used till later.
The final file we are going to create in this project setup is an
__init__.py file inside of the nested
. ├── LICENSE ├── README.md ├── bea │ └── __init__.py ├── setup.py └── tests
That's it for this section. We are now in a comfortable position to start developing the package.