Package: hgdemo
PyPi, GitHub, ReadTheDocs competenciesAfter spending one week trying to get ReadTheDocs documentation formelibwithout success, I decided to start from small and start learbibg the ropes the first.  Hence, this project.In this project, I will start from a simple package with no dependencies.  Once I figure out how topypiandreadthedocsit, I will gradually make it more and more complex until I reachmelibcomplexity.  This file will document the progress.One Module, one file :hgdemo.circle.pyI checked a few 'single module' entries onGitHubto find an example to follow.I pickedrequestsas an example becauseIt is popular and reputable packageIt hasReadTheDocsdocumentationThe repository has only one module (like mymelib)Structure for theGitHubrepositoryrequests:Owner name: psfhttps://github.com/psfRepository name: requestshttps://github.com/psf/requestsRepository structure.githubI am not sure what this is for.  My guess is you need it when you have collaboration with multiple coders.docsDocumentation folder (it looks like the documentation was created using sphinx)extThis includes image files presumably all from other sourcesrequestsThis is the folder where you have the module files__init.py__.py__version__.py_internal.utils.pyadapters.py(and 14 other files withpyextsnsions)So let us create a structure forhgdemousing the repositoryrequestsas en example.$mkdir hgdemoThis folder will be thehgdemomodule.  All python files will be in this folder.$cd hgdemoCreatecircle.pymodule with two functions in the module folder (hgdemo).  These arearea(r)andperi(r).  Both functions and the module file itself have docstrings.Then create an empty file called__init__.pyin the same folder ascircle.py(the innerhgdemofolder)Finally, make adocsfolder in the root folder.  We can now start following thesphinxprocess to create local dumentation.Local Documentation usingsphinxThis is the folder structure at this point:hgdemodocs\ (empty folder)hgdemo\__init__.py(empty file)circle.py(with two functions:areaandperi)README.md(this file)In VS Code, go to thedocsfolder and enter$sphinx-quickstartEnter the questions as follows:Separate source and build directories (y/n)[n]: Pick the default ([n])Project name: hgdemoAuthor name(s): H GurgenciProject release []: June 2021Project language [en]: __sphinxthen ends with the note thatr the following files were created:Creating file H:\My Documents\git\hgdemo\docs\conf.py.
Creating file H:\My Documents\git\hgdemo\docs\index.rst.
Creating file H:\My Documents\git\hgdemo\docs\Makefile.
Creating file H:\My Documents\git\hgdemo\docs\make.bat.This is the folder structure at this point:hgdemodocs\_build\_static\_templates\conf.pyindex.rstmake.batMakefilehgdemo\__init__.py(empty file)circle.py(with two functions:areaandperi)README.md(this file)Editconf.pyPathimport os
import sys
sys.path.insert(0, os.path.abspath('..'))Extensions (I copied this from the conf file in the requests repository):extensions = [
    "sphinx.ext.autodoc",
    "sphinx.ext.intersphinx",
    "sphinx.ext.todo",
    "sphinx.ext.viewcode",
]Editindex.rstThis is theindexfile after I edit it:.. hgdemo documentation master file, created by sphinx-quickstart on Thu Jun  3 15:18:04 2021.

hgdemo documents python package creation process
================================================

A simple header
===============
The module has two files: circle.py and square.py.
I did go through the process with one file (circle) first and then repeated the process.
A log of my actions can be seen in the file README.md.

   print(hgdemo.circle(2)
   >> 12.56

Guide
^^^^^

.. toctree::
   :maxdepth: 2

   api.rst

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`Createapi.rstI create anpi.rstfile with the following contents:hgdemo API reference
========================

.. module:: hgdemo

This is a short API file demonstrating the bare essentials.

.. automodule:: hgdemo.circle
    :members:Run./make htmlThe docs/_build/html/api.html and docs/_build/html/index.html files are generated by sphinx.  All good.Remote Documentationgit initonH:\My Documents\git\hgdemoCreate.gitignorewith my standard ignore lines:*.pyctmppop.ipynb_checkpointsgit add -Agit commit -am'the first commit'log in to githubCreatehgdemoas an empty repositorygit remote add originhttps://github.com/Gurgenci/hgdemo.gitgit branch -M maingit push origin mainLog in toReadtheDocs.orgImport a repository (hgdemo)The documentation is created:http://hgdemo.readthedocs.io/Create a second module,square.The second module has two functions:area,sideand it importsnumpy.Add it to the localgitAdd the following two lines to the end ofapi.rst:.. automodule:: hgdemo.square
    :members:./make htmlAdd it to the github:git add -Agit commit -am'the secod module: square'git push origin mainRefresh theOverviewinReadtheDocsprojecthgdemoBuild Version(even when I refresh, ReadtheDocs sometimes fails to reead the new the project and the Billd fails.  I then reset and wipe and latest and start again.  This usually works.)ReadTheDocsdid not processsquare.py.  The build notes says:WARNING: autodoc: failed to import module 'square' from module 'hgdemo'; the following exception was raised:
No module named 'numpy'Unfortunately, therequestsdoes not seem to be accessingnumpy.requirements.txtI add the following file todocsfolder:numpy>=1.0This made it possible to importsquare.  But there were problems in the documentation.Renameareainsquaretosqareaand repeat./make html.This time it worked.  I also note that I had to refresh the readthedocsView Docspages to see the new changes.  Maybe this was the problem in the previous build.Register thehgdemoin PyPiCreate two files in the root folder:setup.cfg:[metadata]
  name = hgdemo
  version = 0.0.1
  author = Hal Gurgenci
  author_email = h.gurgenci@uq.edu.au
  description = For analysing strength of machine elements
  long_description = file: README.md
  long_description_content_type = text/markdown
  url = https://github.com/Gurgenci/hgdemo
  classifiers =
      Programming Language :: Python :: 3
      License :: OSI Approved :: MIT License
      Operating System :: OS Independent

  [options]
  packages = find:
  python_requires = >=3.0
  include_package_data = Truepyproject.toml:[build-system]
  requires = [
      "setuptools>=42",
      "wheel"
  ]
  build-backend = "setuptools.build_meta"