Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
xBrite
sample-python-package
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
sample-python-package
/
init_package.sh
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
49 lines (38 loc) · 1.54 KB
master
Breadcrumbs
sample-python-package
/
init_package.sh
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
49 lines (38 loc) · 1.54 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
set -e
DEFAULT_PYTHON_VERSION="3.7.8"
# Request and confirm the new package name.
while [[ -z $PACKAGE_NAME ]]; do
echo "What python version should be added to .envrc for local development"
echo -n "of this package? [$DEFAULT_PYTHON_VERSION] "
read PYTHON_VERSION
if [[ ! -z $PYTHON_VERSION ]]; then
PYTHON_VERSION="$DEFAULT_PYTHON_VERSION"
fi
echo "Press ^C to cancel."
echo "Press ENTER to confirm python version '$PYTHON_VERSION'."
read
echo -n "What is the name of this package? "
read PACKAGE_NAME
if [[ ! -z $PACKAGE_NAME ]]; then
echo "Press ^C to cancel."
echo "Press ENTER to confirm and initialize this package named '$PACKAGE_NAME'."
read
fi
done
# Make sure we're in the right directory before we touch anything
PROJECT_ROOT="$(cd "$(dirname "$0")/"; pwd)"
cd $PROJECT_ROOT
# Update envrc with the requested python version
/usr/bin/sed -e "s,^\( *use pyenv\) [0-9][0-9.]*,\1 $PYTHON_VERSION," .envrc
# Rename the main package directory
mv sample_package "$PACKAGE_NAME"
# Search through all of the other files in this directory and find/replace to update the name
THIS_FILE=$(basename "$0")
find . -maxdepth 1 -type f -not -name "$THIS_FILE" -exec /usr/bin/sed -i '' -e "s,sample_package,$PACKAGE_NAME,g" {} \+
# Make sure the user knows we're about to remove this script now.
echo "Press ENTER to finish cleaning up and remove this initialization script."
read
/bin/rm -f "$0"
# Add a reminder
echo "Don't forget to read all of the instructions in README.md."
You can’t perform that action at this time.