That sounds about right. You can do a rebuild after making the changes and then run with your modified build. You may want to add a unit test to the test suite to make sure that your changed code does what it is intended to do, and/or write a test script to test the feature or bug fix in context, and then run it against the modified Panda build.
Then, once everything is working well, you can commit to a branch, push it to your fork, and open a pull request. If you’re not sure yet about the approach, you can open a “draft” pull request and get early feedback on your changes.
A tip: don’t build with --installer; instead, set the PYTHONPATH variable in the command-line to point to the built folder, and run the compiled build straight away from that. That saves a lot of time.
I will probably need guidance for making sure I write the unit test scripts in a sensible way. I assume I should write a separate script in the appropriate folder (panda3d/tests/) that uses python to test whatever I changed.
I will definitely do the draft pulls until I (and everyone else) is comfortable with changes.
Just to make sure I am understanding your last comment. When I am testing a build and calling a python script, I do it like this:
Thanks for the comment serega, So what I do is use an explicit path to python and then an explicit path to my test script to make sure the code is doing what I want. A replication of your command for me on a Mac (basically a unix system) it would be:
So now we come to the question of commits into panda3d. What is the standard op. procedure for the panda3d community? I have forked the repository, made panda3d/panda3d.git the upstream repository and have a local copy and made my changes. These have then been committed to the upstream repo. With other groups I have worked with, I have seen two workflows:
Everyone on the master branch and does pull requests to the master branch. Releases are then created as new branches
Every new feature/issue that is worked on, is created as a separate branch and the pull request is sent from that branch. After it is accepted, it is committed to the master branch.
I don’t think these points are mutually exclusive?
The master branch is the main branch of development. When someone wants to make a feature, they create a branch, add changes to that branch, then open up a pull request against the master branch. Once the change is accepted, it is merged into the master branch.
The release branches are spawned off from the master branch by the release maintainer.
Thanks. That tells me what I need to know.
I am probably going to need help setting up a test for these changes. Here is as far as I have gotten. I successfully installed pytest and then set my the env variable PYTHONPATH to point to my built directory. (/Users/paustian/Documents/ComputingProjects/panda3d/built). Just to see if everything is working before I create a test, I tried to run the tests in the test folder. I cd to the panda3d folder and then did this command:
../python3/bin/pytest
I then get these errors
================================================= test session starts =================================================
platform darwin -- Python 3.8.2, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
rootdir: /Users/paustian/Documents/ComputingProjects/panda3d, configfile: setup.cfg, testpaths: tests
collected 0 items / 1 error
======================================================= ERRORS ========================================================
____________________________________________ ERROR collecting test session ____________________________________________
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
???
<frozen importlib._bootstrap>:991: in _find_and_load
???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:671: in _load_unlocked
???
../python3/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:171: in exec_module
exec(co, module.__dict__)
tests/audio/conftest.py:2: in <module>
from panda3d.core import *
E ModuleNotFoundError: No module named 'panda3d.core'
=============================================== short test summary info ===============================================
ERROR - ModuleNotFoundError: No module named 'panda3d.core'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================== 1 error in 0.12s ===================================================
Again, thanks for all your help. I feel like I am making progress.
A copy of Python from your operating system may be running. I do not know how this is organized in Unix systems, but you need exactly the Python that participated in the Panda build.
An incompatible version of Python is used to run it compared to the one that built it, in which case the solution is to run makepanda using the version of Python you want to run Panda with (no clean rebuild needed)
You actually built Panda without Python support (look for a warning message in the build about that),
Or the PYTHONPATH setting was not done correctly.
If you want to run Panda inside a venv, you could also add --wheel to the makepanda flags and pip install the resulting whl into the venv, though it sounds tedious to do so repeatedly after every rebuild.
If you do want to force a clean rebuild, deleting the “built” folder is all you should need to do.
I apologize for being such a noobie on this, but I am back to square one. You are right that I built Panda3D without python support. So, I am trying to get this command to run:
I immediately get this warning:
Could not locate Python installation at /Library/Frameworks/Python.framework/Versions/3.8
On Big Sur there is no Python.framework, nor a symlink to such a framework. I saw some similar threads on this, but didn’t see any clear answer on how to fix this.
That did it. I thought I had installed the latest python build, but that must have been before I had moved over to Big Sur. It’s compiling now, and doing the python compiles. Hopefully, this will be the last install issue and I can get to work. Thanks for your help and your patience.