[Draft] Development Environment for Python

Discussions about the wiki documentation of FreeCAD and its translation.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
piffpoof
Posts: 346
Joined: Sun Nov 30, 2014 11:00 am
Location: Mare Nostrum
Contact:

Re: [Draft] Development Environment for Python

Post by piffpoof »

Yes, that seems to work. Do you know if when a binary file is uploaded to be a gist, is there a limit on which file types (extensions) are accepted? What I mean is, could a standard FreeCAD document file (e.g. file.FCStd) be uploaded to become a binary gist?

thanks
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: [Draft] Development Environment for Python

Post by cox »

piffpoof wrote: could a standard FreeCAD document file (e.g. file.FCStd) be uploaded to become a binary gist?

thanks
Smal
https://gist.github.com/kkoksvik/5a0bd5 ... w/d2.fcstd

EDIT:(Test of binary version control)
Big over 4 MB Original Link tracking spesific version of file
https://gist.github.com/kkoksvik/5a0bd5 ... 20mm.fcstd

Changed approx 3.3MB Link tracking latest file
https://gist.github.com/kkoksvik/5a0bd5 ... 20mm.fcstd

There is no way, as far as I can see to add binary files via normal web interface.
Use git client on your pc to add binary files.

PS: Thanks to Juan Gonzalez Gomez https://plus.google.com/+JuanGonzalezGo ... ubEd4wLoQ4 for this nice part
Need help? Feel free to ask, but please read the guidelines first
User avatar
piffpoof
Posts: 346
Joined: Sun Nov 30, 2014 11:00 am
Location: Mare Nostrum
Contact:

Re: [Draft] Development Environment for Python

Post by piffpoof »

cox wrote: Small
https://gist.github.com/kkoksvik/5a0bd5 ... w/d2.fcstd

EDIT:(Test of binary version control)
Big over 4 MB Original Link tracking spesific version of file
https://gist.github.com/kkoksvik/5a0bd5 ... 20mm.fcstd

Changed approx 3.3MB Link tracking latest file
https://gist.github.com/kkoksvik/5a0bd5 ... 20mm.fcstd

There is no way, as far as I can see to add binary files via normal web interface.
Use git client on your pc to add binary files.
thanks for the test links to the gist files, they all worked perfectly here on v0.14 on Mac OS X using right-click 'Save File As' to download them.

Very nice drawings.
User avatar
piffpoof
Posts: 346
Joined: Sun Nov 30, 2014 11:00 am
Location: Mare Nostrum
Contact:

Re: [Draft] Development Environment for Python

Post by piffpoof »

cox wrote: There is no way, as far as I can see to add binary files via normal web interface.
Use git client on your pc to add binary files.
In git, where in the interface is the option to "add binary file"? Clicking "add file" seems to simply add another paste window on the screen.

I've created a gist for Python script at Python Assistant Window which seems to work OK, but can't figure out how to do the same with a binary file.

thanks

[edit]
I should say that I know virtually nothing about git, and what I know is on the page git for users which is supposed to be documentation for casual users of git

if I can get it figured out how to use gist for binary files then I can write it up for people to use on the Wiki pages.
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: [Draft] Development Environment for Python

Post by cox »

I am unfamiliar with mac and git Gui. But i would try to

1 clone the Github repo to your disk
2 add binary file to the local folder containing the repo. Use your filemanager(finder?)
3 Use syncronice command from Gui.

What is a paste window?
piffpoof wrote:I've created a gist for Python script at Python Assistant Window which seems to work OK
The link to your script is pointing to a spesific version of it. To link to the newest version even after a version change remove the version information witch is the long number between /raw/ and /Python Assistant Window/
  • /raw/bdc7bf37a1f81dceda3f08ff0bb6d00688506a98/Python Assistant Window
.

This way you will not need to edit web pages or documentation when changes are made to scripts or other files in git. If people need to have a look at old revisions they can do so on github.
Need help? Feel free to ask, but please read the guidelines first
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: [Draft] Development Environment for Python

Post by mario52 »

hi
piffpoof wrote:I've created a gist for Python script at Python Assistant Window which seems to work OK, but can't figure out how to do the same with a binary file.
may be because it for free formula that must be open code ??
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: [Draft] Development Environment for Python

Post by cox »

mario52 wrote:may be because it for free formula that must be open code ??
I have free acount. The limit is that you have to use your git client to be able to add binary files.

This is how I did it
EDIT(added git add -A)
In some folder test

git clone git@gist.github.com:/735fee0727a038425a11.git
cd 735fee0727a038425a11
cp /home/username/somebinaryfile.bin .
git add -A
git commit
git push

Your binary file is uploaded to the gist
Last edited by cox on Tue Mar 03, 2015 2:28 pm, edited 1 time in total.
Need help? Feel free to ask, but please read the guidelines first
User avatar
piffpoof
Posts: 346
Joined: Sun Nov 30, 2014 11:00 am
Location: Mare Nostrum
Contact:

Re: [Draft] Development Environment for Python

Post by piffpoof »

cox wrote:This is how I did it
In some folder test
git clone git@gist.github.com:/735fee0727a038425a11.git
cd 735fee0727a038425a11
cp /home/username/somebinaryfile.bin .
git commit -a
git push

Your binary file is uploaded to the gist
I had some error messages as follows:

Code: Select all

git clone git@gist.github.com:/735fee0727a038425a11.git
generated:

Code: Select all

Cloning into '735fee0727a038425a11'...
The authenticity of host 'gist.github.com (192.30.252.140)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gist.github.com,192.30.252.140' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
so I used:

Code: Select all

git clone https://gist.github.com/piffpoof/735fee0727a038425a11.git
to which I got:

Code: Select all

Cloning into '735fee0727a038425a11'...
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
Checking connectivity... done.
which at least didn't have an error message.
  • I then had FreeCAD save a file named "emptyHouse.FCstd" into the test directory which I had cloned the git repository into
  • there were then 2 files in the test directory: the Python script from earlier and the FreecAD document just saved to there
then I tried:

Code: Select all

 git commit -a
which generated:

Code: Select all

On branch master
Your branch is up-to-date with 'origin/master'.

Untracked files:
	emptyHouse.FCStd

nothing added to commit but untracked files present
which didn't look so good, but I carried on with:

Code: Select all

git push
which produced:

Code: Select all

Username for 'https://gist.github.com': piffpoof
Password for 'https://piffpoof@gist.github.com': 
Everything up-to-date
Going back to the web interface, there is no binary file. I signed out and back in and still nothing.

Probably I am missing something simple?

Perhaps someone with more extensive git experience can identify what is missing/wrong
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: [Draft] Development Environment for Python

Post by cox »

Sorry, missed a step

Try:

git add -A

git commit

git push



//Some aditional info on git add
http://stackoverflow.com/questions/5725 ... nd-git-add
Need help? Feel free to ask, but please read the guidelines first
User avatar
piffpoof
Posts: 346
Joined: Sun Nov 30, 2014 11:00 am
Location: Mare Nostrum
Contact:

Re: [Draft] Development Environment for Python

Post by piffpoof »

cox wrote: git commit
This throws me into vim to add a line describing the commit, from which I not sure how to exit, supposedly ":q" is supposed to exit but only enters those characters when I try it. I've tried control-Q and various others but the Terminal session is simply caught by vim.

The following is pre-loaded into the vim editor:

Code: Select all

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Committer: Macmini2 <macmini2@Intel-Mac-Mini.local>
#
# On branch master
# Your branch is up-to-date with 'origin/master'.
#
# Changes to be committed:
#       new file:   emptyHouse.FCStd
#
Post Reply