[x3d-public] x3d.py package: PyPi troubleshooting continues

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Mon Mar 7 21:08:53 PST 2022


Thanks John and Moritz for actual testing plus questions and ideas, very helpful.

 

Am progressing.  Have made a number of configuration efforts and some internal changes.

 

a.	Completely uninstalled and reinstalled Python 3.10.2 on primary machine and secondary machine, including scrub of user-cache directories.
b.	Building and testing local installation on primary machine, testing PyPi package installation on second machine.
c.	Completely reviewed the python packaging instructions and related pages, line by line.
d.	Replaced/refactored setup.py to avoid deprecation warning, same information now appearing as setup.cfg and pyproject.toml.
e.	Instrumented the pypi-packaged  __init__.py  to successively test different import statements and report which incantation works.
f.	Started using fourth-digit version variations for testing minor changes to pypi.  Latest is x3d 4.0.62.6
g.	Updated details about workaround on home page.
h.	Added a file-length check when building to check prior to deployment and ensure that the full x3d.py was getting included in .tar.gz deliverables.
i.	Added direct download link for latest x3d.py on pypi page.
j.	Created dependency for xmlschema package so that XML validation is automatically supported.
k.	Responding to your questions: the entire build process is automated, uploads to pypi are via twine (with upload progress bar visible) , outputs are logged in version control, and everything is committed/inspectable.

 

*	https://pypi.org/project/x3d
*	https://www.web3d.org/x3d/stylesheets/python/python.html
*	https://www.web3d.org/x3d/stylesheets/python/x3d.py
*	https://sourceforge.net/p/x3d/tickets/19
*	https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/python

 

My current test arrangement is much more predictable/reliable.  Made some small improvements to package itself (e.g. exception handling for XML validation when network is down or host certificate is mismatched).  Only a single package is created, x3d.py with no subpackages.

 

Status:

l.	Regular install of x3d.py requires regular setup in source,       i.e. from x3d     import *
m.	PyPi installation of x3d.py requires double-prefix in source, i.e. from x3d.x3d import *

 

And so, getting pretty close… I suspect the missing fix will be going in setup.cfg file, but not sure what it is yet.  Have poked the following excerpted lines below, but it is still not cooperating.  All testing and insights remain welcome.

 

*	https://packaging.python.org/en/latest/tutorials/packaging-projects (Windows tabs)
*	https://docs.python.org/3/tutorial/modules.html#packages 
*	https://docs.python.org/3/tutorial/modules.html#importing-from-a-package

 

*	https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/python/setup.cfg
*	https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/python/build.package.prepare.log.txt

 

# setup.cfg

 

[options]

package_dir =

    = src

include_package_data = True

packages = find:

install_requires = xmlschema

python_requires = >=3.6

 

[options.packages.find]

where = src

 

 

all the best, Don

-- 

Don Brutzman  Naval Postgraduate School, Code USW/Br        brutzman at nps.edu

Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149

X3D graphics, virtual worlds, Navy robotics https:// faculty.nps.edu/brutzman

 

From: Hans Moritz Guenther <hgunther at mit.edu> 
Sent: Sunday, March 6, 2022 4:08 AM
To: Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>; vmarchetti at kshell.com; X3D-Public <x3d-public at web3d.org>
Cc: John Carlson <yottzumm at gmail.com>; Peitso, Loren (CIV) <lepeitso at nps.edu>
Subject: Re: [x3d-public] x3d.py package: Some feedback and suggestion for improvement; tuples and lists; updated x3d.py

 

On 3/5/22 9:08 PM, Brutzman, Donald (Don) (CIV) wrote:

Thanks Moritz for looking at this.  However, we can’t really expect any PyPi user who types “pip install x3d” to go through such a process.

A Pypi user does not have to go through that - unless their local installation is messed up in some way; I was just trying to debug. Plenty of Pypi packages work just like that.

 

However, right now the problem seems to be different:

Something changed in the Pypi setup for this package between 4.0.57 and 4.0.58: From 4.0.58 on, "pip install" only downloads and installs the metadata of the package (license file etc.), but not the actual code. Note in the following output how an installation with 4.0.57 gives me two directories in my "site-packages" called "x3d" (with the code) and "x3d-4.0.57-py3-none-any.whl" (with the meta data of the package).

However, starting with 4.0.58, I ONLY get the metadata and not the actual code - and thus an "import x3d" must fail just because the code is not actually installed. It also no longer downloads the actual ~400 kB wheel:


(kitchensink) MoritzAirRoseGold ~/mambaforge/envs/kitchensink/lib/python3.10> pip install x3d==4.0.56
Collecting x3d==4.0.56
  Downloading x3d-4.0.56-py3-none-any.whl (418 kB)
     |████████████████████████████████| 418 kB 2.3 MB/s            
Installing collected packages: x3d
  Attempting uninstall: x3d
    Found existing installation: x3d 4.0.52
    Uninstalling x3d-4.0.52:
      Successfully uninstalled x3d-4.0.52
Successfully installed x3d-4.0.56
(kitchensink) MoritzAirRoseGold ~/mambaforge/envs/kitchensink/lib/python3.10> ls site-packages/x3*   
site-packages/x3d:
__init__.py __pycache__ x3d.py

site-packages/x3d-4.0.56.dist-info:
INSTALLER     LICENSE       METADATA      RECORD        REQUESTED     WHEEL         license.html  license.txt   top_level.txt
(kitchensink) MoritzAirRoseGold ~/mambaforge/envs/kitchensink/lib/python3.10> pip install x3d==4.0.57
Collecting x3d==4.0.57
  Downloading x3d-4.0.57-py3-none-any.whl (16 kB)
Installing collected packages: x3d
  Attempting uninstall: x3d
    Found existing installation: x3d 4.0.56
    Uninstalling x3d-4.0.56:
      Successfully uninstalled x3d-4.0.56
Successfully installed x3d-4.0.57
(kitchensink) MoritzAirRoseGold ~/mambaforge/envs/kitchensink/lib/python3.10> ls site-packages/x3*   
INSTALLER     LICENSE       METADATA      RECORD        REQUESTED     WHEEL         license.html  license.txt   top_level.txt

 

 

How do you upload the package to Pypi? By hand? Do you use some uploader script or do it by hand?

If you follow for example https://packaging.python.org/en/latest/tutorials/packaging-projects/ <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpackaging.python.org%2Fen%2Flatest%2Ftutorials%2Fpackaging-projects%2F&data=04%7C01%7Cbrutzman%40nps.edu%7C71204b50571049885f4d08d9ff69ef47%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637821652758101749%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=atx%2FZE0pZA5RSJGmWCkcPGdY1thic5PpQLQqdqmABGM%3D&reserved=0>  : 

- When you do "python -m build" in your local directory, do you see the actual code file (the .tar.gz file) or only the wheel metadata (the whl file)?

- When you upload (python3 -m twine upload ....) do you see uploading of both file?

[Of course, if you use a different method or uploader to make the wheels and update to Pypi, then the commands and output will be different.]

Moritz

 

-- 
Hans Moritz Günther
Massachusetts Institute of Technology
Kavli Institute for Astrophysics and Space Research
77 Massachusetts Avenue
NE83-569
Cambridge, MA 02139
hgunther at mit.edu <mailto:hgunther at mit.edu> 
https://space.mit.edu/home/guenther/ <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fspace.mit.edu%2Fhome%2Fguenther%2F&data=04%7C01%7Cbrutzman%40nps.edu%7C71204b50571049885f4d08d9ff69ef47%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637821652758101749%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=bo7wTcimNGdJaXgo%2FK1%2B4ideJFqpvZp7qh96xyS%2BaKs%3D&reserved=0> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220308/b4e59af4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5353 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220308/b4e59af4/attachment-0001.p7s>


More information about the x3d-public mailing list