Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Training upgrade #139

Merged
merged 29 commits into from
Apr 24, 2024
Merged

Training upgrade #139

merged 29 commits into from
Apr 24, 2024

Conversation

verbman
Copy link
Contributor

@verbman verbman commented Mar 20, 2024

  • Technical improvement.
  • Major change
  • Impacted periods: all.
  • Impacted areas: all
  • Details:
    • Improvements to bootstrap.sh to improve experience for first time users:
      • remove the need to set COUNTRY_NAME and REPOSITORY_URL before running.
      • 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
    • 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
      • 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
      • 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
      • General changes to support change to bootstrap flow
    • 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
    • Alter CHANGELOG.md, add example entry and alter bootstrap.sh to strip out country-template entries. This resolves issue 116.

Note that this has been tested against OpenFisca-core and requires corresponding pull request to pass the OpenFisca-core test suite.

If this is approved, it is the intention to upgrade the documentation surrounding OpenFisca which will likely include the *.md files in this repository and result in a subsequent PR.

Copy link
Member

@MattiSG MattiSG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising! 👏

.flake8 Outdated Show resolved Hide resolved
.yamllint Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
bootstrap.sh Outdated Show resolved Hide resolved
bootstrap.sh Outdated Show resolved Hide resolved
bootstrap.sh Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
@MattiSG
Copy link
Member

MattiSG commented Mar 28, 2024

Note: after merging, we'll need to switch the main branch from master to main.

@MattiSG
Copy link
Member

MattiSG commented Mar 28, 2024

Did you see #109? Could it be (have been) helpful?

@verbman verbman requested a review from MattiSG April 8, 2024 10:22
Copy link
Member

@MattiSG MattiSG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The version number is not reinitialised after the bootstrap script is executed, meaning the first version number is 7.0.0.

I tried executing, and got the following:

test/country-template-training-upgrade [main]
› python --version
Python 3.11.7
test/country-template-training-upgrade [main]
› pip install openfisca-senegal
Collecting openfisca-senegal
  Downloading OpenFisca_Senegal-0.10.3-py3-none-any.whl.metadata (1.5 kB)
Collecting OpenFisca-Core<36.0,>=35.0.1 (from openfisca-senegal)
…
Downloading wcwidth-0.2.13-py2.py3-none-any.whl (34 kB)
Building wheels for collected packages: numpy
  Building wheel for numpy (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for numpy (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [1264 lines of output]
      setup.py:66: RuntimeWarning: NumPy 1.20.3 may not yet support Python 3.11.

We insist that Python version should be 3.9, but give no guidance on how to install that specific version. We can consider that this is out of scope, but “should print "Python 3.9.xx"” is a bit light compared to “Install Python 3.9” with a link to how to install that version.

In my case (macOS), I could make it work by using brew install python@3.9 and then using pip3.9 instead of pip.


As written in the README, I tried to run openfisca serve --port 5000 after installing, and that failed with openfisca: command not found. I used instead make serve-local which is suggested as an alternative, and it worked. If we cannot make openfisca serve work, let's remove that instruction.

## 7.0.0 [#139](https://github.com/openfisca/country-template/pull/139)

* Technical improvement.
* Major change
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any breaking change, so according to semver this could just be a minor 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is the breaking change discussed between this and OpenFisca-Core tests...

CHANGELOG.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
bootstrap.sh Outdated Show resolved Hide resolved
bootstrap.sh Outdated Show resolved Hide resolved
bootstrap.sh Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
bootstrap.sh Outdated
read JURISDICTION_NAME
if [[ "$JURISDICTION_NAME" != "" ]]
then
lowercase_jurisdiction_name=$(echo $JURISDICTION_NAME | tr '[:upper:]' '[:lower:]')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to make this even more forgiving, we should remove diacritics. For example, if I type Sénégal as a jurisdiction, this should convert to senegal, as otherwise I get:

› pip install openfisca-sénégal
ERROR: Invalid requirement: 'openfisca-sénégal'

If this is too costly to implement, we probably should clarify “without accents” in the read prompt 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented and tested possible solution, please see commit #f38f8f9

bootstrap.sh Outdated
echo '************'
echo '* All set! *'
echo '************'
exec bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This starts a bash session without loading .profile and other session-specific setup, which is very confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have not found another solution automatically orientating the user to the newly created directory. I'm open to suggestions on this. We can revert which leaves them at a bash prompt located in a non existent folder which might also be confusing.

verbman and others added 2 commits April 22, 2024 14:18
Co-authored-by: Matti Schneider <matti.schneider@beta.gouv.fr>
Copy link
Member

@MattiSG MattiSG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for these changes!

I realised the current implementation removes the ability to use env variables, which prevents automated execution. We should instead ask interactively only if it is not readily available.

I'll take over the last changes 🙂

Copy link
Member

@MattiSG MattiSG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made several changes, please double-check them before merging 🙂

@verbman verbman merged commit 78815c0 into master Apr 24, 2024
7 checks passed
@verbman verbman deleted the training-upgrade branch April 24, 2024 05:06
@MattiSG MattiSG mentioned this pull request May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initialise CHANGELOG in bootstrap script
2 participants