Skip to content

Commit

Permalink
Update README: Use venv (instead of virtualenv)
Browse files Browse the repository at this point in the history
  • Loading branch information
holybiber committed Feb 7, 2025
1 parent 9b0aad0 commit 0df0a28
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 28 deletions.
47 changes: 20 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,45 +34,38 @@ use the [pywikibot framework](https://www.mediawiki.org/wiki/Manual:Pywikibot).

## Setup

> **Note**: pywikitools base path refers to the directory where you can find
> `README.md`, `CONTRIBUTING.md`, and `requirements.txt`.
1. Install required libraries within a `virtualenv`:
1. Install LibreOffice UNO (python bridge, on linux)
```shell
$ sudo apt-get install python3-uno
```
> This is required for our LibreOffice module and scripts using it
> (`translateodt.py`), and to run the complete test suite.
> We strongly recommend you to use a virtual environment to manage your
Python dependencies.
2. Install required python packages
> We assume you're in the root directory ("base path") of `pywikitools`:
> the directory where you find `README.md` and `requirements.txt`.
* Install `virtualenv`:
* Set up a virtual environment

```shell
$ sudo python -m pip install virtualenv
$ python3 -m venv env --system-site-packages
```

* Create a new virtual environment:

```shell
$ virtualenv new_venv_name
```
> You need `--system-site-packages` so that the `uno` package
> you just installed globally gets available

* Activate the virtual environment:

```shell
$ source new_venv_name/bin/activate
$ source env/bin/activate
```

* At the root directory of `pywikitools`, run:
* Install the necessary packages

```shell
$ pip install -r requirements.txt
```

2. Install LibreOffice UNO (python bridge, on linux)
```shell
$ sudo apt-get install python3-uno
```
> This is required for our LibreOffice module and scripts using it
> (`translateodt.py`), and to run the complete test suite.

3. Set up configuration in `config.ini`:
```shell
$ cp config.example.ini config.ini
Expand All @@ -85,14 +78,14 @@ use the [pywikibot framework](https://www.mediawiki.org/wiki/Manual:Pywikibot).
* Configure all other necessary options like usernames and site (connect to
`4training.net` / `test.4training.net` / [local docker-based server](https://github.com/4training/docker) `localhost:8082`)

4. You're ready to go! Look at the different scripts and how to invoke them and
try them out! To get to know everything and to understand what is going on,
set the logging level to INFO (default is WARN) by adding `-l info`.
You're ready to go! Look at the different scripts and how to invoke them and
try them out! To get to know everything and to understand what is going on,
set the logging level to INFO (default is WARN) by adding `-l info`.
## Run scripts
```shell
$ python3 path/to/script args
$ python path/to/script args
```
If you're not yet logged in, `pywikibot` will ask you for the password for the
Expand All @@ -105,7 +98,7 @@ From your base pywikitools path, use the following command to run the test
suite.
```shell
$ python3 -m unittest discover -s pywikitools/test
$ python -m unittest discover -s pywikitools/test
```
Also, run the next command to check for linting issues
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ replace = __version__ = '{new_version}'
universal = 1

[flake8]
exclude = docs,pywikitools/user-config.py,pywikitools/correctbot/user-config.py
exclude = env,docs,pywikitools/user-config.py,pywikitools/correctbot/user-config.py
max-line-length = 120
# TODO enable E501 for generateodt.py some day
per-file-ignores =
Expand Down

0 comments on commit 0df0a28

Please sign in to comment.