Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ramosm/git-zenodo-assistant
  • ramosd/git-zenodo-assistant
  • vignattij/git-zenodo-assistant
3 results
Show changes
Commits on Source (9)
......@@ -9,17 +9,17 @@ def git_review():
message0 = """
Git is more than a website, Git is a control version software, which is
a software made for tracking changes in any set of files in a directory.
Managing changes of your documents, data, notebooks and coding scripts is
essential when you do research.\n
As you probably have learned by now, just copying your files and renaming
them as "myProjectUpdateFinalTrueFinalPrint.ipynb" is not the most
efficient way to do so. Git makes it easier by providing an online
Managing changes of your documents, data, notebooks and coding
scripts is essential when you do research.\n
As you probably have learned by now, just copying your files and
renaming them as "myProjectUpdateFinalTrueFinalPrint.ipynb" is not the
most efficient way to do so. Git makes it easier by providing an online
plataform for Version Control of personal and collaborative projects.
"""
message1 = """
The Git software stores and save files to a directory called repository,
also shorten as repo. A Git repository allows various operations to create
also shorten as repo. A Git repository allows various operations to create
different versions of the files in it.\n
A Git repository can be local (placed in your computer) or remote
(hosted on the Internet, or in a different server).\n
......@@ -34,7 +34,7 @@ def git_review():
Maybe you knew all of this already. In fact, you probably have this program
running because you did a git clone to your computer (or Virtual Machine,
for that matter).\n
One more thing before you continue: remember than you can only push to git
One more thing before you continue: remember than you can only push to git
repositories where you have permissions to do so. If you need to clone a
repo that you do not own and need to make changes, fork the repo first and
then you can clone it.
......@@ -42,10 +42,10 @@ def git_review():
message3 = """
You can obtain a Git repository by either cloning a Git repository
or by converting a local directory to a Git repository, using git init.\n
or by converting a local directory to a Git repository, using git init. \n
It does not matter if the directory is a new local directory, or an
already existent local directory, the command git init works in both
cases.\n
already existent local directory, the command git init works in
both cases.\n
And you can also git init a git repository, is it safe to do so,
it will not overwrite files that are already there.
"""
......@@ -63,10 +63,20 @@ def git_review():
steps. You can learn more in the documentation and you should.
"""
message5 = """
While Git push allows you to publish local commits on a remote server, the
git pull command lets you update the local version with the new commits
saved on the remote server. It is the most common way to update a repository
and you should use it everytime that you interact with the remote server.\n
Note that this tutorial does not include how to git pull although it is being
considered for future versions. If you need to git pull, we recommend to
consult the documentation available in the repository and the program.
"""
# Creating window
root = tk.Tk()
root.title("Review of Git")
root.geometry("250x200")
root.geometry("250x280")
root.config(background = "#F5F5F5")
root.eval('tk::PlaceWindow . center')
label = tk.Label(root, text ="Select an option and\n review some concepts")
......@@ -78,7 +88,7 @@ def git_review():
window_0 = tk.Toplevel(root)
window_0.title("Git and Version Control")
window_0.geometry("530x200")
window_0.geometry("510x250")
window_0.config(background = "#F5F5F5")
# Texts
title = tk.Label(window_0, text ="\n\nWhat is Git?", bg= "#F5F5F5").pack()
......@@ -90,7 +100,7 @@ def git_review():
window_1 = tk.Toplevel(root)
window_1.title("Git Repository")
window_1.geometry("540x200")
window_1.geometry("500x280")
window_1.config(background = "#F5F5F5")
title = tk.Label(window_1, text ="\n\nWhat is a Git repository?", bg= "#F5F5F5").pack()
text = tk.Label(window_1, text = message1, bg= "#F5F5F5", anchor="e", justify="left", width=100).pack()
......@@ -101,7 +111,7 @@ def git_review():
window_2 = tk.Toplevel(root)
window_2.title("git fork/git clone")
window_2.geometry("550x250")
window_2.geometry("525x350")
window_2.config(background = "#F5F5F5")
title = tk.Label(window_2, text ="\n\nWhat does a git fork/git clone do?", bg= "#F5F5F5").pack()
text = tk.Label(window_2, text =message2, bg= "#F5F5F5", anchor="e", justify="left", width=100).pack()
......@@ -110,7 +120,7 @@ def git_review():
window_3 = tk.Toplevel(root)
window_3.title("git init")
window_3.geometry("510x200")
window_3.geometry("460x260")
window_3.config(background = "#F5F5F5")
title = tk.Label(window_3, text ="\n\nWhat does a git init do?", bg= "#F5F5F5").pack()
text = tk.Label(window_3, text =message3, bg= "#F5F5F5", anchor="e", justify="left", width=100).pack()
......@@ -120,11 +130,21 @@ def git_review():
window_4 = tk.Toplevel(root)
window_4.title("git add/git commit/git push")
window_4.geometry("560x230")
window_4.geometry("510x320")
window_4.config(background = "#F5F5F5")
title = tk.Label(window_4, text ="\n\nGit push and the previous steps", bg= "#F5F5F5").pack()
text = tk.Label(window_4, text =message4, bg= "#F5F5F5", anchor="e", justify="left", width=100).pack()
return
def open_window_5():
window_5 = tk.Toplevel(root)
window_5.title("git pull")
window_5.geometry("530x250")
window_5.config(background = "#F5F5F5")
title = tk.Label(window_5, text ="\n\nWhat does a git pull do?", bg= "#F5F5F5").pack()
text = tk.Label(window_5, text =message5, bg= "#F5F5F5", anchor="e", justify="left", width=100).pack()
return
# Buttons that open windows and destroy the root window.
......@@ -142,6 +162,9 @@ def git_review():
button_4 = tk.Button(root, text= "git add/git commit/git push", bg="#B0E0E6", command=open_window_4)
button_4.pack(side="top")
button_5 = tk.Button(root, text= "git pull", bg="#B0E0E6", command=open_window_5)
button_5.pack(side="top")
button_done = tk.Button(root, text = "Done", bg="#FF6347", command=root.destroy)
button_done.pack(side="bottom")
......
......@@ -26,6 +26,8 @@ password = colored('password', 'cyan')
token = colored('token', 'cyan')
gitlab = colored('GitLab', 'cyan')
github = colored('GitHub', 'cyan')
green = colored('Green', 'green')
red = colored('Red', 'red')
copy = colored("COPY", "green", attrs=['reverse'])
paste = colored("PASTE", "green", attrs=['reverse'])
......@@ -54,6 +56,7 @@ familiarized with {git}. If you are not, do not worry. We have created
a review of some important concepts, in case you need it.
"""
# Git review
print(more_message)
input(f"Press {enter} to see the review. Click {done} when you finish.")
git_review()
......@@ -116,7 +119,7 @@ A {git} remote origin is the name for the remote repository of a {git}
directory. If you try to execute {git} commands in the wrong remote
repository, you will encounter errors. To make sure this do not
happen while running the tutorial, we are going to remove the previous
origin.
origin just in case.
"""
print(rm_message)
......@@ -131,7 +134,7 @@ os.system("clear")
origin_message = f"""
Now, let's add a new origin. You will need to provide the url of the
{git} repo where you want to you {git} {push}.
{git} repo where you want to {git} {push}.
"""
print(origin_message)
......@@ -168,8 +171,8 @@ os.system("clear")
# Git status
status_message = f"""
{git} status shows the current state of your {git} working directory
and staging area. Green shows file in {git} repository, committed
with latest changes. Red shows file in {git} repository, but with
and staging area. {green} shows file in {git} repository, committed
with latest changes. {red} shows file in {git} repository, but with
latest changes that have not been committed. If you do not {add} the
red files before committing, these files will not be included in
your {commit}.
......@@ -184,10 +187,10 @@ input(f"\nDone! Press {enter} to continue.\n")
# Git add
add_message =f"""
To {git} {add}, you have to pick a file in red from the list
above and copy the name. Then, paste the name of your file
and do not forget the extension (example.ipynb).
or type {allfiles} to add all the files in the directory.
To {git} {add}, you have to pick a file in {red} from the
status list above and copy the name. Then, paste the name
of your file and do not forget the extension (example.ipynb),
or type {allfiles} to {add} all the files in the directory.
"""
print(add_message)
file = input(str(f"Please paste the name of your file or type {allfiles}: "))
......@@ -215,11 +218,11 @@ os.system("clear")
# Git commit
print(f"\nNow, you have to {commit}, to save these changes. To identify the {commit}, you can write a {commit} message")
commit = input(str(f"Type a {commit} message. Make it one word: "))
cprint("command6: git commit -m", "green")
comment = input(f"Type a {commit} message. Make it short and simple: ")
cprint(f"command6: git commit -m {comment}", "green")
input(f"\nPress {enter} to execute the command...\n")
time.sleep(2)
os.system(f"git commit -m {commit}")
os.system('git commit -m " '+str(comment)+'"')
input(f"\nDone! Press {enter} to continue.\n")
# Git log
......@@ -258,7 +261,8 @@ os.system(f"git push {url}")
input(f"\nDone! Press {enter} to continue.\n")
# Check the git push
print(f"Go to:\n{url}\nto see if the {push} was successful.")
print(f"Go to:\n{url}\nto see if the {push} was successful.\n"
f"Check out the master branch if you do not see the file in the main branch.")
push_answer = input(str("Has your file been pushed correctly? y/n: "))
while push_answer =="n":
......@@ -279,4 +283,4 @@ while push_answer =="n":
# End of tutorial
if push_answer == "y":
print("\nAlright! You have reached the end of this tutorial.\n")
input("\nPress {enter} to continue.\n")
\ No newline at end of file
input("\nPress {enter} to continue.\n")
images_tutorial/git_review.png

142 KiB

images_tutorial/zenodo_review.png

143 KiB

# Git&Zenodo Assistant
## Git
Here, you can read the information available in the Git&Zenodo Assistant review about Git. It also includes the Git comands used in the program. At the end, you will find the respective documentation if you want to know more.
<CENTER>
<h2> Git&Zenodo Assistant: review about Git </h2>
<img src="images_tutorial/git_review.png">
</CENTER>
### What is Git?
* * *
Git is more than a website, Git is a control version software, which is a software made for tracking changes in any set of files in a directory.
Managing changes of your documents, data, notebooks and coding scripts is essential when you do research. As you probably have learned by now, just copying your files and renaming them as "myProjectUpdateFinalTrueFinalPrint.ipynb" is not the most efficient way to do so. Git makes it easier by providing an online plataform for Version Control of personal and collaborative projects.
### What is a Git repository?
* * *
The Git software stores and save files to a directory called repository, also shorten as repo. A Git repository allows various operations to create different versions of the files in it.
A Git repository can be local (placed in your computer) or remote (hosted on the Internet, or in a different server).
By installing git to your computer, and creating a GitHub or GitLab account you can start your Version Control with git.
### What does a git fork/git clone do?
* * *
From Github or Gitlab you can Fork and Clone repositories.
A git fork is an operation of copying a repository to your git account.
A git clone is an operation of copying a repository to your local machine.
Maybe you knew all of this already. In fact, you probably have this program running because you did a git clone to your computer (or Virtual Machine, for that matter).
One more thing before you continue: remember than you can only push to git repositories where you have permissions to do so. If you need to clone a repo that you do not own and need to make changes, fork the repo first and then you can clone it.
### What does a git init do?
* * *
You can obtain a Git repository by either cloning a Git repository or by converting a local directory to a Git repository, using git init.
It does not matter if the directory is a new local directory, or an already existent local directory, the command git init works in both cases.
And you can also git init a git repository, is it safe to do so, it will not overwrite files that are already there.
### Git push and the previous steps.
* * *
Git push is an operation to publish new local commits on a remote server.
When you want to update your changes (could be a new file in the directory, or a change in an already existing file) to your Git account, you need to git push.
But before a git push, you have to git add (to add your new or modified files to your git repo), git commit (to save these changes) and then you an execute your git push command.
There could be more commands that you need to execute before a git push.
This is only a basic review, and although the tutorial will include some new steps. You can learn more in the documentation and you should.
### Git pull
* * *
While Git push allows you to publish local commits on a remote server, the git pull command lets you update the local version with the new commits saved on the remote server. It is the most common way to update a repository and you should use it after everytime that you interact with the remote server.
Note that this tutorial does not include how to git pull although it is being considered for future versions. If you need to git pull, we recommend to consult the documentation available in the repository and the program.
## Documentation
[1] [GitHub: Home Page](https://github.com/)
[2] [GitLab: About GitLab](https://about.gitlab.com/)
[3] [Install Git](https://github.com/git-guides/install-git)
[4] [GitHub documentation](https://docs.github.com/en)
[5] [GitHub community documentation](https://git-scm.com/site)
# Git&Zenodo Assistant
## Zenodo
Here, you can read the information available in the Git&Zenodo Assistant review about Zenodo. At the end, you will find the respective documentation if you want to know more.
<CENTER>
<h2> Git&Zenodo Assistant: review about Zenodo </h2>
<img src="images_tutorial/zenodo_review.png">
</CENTER>
### What is Zenodo?
* * *
Zenodo is a website where you can upload and publish files. It is funded by CERN, OpenAIRE and the EU.
It is built and developed by researchers who want to promote Open Science and welcome research from all nations and disciplines, to help scientific work to be more shareable and citeable.
Currently, all meta data is openly available under CC0 licence, and all open content is openly accessible through open APIs
### Uploading and Publishing
* * *
You can upload many types of files to Zenodo: publications, posters, presentations, datasets, images, videos, audios, softwares, lessons, all research outputs from all fields of science are welcome, and they are currently accepting up to 50GB per dataset!
When your files are ready, you can publish them, so they will be permanently available on the Internet: your work will be stored safely and it will be easier to cite, discover and share, considering
flexible licensing (although Zenodo encourages you to share your
research as openly as possible).
### What is DOI Versioning?
* * *
A DOI (Digital Object Identifier) is a unique string of numbers, letters, and symbols used to identify objects (like your scientific publication).
DOIs are standardized and assigned by a registration agency.
Zenodo supports DOI versioning by providing your published work two DOIs, allowing you to:
* Edit/update the record’s files after they have been published.
* Cite a specific version of a record.
* Cite all of versions of a record.
This makes your work easier to identify, search and cite.
### What is metadata?
* * *
Metadata is a set of data that contains information about other data.
While uploading a file to Zenodo, and before you publish it in the website, you have to provide important data about your file, like its title, creators, and type, which represents its metadata.
Not only this is a requirement of Zenodo, but it is very useful: it helps to describe your work, making it easier to find and identify, and it also makes it more accesible, by using a standard format and vocabulary.
## Documentation
[1] [Zenodo: Home Page](https://zenodo.org/)
[2] [About Zenodo](https://about.zenodo.org/)
[3] [Zenodo: FAQ](https://help.zenodo.org/)
[4] [Zenodo: FAQ-DOI Versioning](https://help.zenodo.org/#versioning)
[5] [Zenodo: Principles-Metadata](https://about.zenodo.org/principles/)
......@@ -41,9 +41,9 @@ def start_zenodo():
# Access Git Documentation
def about_git():
print(f"\nTo learn more about {c_Git}:\n\n"
f"Github: {colored('https://github.com/', 'blue')} \n"
f"Gitlab: {colored('https://about.gitlab.com/', 'blue')}\n"
f"Documentation: {colored('https://git-scm.com/doc','blue')} \n")
f"Github: https://github.com/ \n"
f"Gitlab: https://about.gitlab.com/ \n"
f"Documentation: https://docs.github.com/en \n")
input("Press any key to take you back to the main menu.\n")
print(f"Going back to main menu...\n")
time.sleep(2)
......
def zenodo_review():
# Tools
import tkinter as tk
import tkinter.ttk
# Messages for windows
message0 = """
Zenodo is a website where you can upload and publish files,
funded by CERN, OpenAIRE and the EU.\n
It is built and developed by researchers who want to
promote Open Science and welcome research from all nations
and disciplines, to help scientific work to be more
shareable and citeable.\n
Currently, all meta data is openly available under CC0 licence,
and all open content is openly accessible through open APIs.\n
"""
message1 = """
You can upload many types of files to Zenodo: publications, posters,
presentations, datasets, images, videos, audios, softwares, lessons,
all research outputs from all fields of science are welcome, and
they are currently accepting up to 50GB per dataset!.\n
When your files are ready, you can publish them, so they will be
permanently available on the Internet: your work will be stored
safely and it will be easier to cite, discover, share, considering
flexible licensing (although Zenodo encourages you to share your
research as openly as possible).
"""
message2 = """
A DOI (Digital Object Identifier) is a unique string of numbers, letters,
and symbols used to identify objects (like your scientific publication).\n
DOIs are standardized and assigned by a registration agency.\n
Zenodo supports DOI versioning by providing your published work
two DOIs, allowing you to:
-Edit/update the record’s files after they have been published.
-Cite a specific version of a record.
-Cite all of versions of a record.\n
This makes your work easier to identify, search and cite.
"""
message3 = """
Metadata is a set of data that contains information about other data.\n
While uploading a file to Zenodo, and before you publish it in the
website, you have to provide important data about your file, like its
title, creators, and type, which represents its metadata.\n
Not only this is a requirement of Zenodo, but it is very useful: it
helps to describe your work, making it easier to find and identify,
and it also makes it more accesible, by using a standard format and
vocabulary.
"""
# Creating window
root = tk.Tk()
root.title("Review of Zenodo")
root.geometry("260x220")
root.config(background = "#F5F5F5")
root.eval('tk::PlaceWindow . center')
label = tk.Label(root, text ="Select an option and\n review some concepts")
label.pack(pady = 10)
# Open window functions
def open_window_0():
window_0 = tk.Toplevel(root)
window_0.title("About Zenodo")
window_0.geometry("420x300")
window_0.config(background = "#F5F5F5")
# Texts
title = tk.Label(window_0, text ="\n\nWhat is Zenodo?", bg= "#F5F5F5").pack()
text = tk.Label(window_0, text =message0, bg= "#F5F5F5", anchor="e", justify="left", width=100).pack()
return
def open_window_1():
window_1 = tk.Toplevel(root)
window_1.title("Zenodo's repository")
window_1.geometry("460x300")
window_1.config(background = "#F5F5F5")
title = tk.Label(window_1, text ="\n\nUploading and publishing", bg= "#F5F5F5").pack()
text = tk.Label(window_1, text = message1, bg= "#F5F5F5", anchor="e", justify="left", width=100).pack()
return
def open_window_2():
window_2 = tk.Toplevel(root)
window_2.title("DOI Versioning in Zenodo")
window_2.geometry("465x300")
window_2.config(background = "#F5F5F5")
title = tk.Label(window_2, text ="\n\nWhat is DOI Versioning?", bg= "#F5F5F5").pack()
text = tk.Label(window_2, text =message2, bg= "#F5F5F5", anchor="e", justify="left", width=100).pack()
return
def open_window_3():
window_3 = tk.Toplevel(root)
window_3.title("Zenodo's metadata")
window_3.geometry("460x250")
window_3.config(background = "#F5F5F5")
title = tk.Label(window_3, text ="\n\nWhat is metadata?", bg= "#F5F5F5").pack()
text = tk.Label(window_3, text =message3, bg= "#F5F5F5", anchor="e", justify="left", width=100).pack()
return
# Buttons that open windows and destroy the root window.
button_0 = tk.Button(root, text ="What is Zenodo?", bg="#B0E0E6", command=open_window_0)
button_0.pack(side="top")
button_1 = tk.Button(root, text= "Uploading and publishing", bg="#B0E0E6", command=open_window_1)
button_1.pack(side="top")
button_2 = tk.Button(root, text= "What is DOI Versioning?", bg="#B0E0E6", command=open_window_2)
button_2.pack(side="top")
button_3 = tk.Button(root, text ="What is metadata?", bg="#B0E0E6", command=open_window_3)
button_3.pack(side="top")
button_done = tk.Button(root, text = "Done", bg="#FF6347", command=root.destroy)
button_done.pack(side="bottom")
# mainloop, runs infinitely, unless root.destroy
root.mainloop()
return
......@@ -12,6 +12,7 @@ import pandas as pd
# Libraries to obtain data
import tkinter as tk
from zenodo_assistant.zenodo_tools.zenodo_more import zenodo_review
from zenodo_assistant.zenodo_tools.zenodo_search import filename_input
from zenodo_assistant.zenodo_tools.zenodo_functions import type_title, type_description, creators_dict, author_check
from zenodo_assistant.zenodo_tools.zenodo_date import date_input
......@@ -36,9 +37,21 @@ paste = colored("PASTE", "green", attrs=['reverse'])
welcome_message = f"""
Welcome to your {zenodo} assistant.\n
From here, you can upload a file to your {zenodo} account.
Before starting the tutorial, you should already be a little bit
familiarized with {zenodo}. If you are not, do not worry.
We have created a review of some of its important features,
in case you need it.
"""
print(welcome_message)
# Zenodo review
input(f"Press {enter} to see the review. Click {done} when you finish.")
zenodo_review()
input(f"Excellent!\nLet's start the assistant to upload your file. Press {enter}.")
os.system("clear")
# Submit file
input(f"Press {enter} to open the File Browser to {select} and {submit} the file that you want to upload.\n")
......@@ -213,4 +226,4 @@ before publishing.
"""
print(success_message)
input(f"\nPress {enter} to continue.")
\ No newline at end of file
input(f"\nPress {enter} to continue.")