-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkpoet
40 lines (28 loc) · 1 KB
/
mkpoet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
create_poetry_project() {
project_name="$1"
# Create a new directory with the provided project name
mkdir "$project_name" || exit
cd "$project_name" || exit
# Create directories src and tests if they don't exist
mkdir -p src tests
# Create __init__.py files in src and tests directories
touch src/__init__.py
touch tests/__init__.py
touch README.md
# Create and activate a Python virtual environment using venv
python3 -m venv .venv
source .venv/bin/activate
# Install Poetry
pip install poetry
# Configure Poetry to use in-project virtual environments
poetry config virtualenvs.in-project true
# Create a new Poetry project
poetry init
# Create a .gitignore file for Python projects
echo -e "# Python\n*.pyc\n__pycache__/\n.venv/\n.vscode/\n" > .gitignore
# Initialize a Git repository
git init
}
# Call the function and pass the project name as an argument (e.g., "my_project")
create_poetry_project "$1"