Welcome to the AirBnB clone project! This project is the first step in building a full web application for managing an AirBnB-like platform. In this step, we develop a command interpreter to manage AirBnB objects and set the foundation for future steps involving web development, database storage, API integration, and more.
The goal of this project is to build a command interpreter in Python to manage objects related to the AirBnB platform. The interpreter allows you to:
- Create new objects (e.g., User, Place, State, City, etc.)
- Retrieve objects from a file
- Update attributes of an object
- Destroy objects
- Perform operations on objects (counting, computing statistics, etc.)
This interpreter will be crucial for further development of the AirBnB clone project, as it will interface with different components like HTML/CSS templates, databases, and APIs.
-
Python Scripts
- All files must be written in Python 3 and run on Ubuntu 20.04 LTS using Python 3.8.5.
- Use
pycodestyle
(version 2.8.*) for code style checks. - All files must end with a new line.
- The first line of each file must be
#!/usr/bin/python3
. - All files must be executable.
- Each module, class, and function should have detailed documentation.
-
Python Unit Tests
- Tests should be created using the
unittest
module. - All test files should be in a
tests
folder and use a naming convention starting withtest_
. - Test files should reflect the same structure as the project source code.
- All tests should be executed using
python3 -m unittest discover tests
.
- Tests should be created using the
Here are some useful resources to help with this project:
By completing this project, you should understand:
- How to create a Python package.
- How to create a command interpreter in Python using the
cmd
module. - What is Unit testing and how to implement it in a large project.
- How to serialize and deserialize a class in Python.
- How to read and write JSON files.
- How to manage
datetime
. - What is a UUID.
- How to use
*args
and**kwargs
. - How to handle named arguments in a function.
The command interpreter should work in both interactive and non-interactive modes.
$ ./console.py
(hbnb) help
Documented commands (type help <topic>):
========================================
EOF help quit
(hbnb) quit
$
Based on the provided instructions and requirements, here's a suggested content for the README file. It contains sections to guide you through the project's purpose, requirements, setup, and key elements. Important concepts and resources are linked to relevant external sources for additional context.
README.md
markdown
Copy code
# AirBnB Clone - The Console
Welcome to the AirBnB clone project! This project is the first step in building a full web application for managing an AirBnB-like platform. In this step, we develop a command interpreter to manage AirBnB objects and set the foundation for future steps involving web development, database storage, API integration, and more.
## Project Overview
The goal of this project is to build a command interpreter in Python to manage objects related to the AirBnB platform. The interpreter allows you to:
- Create new objects (e.g., User, Place, State, City, etc.)
- Retrieve objects from a file
- Update attributes of an object
- Destroy objects
- Perform operations on objects (counting, computing statistics, etc.)
This interpreter will be crucial for further development of the AirBnB clone project, as it will interface with different components like HTML/CSS templates, databases, and APIs.
## Requirements
- Python Scripts
- All files must be written in Python 3 and run on Ubuntu 20.04 LTS using Python 3.8.5.
- Use `pycodestyle` (version 2.8.*) for code style checks.
- All files must end with a new line.
- The first line of each file must be `#!/usr/bin/python3`.
- All files must be executable.
- Each module, class, and function should have detailed documentation.
- Python Unit Tests
- Tests should be created using the `unittest` module.
- All test files should be in a `tests` folder and use a naming convention starting with `test_`.
- Test files should reflect the same structure as the project source code.
- All tests should be executed using `python3 -m unittest discover tests`.
## Resources
Here are some useful resources to help with this project:
- [Python packages](https://docs.python.org/3/tutorial/modules.html#packages)
- [AirBnB clone concept](https://www.airbnb.com/)
- [cmd module](https://docs.python.org/3/library/cmd.html)
- [UUID module](https://docs.python.org/3/library/uuid.html)
- [datetime module](https://docs.python.org/3/library/datetime.html)
- [unittest module](https://docs.python.org/3/library/unittest.html)
## Learning Objectives
By completing this project, you should understand:
- How to create a Python package.
- How to create a command interpreter in Python using the `cmd` module.
- What is Unit testing and how to implement it in a large project.
- How to serialize and deserialize a class in Python.
- How to read and write JSON files.
- How to manage `datetime`.
- What is a UUID.
- How to use `*args` and `**kwargs`.
- How to handle named arguments in a function.
## Execution
The command interpreter should work in both interactive and non-interactive modes.
### Interactive Mode
```shell
$ ./console.py
(hbnb) help
Documented commands (type help <topic>):
========================================
EOF help quit
(hbnb) quit
$
### Non-Interactive Mode
```shell
Copy code
$ echo "help" | ./console.py
(hbnb)
Documented commands (type help <topic>):
========================================
EOF help quit
This functionality should allow you to run the interpreter in different contexts, including automated tests or other shell scripts.