This project is a guide on how to spin up a fully configured dev environment in the cloud ready for development using the blank canvas provided by GitHub using Codespaces.
Warning
Codespaces are deleted automatically after 30 days of inactivity. Read more about Codespace lifecycle.
GitHub account created.
- Instant, customizable development environment
- Accessible from any device with Internet
- Facilitates real-time collaboration
- Seamless Git and GitHub integration
- Scalable with adjustable resources
- Supports Visual Studio Code extensions
- Container-based isolation for consistency
- Efficient onboarding with time and resource savings
- Disposable environments for testing and experimentation
- GitHub manages the underlying infrastructure
- Integrated with GitHub Actions for automation
The link below provides a quickstart to spin up an environment using this template as a base project.
Follow this guide to create a repository from this template.
After creating a project from this template, navigate to the README.md file and switch to code view. Then update the line 29 by replacing juancarlosjr97/codespaces-git-playground
with the path of the project created. It will be a combination of the GitHub username joined with the name of the GitHub repository as ${GITHUB_USERNAME}/${GITHUB_REPOSITORY}
.
When a Codespace is created it comes with Git automatically authenticated with the credentials of the associated GitHub account. Additionally, it comes with basic tools such as python
ready to start development. For more information, read the official GitHub Documentation.
After you have the Codespace up and running, run the following code from the terminal. Ensure you use capital V for the Python version command:
git -v
python -V
The result should be similar to the below code, but it might differ from the versions on each Codespace:
git version 2.43.0
Python 3.10.13
Execute the below script to run the Python code located in main.py
:
python -m src.main
Upon successful execution, the script will return: Congratulations, you are running the Python script from a GitHub Codespace environment. Now, it is 29-01-2024 22:29 and time for further development.
Please note that the date and time will vary depending on when the script is run.
- Open the python file located on
./src/main.py
- Update the line 4 by updating the
strftime
to%d-%m-%Y %H:%M:%S
. This update will format the date to include seconds. - Run the Python script again and should return the date as a string with seconds. For example,
29-01-2024 22:35:35
.
Congratulations, you have updated the Python script!
After making the changes, the next step is to commit and push the changes to your GitHub repository.
To do this step, the project needs to be created from the template in order to have permission to make changes to the project. Follow these steps Creating a repository from a template
-
Stage the changes
git add src/main.py
-
Commit the changes
git commit -m "Adding seconds to date time formatting:"
-
Push the changes
git push
Congratulations! You have successfully staged, committed, and pushed the changes to the remote repository. The dynamic date and time formatting feature has been added to themain.py
script. Now, it is ready for further collaboration and development.
This project is licensed under the MIT License. See the LICENSE file.