Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the structure of our Python module so that:
lib/python3.*/site-packages/jsbsim
(while currently the module is installed just below the folderlib/python3.*/site-packages/
and the data files are installed in the foldershare/JSBSim
).jsbsim
(so far they were not installed at all).*.pyi
can be installed alongside. This last topic is actually what is motivating this PR.There are a couple of design decisions that come with this PR. Below are their descriptions.
A proxy
__init__.py
now loads_jsbsim
to mimicimport jsbsim
Since the C++ module will now be located under
jsbsim
, it will no longer be possible to import it directly with the commandimport jsbsim
. That's annoying because it breaks backward compatibility. However that problem has been solved following the example of the package contourpy: the C++ module is renamed_jsbsim
and is loaded by the file__init__.py
which serves as a simple proxy. So when the commandimport jsbsim
is issued,__init__.py
is called to load_jsbsim
, read its symbols (FGFDMExec
, etc.) and return them.As a consequence, the content of
__init__.py
is trivial.The file
_jsbsim.pxd
is installedIncidentally, the file
_jsbsim.pxd
will be installed along with the package. This is due to the following constraints:_jsbsim.pxd
must be distributed with the Python source package*.tar.gz
so that JSBSim can be built bypip
on platforms for which no wheels are available.jsbsim._jsbsim
, cython and/or setuptools require that_jsbsim.pxd
also meet that structure and be located in the package i.e. injsbsim/_jsbsim.pxd
._jsbsim.pxd
will be installed by our Python wheels even though the file is no longer needed at this stage.The last topic can be addressed by programming
setup.py
to skip the installation of_jsbsim.pxd
but the file is less than 100kb so I guess we can live with it for now.The script
JSBSim
has been renamedJSBSim.py
This one breaks backward compatibility. It is requested because case insensitive OSes (Windows and MacOSX) cannot manage a script named
JSBSim
and a folder namedjsbsim
both located in the same directory.It is most likely feasible to hack
setup.py
to renameJSBSim.py
back toJSBSim
(at least during the package installation) but I have not yet investigated that option.