-
Notifications
You must be signed in to change notification settings - Fork 23
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
Improve copywriting for Installation #300
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
656fa1e
Installation-index
verbman 4fb3796
on-the-web
verbman a40c05c
offline-environment
verbman bc8ff0e
windows-no-admin
verbman 2d525ab
test-situations
verbman ab72f1b
Update source/installation/test_situations.md
verbman 141ad5c
Update source/installation/offline-environment.md
verbman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,68 @@ | ||
# In an offline environment | ||
|
||
If you need to install OpenFisca on a server with no Internet access, here is how to do it. | ||
If you need to install OpenFisca on a server with no internet access, here is how you might do it. | ||
|
||
The big picture: download Python packages on a machine with Internet access, copy them to the server and install them in a [virtualenv](https://virtualenv.pypa.io/en/stable/). | ||
The big picture: download Python packages on a machine with internet access, copy them to the server and install them in a [virtualenv](https://virtualenv.pypa.io/en/stable/). | ||
|
||
We assume that it is possible to copy files to the server, for example via a USB stick. Or perhaps the server filters only outgoing connections, but accepts incoming connections allowing to copy the files. | ||
It's assumed that it is possible to copy files to the server, i.e. via a USB stick. | ||
|
||
## On the machine with Internet access | ||
|
||
We are going to create a first virtualenv in which we'll use `pip` to download the `.whl` files in a specific directory. | ||
|
||
Here we use [pew](https://github.com/berdario/pew) to simplify virtualenv management. | ||
First create a virtual environment and use `pip` to download the `.whl` files to a specific directory. | ||
|
||
```sh | ||
pip install pew | ||
pew new openfisca-packages --python=python3.7 | ||
mkdir ~/openfisca-packages | ||
cd ~/openfisca-packages | ||
|
||
# Create and instigate a virtual environment | ||
python3.11 -m venv .venv | ||
source .venv/bin/activate | ||
|
||
# Upgrade pip itself | ||
pip install --upgrade pip | ||
pip --version | ||
# Should print at least 9.0 at the time we write this doc. | ||
# Prints 24.0 at the time this doc was written. | ||
|
||
mkdir ~/openfisca-packages | ||
cd ~/openfisca-packages | ||
pip download OpenFisca-France | ||
mkdir country-template | ||
cd country-template | ||
pip download OpenFisca-Country-Template | ||
# You should see the downloaded files in the current directory. | ||
``` | ||
|
||
Now copy these files on the server (say in the `~/openfisca-packages` directory), either via a USB stick, or with `scp`, or any other way. | ||
Copy the files in the `~/openfisca-packages/country-template` directory to the server via a USB stick, or for example with `scp`. | ||
|
||
Example with `scp`: | ||
|
||
```sh | ||
scp -r ~/openfisca-packages user@server: | ||
scp -r ~/openfisca-packages/country-template user@server: | ||
``` | ||
|
||
## On the server | ||
|
||
Starting from here we assume you copied the packages on the server, say in `~/openfisca-packages`. | ||
The following assumes the files are now stored in `~/openfisca-packages/country-template` on the server. | ||
|
||
The following commands show how to install Python packages without any Internet access. | ||
If you already have a virtualenv, activate it. Otherwise create a new one following the same instructions as above (for example with `pew new`). | ||
If you already have a virtual environment, activate it. Otherwise create a new one following the same instructions as above. | ||
|
||
```sh | ||
pip install ~/openfisca-packages/* | ||
pip install ~/openfisca-packages/country-template/* | ||
Processing ./isodate-0.5.4.tar.gz | ||
[...] | ||
Installing collected packages: pytz, Babel, Biryani, numpy, PyYAML, OpenFisca-Core, requests, OpenFisca-France, isodate | ||
Successfully installed Babel-2.3.4 Biryani-0.10.4 OpenFisca-Core-7.0.0 OpenFisca-France-15.1.0 PyYAML-3.12 isodate-0.5.4 numpy-1.12.0 pytz-2016.10 requests-2.13.0 | ||
Installing collected packages: StrEnum, sortedcontainers, typing-extensions... openfisca-country-template | ||
Successfully installed StrEnum, sortedcontainers, typing-extensions... openfisca-country-template | ||
|
||
pip list | grep OpenFisca-France | ||
OpenFisca-France 15.1.0 | ||
# Step completed, the following can be utilised to confirm success and versions of the packages installed. | ||
pip list | grep openfisca-country_template | ||
openfisca-country_template 7.1.1 | ||
|
||
pip list | grep OpenFisca-Core | ||
OpenFisca-Core 41.4.5 | ||
``` | ||
|
||
Run the basic tests which confirm that OpenFisca-France is correctly installed: | ||
To check that everything works correctly, run the following command: | ||
|
||
```sh | ||
python -m openfisca_france.tests.test_basics | ||
OpenFisca-France basic test was executed successfully. | ||
python -c "from openfisca_country_template import CountryTaxBenefitSystem; CountryTaxBenefitSystem()" | ||
``` | ||
|
||
No error message should appear. You can now utilise this environment to [run simulations](../simulate/run-simulation.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# On the web | ||
|
||
Some online services offer the opportunity to run Python code without having to install anything on your machine. | ||
|
||
For example, if you wish to evaluate the impact of a reform you could decide to run an OpenFisca simulation directly in your browser. To achieve this you might find one of the following services useful: [Gitpod](https://www.gitpod.io/), [repl.it](https://repl.it), [python anywhere](https://www.pythonanywhere.com) and [Jupyterlab](https://jupyterlab.readthedocs.io/en/stable/). | ||
|
||
Please be aware that you will need to install the OpenFisca package you need on your online service before using it. You will find a quick generic usage example to test your setup below. | ||
|
||
## Instructions | ||
|
||
1. Start by installing the package you need on your online service e.g. `pip install openfisca-country-template`. | ||
|
||
2. Write the code you wish to run. The following code snippet works with the above package: | ||
|
||
```py | ||
from openfisca_country_template import CountryTaxBenefitSystem | ||
|
||
tax_benefit_system = CountryTaxBenefitSystem() | ||
parameters = tax_benefit_system.parameters | ||
|
||
print(parameters) | ||
``` | ||
|
||
3. Run your code and check the results. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
# How to test your changes on "ready to use" situations (for OpenFisca-France) | ||
# How to test your changes on "ready to use" situations | ||
|
||
Often, when making changes to legislation, you need to test it on a situation that works with your country's tax and benefit system. | ||
Sometimes, these situations can be quite complicated to model (such as roomates). | ||
Instead of re-writing them everytime, we have pre-packaged a few in a Python Package. | ||
|
||
You can find the package along with a usage example in the [Tutorial repository](https://github.com/openfisca/tutorial/tree/master/python/scripts/generate_situation_examples) | ||
Often, when making changes to legislation it needs testing on a simulation that works with your country's tax and benefit system. | ||
Sometimes, these simulations can be quite complicated to model. | ||
Instead of rewriting them every time, first check your country's repository for `situation_examples` that have already been created. | ||
If what you need does not exist, you could create your own examples and contribute them to the repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our goal is to only refer to the Country Template, not to any specific country package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review and feedback. I note that this specific example for windows no administration needs to be retried utilising the latest country template. It was originally written against the France model and I would like to leave it in that state for accuracy until there's time to test and write an updated solution.