-
Notifications
You must be signed in to change notification settings - Fork 511
Python Wrapper of the Solver (Some questions about the solver and *.slvs format) #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For the record, soon it could be used for implement SolveSpace solver in Blender 2.7x or later |
@KmolYuan The "solver" branch exists because of copyright reasons, not for technical ones. If you are aiming for integrating your Python bindings, that should be done in the "master" branch, where active development happens. Are you fine with that? |
Sure! If it can be integrated into the CMake build process it would be better. By the way, the file file.cpp is using information from SK (Sketch class) of SolveSpaceUI class, It seems to be unrelated to solver parts. Is possible to separate SK and UI parts, or just using SolveSpaceUI directly to write a *.slvs format? |
OK. I will ask you to sign a CLA very soon and then I will be able to integrate your code. I will handle CMake and basic testing for you. Right now the solver that is exposed via the external interface can only solve for one group, and files have many. So, the exposed solver cannot interact with files. I'm not sure what's the best way to fix this, I've not really considered the binding evolution much. |
For the file format section, maybe there should be a new external interface with the internal data format. Because I want to put the results of the external design process into Solvespace. There would be used as auto-assemble function. |
Unfortunately the way code is currently structured, the internal C++ interface does not check many invariants, so actually exposing it as-is in Python would cause a hard to debug crash in case of misuse. Of course we want to fix that but it is by no means quick. The UI is not scriptable either. |
Thank you for your contribution, and welcome. The SolveSpace project has a Contributor License Agreement; in order for me to be able to merge your changes, please sign it at https://cla-assistant.io/solvespace/solvespace. It will take only a small amount of your time. |
@KmolYuan Are you still interested in integrating this? |
Python-Solvespace project has been updated a new wrapper mechanism to Cython instead of SWIG at April 2019. The old SWIG wrapper is terminated at KmolYuan/python-solvespace@24cfed4. They are not existed in the current version. Wrapper source code:
Compile settings:
For development:
The makefile is just used to call " To merge them, there must be some work here:
Directory is as follows: /solvespace
/cython
/python_solvespace
__init__.py
slvs.pyi
slvs.pxd
slvs.pyx
/platform
patch.diff
/tests
__init__.py
test_slvs.py
setup.py
... |
Looks reasonable. |
There are two different ways to add this solver wrapper. Let solvespace as submodule in python-solvespace; or integrate the wrapper into the branch (or maybe new branch) of solvespace, then python-solvespace might be deprecated. I think the former will be more convenience to publish the wrapper to PyPI with CI service. The submodule can follow If the latter one, the wrapper packages still can released at a forked repository. @whitequark Which way does this community prefer? |
So, there's one thing to discuss first. SolveSpace uses the GPLv3+ license and has a CLA. Are you willing to relicense the wrapper as GPLv3+ and sign the CLA? If no, the bindings unfortunately have to be separate. If yes, then I propose putting the bindings in the same repository, so that they will always be tested with the most recent SolveSpace version, and distributed together. |
OK, I will change the license of python-solvespace to GPLv3+. I will fork this repository and do it at python branch as above plan. |
The PyPI releases require user account and password from CI serves. In common way, the user name and password are stored in Travis CI (Ubuntu): matrix:
include:
- os: linux
sudo: required
python: "3.6"
dist: xenial
deploy: &deploy-options
provider: pypi
user: $TWINE_USERNAME
password: $TWINE_PASSWORD
skip_cleanup: true
skip_existing: true
on:
tags: true
- os: linux
sudo: required
python: "3.7"
dist: xenial
deploy:
<<: *deploy-options Travis CI (Mac OS): after_success:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
if [ -n "$TRAVIS_TAG" ]; then
python3 -m pip install twine --user;
python3 setup.py sdist bdist_wheel;
python3 -m twine upload dist/*.whl --skip-existing;
fi
fi AppVeyor (Windows): artifacts:
- path: dist\*.whl
deploy_script:
- IF "%APPVEYOR_REPO_TAG%"=="true" (pip install twine)
ELSE (echo deployment has been skipped as environment variable has not matched)
- IF "%APPVEYOR_REPO_TAG%"=="true" (twine upload dist\*.whl --skip-existing) Here are some things to do:
|
@KmolYuan Thanks for preparing this. I'll look into it closer shortly. |
Hello! I have published the wrapper named as pip install python-solvespace The CI / CD configurations are modified with "matrix" mechanism (Travis / AppVeyor). And I keep the old deployments on I hope you guys can check them out if I do something wrong. Then I will open a pull request. The distributions are supported with Windows ( The package version |
Awesome! But check "Project description" on PyPI website - seems like its markup is broken! (does PyPI support Markdown markup?) |
@Symbian9 Oh, that's an upstream issue that PyPI can't update description unless release a new version. Maybe I can publish |
Oh! I made a big mistake with Linux sources. The upper directories and files needs to move into OK, I solved it by copy https://github.com/KmolYuan/solvespace/blob/python/cython/setup.py#L99-L112 |
I am sorry but it's not clear. @KmolYuan, will you sign the CLA and merge the wrapper? |
Hi @KmolYuan have you noticed that one more person seems to have started/done a Python wrapper here? |
@ruevs Well, that wrapper is made by SWIG, which needs to write an interface file and compile it together. My early attempts did the same. The tricky thing is Cython sources can not compile directly with CMake. Maybe something like scikit-build? |
In order to support assembly, the Some other useful patches, which may or may not be relevant any more,
|
@realthunder I think those changes your pointed out would be really good to have in SolveSpace! Has anyone ever considered making a (C++) Class that contains the solver only? |
@vespakoen I don't think I have time for making a PR here. You are of course welcome to use my code. |
Awesome News for Blender users!Thanks to @hlorus, now there is "Geometry Sketcher" add-on for Blender
N.B. This add-on implementation finally closes (partially) my old request to @KmolYuan: |
Hello. I made a Python 3 wrapper for the solver,
This project is using newest source code and compile without CMake. It can made
slvs.h
be import then used simply in a Python script (shown as PyDemo).If allowed, I would like to add it to the "solver" branch.
On the other hand, I want external programs can read and write *.slvs format, with fully Link / Assemble support, then solvespace files can be generated from C or Python.
Best regard.
The text was updated successfully, but these errors were encountered: