Skip to content

Commit

Permalink
First response to review, quiet git commits in bootstrap.sh, not add …
Browse files Browse the repository at this point in the history
…remote origin
  • Loading branch information
verbman committed Apr 4, 2024
1 parent 08141e8 commit d761ec5
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 59 deletions.
14 changes: 7 additions & 7 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ application-package-names = openfisca_core
exclude = .git,__pycache__,.venv,.github,.devcontainer,docs

; D101: Variables already provide label/description
; D102/103: We do not document methods/functions
; D107: We do not document __init__ method
; D401: We do not require the imperative mood
; E128/133: We prefer hang-closing visual indents
; E251: We prefer `function(x = 1)` over `function(x=1)`
; E501: We do not enforce a maximum line length
; W503/4: We break lines before binary operators (Knuth's style)
; D102/103: Do not document methods/functions
; D107: Do not document __init__ method
; D401: Do not require the imperative mood
; E128/133: Prefer hang-closing visual indents
; E251: Prefer `function(x = 1)` over `function(x=1)`
; E501: Do not enforce a maximum line length
; W503/4: Break lines before binary operators (Knuth's style)
63 changes: 31 additions & 32 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,44 @@
* Impacted periods: all.
* Impacted areas: all
* Details:
- Improvements to `bootstrap.sh` to improve experience for first time users. It includes
- removing the need to set `COUNTRY_NAME` and `REPOSITORY_URL` before running.
- introduces a simple guided setup process
- provides a confirmation option/exit script option before changes are made
- allows for hypens and spaces appropriately
- sets `master` branch to `main` by default
- prints to console the commit actions along with description
- Improvements to `bootstrap.sh` to improve experience for first time users:
- remove the need to set `COUNTRY_NAME` and `REPOSITORY_URL` before running.
- introduce a simple guided setup process
- provide a confirmation option/exit script option before changes are made
- allow for hypens and spaces appropriately
- set `master` branch to `main` by default
- print to console the commit actions along with description
- extensive work done on incorporating text replacements across new repository
- upon completion provides next steps with customised commands
- Altered `CONTRIBUTING.md` to allow for improved text replacements
- Replaced reference to `master` with `main`
- Altered `Makefile`
- Removed reference to `OpenFisca France` replacing it with new repository name
- script completion provides next steps with customised commands
- Change `CONTRIBUTING.md` to allow for improved text replacements
- Replace reference to `master` with `main`
- Change `Makefile`
- Remove reference to `OpenFisca France` replace with new repository name
- replace argument `-e` with longer form `--editable` to aid newcomers
- removed argument `--use-deprecated=legacy-resolver` as it no longer appears necessary
- added new formating commands for `isort`, `pyupgrade` and `yamllint`
- Authored default `pyproject.toml` based on the older `setup.py` and `setup.cfg`
- add new formating commands for `isort`, `pyupgrade` and `yamllint`
- Author default `pyproject.toml` based on the older `setup.py` and `setup.cfg`
- Set version to 7.0.0
- Added in `[project.urls]`: `Homepage`, `Repository`, `Documentation`, `Issues` and `Changelog`
- Added in `[project.optional-dependencies]`: new dependancies `isort`, `pyupgrade` and `yamllint`
- Added `[tool.pytest.ini_options]` with filterwarnings set to `"error"`
- Added `[tool.pylint.messages_control]` from `setup.cfg` but in long form for readability
- Added `[tool.isort]` section
- Added `.flake8` and `.yamllint` to project root as these projects do not support `pyproject.toml` format
- Altered `README.md` to allow for improved text replacements
- Removed commands (line 21) for `export COUNTRY_NAME=France` and `export REPOSITORY_URL=...` due to bootstrap.sh improvements
- Adjusted (Line 28) from `git push origin master` to `git push origin main`
- Adjusted (Line 69) to utilise more standard name for virtual environment `.venv` rather than `openfisca` which confused new users.
- Adjusted (Line 143) adding `build twine` to pip upgrade command to standardise it with `Makefile` and `bootstrap.sh`
- Adjusted (Line 148+) for replacement with repository url and likely repository folder name.
- Insured replacement of text on Line 196 worked so text previous to code block wasn't required.
- Removed `setup.py` and `setup.cfg`
- Updated `.github/*.sh` and `.github/workflows/workflow.yaml` files to reference `main` instead of `master`
- Fixed linting issues in:
- Add in `[project.urls]`: `Homepage`, `Repository`, `Documentation`, `Issues` and `Changelog`
- Add in `[project.optional-dependencies]`: new dependancies `isort`, `pyupgrade` and `yamllint`
- Add `[tool.pytest.ini_options]` with filterwarnings set to `"error"`
- Add `[tool.pylint.messages_control]` from `setup.cfg` but in long form for readability
- Add `[tool.isort]` section
- Add `.flake8` and `.yamllint` to project root as these projects do not support `pyproject.toml` format
- Alter `README.md` to allow for improved text replacements
- Remove commands (line 21) for `export COUNTRY_NAME=France` and `export REPOSITORY_URL=...` due to bootstrap.sh improvements
- Adjust (Line 28) from `git push origin master` to `git push origin main`
- Adjust (Line 69) to utilise more standard name for virtual environment `.venv` rather than `openfisca` to reduce confusion.
- Adjust (Line 143) adding `build twine` to pip upgrade command to standardise it with `Makefile` and `bootstrap.sh`
- Adjust (Line 148+) for replacement with repository url and likely repository folder name.
- Insure replacement of text on Line 196 worked so text previous to code block not required.
- Remove `setup.py` and `setup.cfg`
- Update `.github/*.sh` and `.github/workflows/workflow.yaml` files to reference `main` instead of `master`
- Fix linting issues in:
- `openfisca_country_template/texts/social_security_contribution.yaml`
- `openfisca_country_template/texts/situations/income_tax.yaml`
- `openfisca_country_template/variables/demographics.py`
- `openfisca_country_template/variables/taxes.py`
- Altered `CHANGELOG.md` added example entry and altered `bootstrap.sh` to strip out country-template entries. This resolves [issue 116](https://github.com/openfisca/country-template/issues/116).
- Alter `CHANGELOG.md`, add example entry and alter `bootstrap.sh` to strip out country-template entries. This resolves [issue 116](https://github.com/openfisca/country-template/issues/116).


### 6.0.3 [#136](https://github.com/openfisca/country-template/pull/136)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ install: deps
@# Install OpenFisca-Extension-Template for development.
@# `make install` installs the editable version of openfisca-country_template.
@# This allows contributors to test as they code.
pip install --editable .[dev] --upgrade
pip install --editable .[dev] --upgrade --use-deprecated=legacy-resolver

build: clean deps
@# Install OpenFisca-Extension-Template for deployment and publishing.
Expand Down
34 changes: 17 additions & 17 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ PURPLE='\033[1;35m'
YELLOW='\033[0;33m'
BLUE='\033[1;34m'

if [[ -d .git ]]
then
echo 'It seems you cloned this repository, or already initialised it.'
echo 'Refusing to go further as you might lose work.'
echo "If you are certain this is a new repository, run 'cd $(dirname $0) && rm -rf .git' to erase the history."
exit 2
fi

if ! test $JURISDICTION_NAME
then
while true; do
Expand Down Expand Up @@ -38,26 +46,20 @@ fi

cd $(dirname $0) # support being called from anywhere on the file system

if [[ -d .git ]]
then
echo 'It seems you cloned this repository, or already initialised it.'
echo 'Refusing to go further as you might lose work.'
echo "If you are certain this is a new repository, run 'cd $(dirname $0) && rm -rf .git' to erase the history."
exit 2
fi

echo -e "Jurisdiction title set to: ${PURPLE}$JURISDICTION_NAME\033[0m"
# Removes hyphens for python environment
echo -e "Jurisdiction python label: ${PURPLE}$CODE_JURISDICTION_LABEL\033[0m"
echo -e "Git Repository URL : ${PURPLE}$REPOSITORY_URL\033[0m"
read -p "Would you like to continue (y/n): " choice
case "$choice" in
y|Y ) echo "yes";;
y|Y ) echo "You chose yes, carrying on...";;
n|N )
echo "no"
echo "You chose no, exiting."
exit 1
;;
* ) echo "Invalid response, expected y or n, exiting."
exit 1
;;
* ) echo "invalid";;
esac

parent_folder=${PWD##*/}
Expand All @@ -73,10 +75,9 @@ pwd
mv $parent_folder openfisca-$NO_SPACES_JURISDICTION_LABEL
cd openfisca-$NO_SPACES_JURISDICTION_LABEL

git init
git init --initial-branch=main
git add .
git symbolic-ref HEAD refs/heads/main
git commit --no-gpg-sign --message "$first_commit_message" --author='OpenFisca Bot <[email protected]>'
git commit --no-gpg-sign --message "$first_commit_message" --author='OpenFisca Bot <[email protected]>' --quiet
echo -e "${YELLOW}--\033[0m"
echo -e "${PURPLE}Set default branch to 'main'.\033[0m"
echo -e "${PURPLE}Initial git commit made to 'main' branch: \033[0m${BLUE}$first_commit_message\033[0m"
Expand Down Expand Up @@ -104,11 +105,9 @@ git mv openfisca_country_template openfisca_$CODE_JURISDICTION_LABEL

git rm bootstrap.sh
git add .
git commit --no-gpg-sign --message "$second_commit_message" --author='OpenFisca Bot <[email protected]>'
git commit --no-gpg-sign --message "$second_commit_message" --author='OpenFisca Bot <[email protected]>' --quiet
echo -e "${YELLOW}--\033[0m"
echo -e "${PURPLE}Second git commit made: \033[0m${BLUE}$second_commit_message\033[0m"
git remote add origin $REPOSITORY_URL.git
echo -e "${PURPLE}Git remote origin added: \033[0m${BLUE}$REPOSITORY_URL.git\033[0m"
echo -e "${YELLOW}--\033[0m"

echo -e "${YELLOW}***********************************************************************\033[0m"
Expand All @@ -129,6 +128,7 @@ echo -e "${YELLOW}*\033[0m $ ${BLUE}make all\033[0m"
echo -e "${YELLOW}*\033[0m (refer to ./Makefile for other examples)"
echo -e "${YELLOW}*\033[0m"
echo -e "${YELLOW}*\033[0m Finally, push changes to your git host:"
echo -e "${YELLOW}*\033[0m $ ${BLUE}git remote add origin $REPOSITORY_URL.git\033[0m"
echo -e "${YELLOW}*\033[0m $ ${BLUE}git push origin main\033[0m"
echo -e "${YELLOW}*\033[0m"
echo -e "${YELLOW}***********************************************************************\033[0m"
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# Note the `reforms: ` key in the below YAML blocks.

- name: We will dinamically add new variable "goes_to_school" thanks to a reform
- name: We will dynamically add a new variable "goes_to_school" thanks to a reform
reforms: openfisca_country_template.reforms.add_dynamic_variable.add_dynamic_variable
period: 2017-01
output:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "openfisca-country_template"
version = "7.0.0"
description = "OpenFisca rules-as-code system for Country-Template."
description = "OpenFisca Rules as Code model for Country-Template."
readme = "README.md"
keywords = ["microsimulation", "tax", "benefit", "rac", "rules-as-code"]
authors = []
Expand Down

0 comments on commit d761ec5

Please sign in to comment.