This template is designed to help you quickly scaffold a PyFlink project, ensuring you have all the necessary files and structure to get started with your Flink jobs. Below are the steps to use this cookiecutter template:
-
Python 3.8 or higher
-
Cookiecutter Python package installed. If you do not have cookiecutter installed, you can install it using pip:
pip install cookiecutter
-
Generate the Project: Run the following command in your terminal, replacing
<your-project-name>
with the desired name of your project:cookiecutter gh:yourgithubusername/flink-cookiecutter-template --output-dir <your-project-name>
This command will prompt you for various configurations like project name, author name, Flink version, etc. Fill these out according to your project's needs.
-
Navigate to Your Project Directory: Once the project is generated, move into your project directory:
cd <your-project-name>
-
Install Dependencies: The template uses Poetry for dependency management. Install the project dependencies by running:
poetry install
-
Explore Your Project: Your new PyFlink project will include a basic project structure, including a
src
directory for your Flink jobs, atests
directory for unit tests, and configuration files for project dependencies and settings. -
Running Your Flink Job: With your environment set up, you can start developing your Flink jobs. Place your job scripts in the
src
directory. You can run your Flink jobs locally or deploy them to a Flink cluster depending on your setup.
- Customize the
pyproject.toml
file as needed for your project dependencies. - Develop your Flink jobs within the
src
directory. - Add unit tests in the
tests
directory to ensure your jobs run as expected.
By following these steps, you can quickly set up and start developing your PyFlink projects using this cookiecutter template.