Browse Source

docs: update readme

tags/v0.10.0
Jérôme Deuchnord 3 years ago
parent
commit
ad63a2b0a1
1 changed files with 31 additions and 57 deletions
  1. +31
    -57
      README.md

+ 31
- 57
README.md View File

@@ -1,88 +1,62 @@
# Kosmorrolib - a library to compute your ephemerides!
[![Coverage Status](https://coveralls.io/repos/github/Deuchnord/kosmorro/badge.svg)](https://coveralls.io/github/Deuchnord/kosmorro) [![Version on PyPI](https://img.shields.io/pypi/v/kosmorro)](https://pypi.org/project/kosmorro) [![Discord](https://img.shields.io/discord/650237632533757965?logo=discord&label=%23kosmorro)](https://discord.gg/nyemBqE)
[![Coverage Status](https://coveralls.io/repos/github/kosmorro/lib/badge.svg)](https://coveralls.io/github/kosmorro/lib) [![Version on PyPI](https://img.shields.io/pypi/v/kosmorrolib)](https://pypi.org/project/kosmorrolib) [![Discord](https://img.shields.io/discord/650237632533757965?logo=discord&label=%23kosmorro)](https://discord.gg/nyemBqE)

## Installation

### Requirements

Kosmorro requires the following software to work:
Kosmorrolib requires the following software to work:

- Python ≥ 3.5.0
- Python ≥ 3.7.0
- PIP

### Production environment

Keep in mind that Kosmorro is still in alpha development stage and is not considered as stable.
Keep in mind that Kosmorrolib is not considered as stable for now.

#### Linux
#### PyPI

##### Arch Linux, Manjaro…

Kosmorro is available [in the AUR](https://aur.archlinux.org/packages/kosmorro).

##### Other distributions

Kosmorro is available [on PyPI](https://pypi.org/project/kosmorro/), a repository dedicated to Python.
First, install `python-pip` on your system and invoke the following command: `pip install kosmorro`.

#### macOS

Currently, macOS does not provide Python 3, so you will first have to install it.
If you don't have it, first install [HomeBrew](https://formulae.brew.sh), then install Python 3: `brew install python`.

This will install Python 3 and its PIP on your system. Note that their executables are called `python3` and `pip3`.
Now, you can install Kosmorro with your PIP: `pip3 install kosmorro`.

#### Windows

Kosmorro being at an early-stage development, Windows is not supported officially for now.
Kosmorrolib is available [on PyPI](https://pypi.org/project/kosmorrolib/): `pip install kosmorrolib`.

### Development environment

First, install [Pipenv](https://pypi.org/project/pipenv/).

Clone this repository and run `pipenv sync` to install all the dependencies.
Then, run Kosmorro by invoking `pipenv run python kosmorro`.

For comfort, you may want to invoke `pipenv shell` first and then just `python kosmoro`.

## Using Kosmorro

Using Kosmorro is as simple as invoking `kosmorro` in your terminal!

By default, it will give you the current Moon phase and, if any, the events that will occur today.
To get the rise, culmination and set of the objects of the Solar system, you will need to give it your position on Earth: get your current coordinates (with [OpenStreetMap](https://www.openstreetmap.org) for instance), and give them to Kosmorro by invoking it with the following parameters: `--latitude=X --longitude=Y` (replace `X` by the latitude and `Y` by the longitude).
And that's all, your development environment is ready for the fight! 👏

Kosmorro has a lot of available options. To get a list of them, run `kosmorro --help`, or read its manual with `man kosmorro`.
## Using the Kosmorrolib

Note: the first time it runs, Kosmorro will download some important files needed to make the computations. They are stored in a cache folder named `.kosmorro-cache` located in your home directory (`/home/<username>` on Linux, `/Users/<username>` on macOS).
The Kosmorrolib provides three functions that you can use in your code:

### Exporting to PDF
```python
#!/usr/bin/env python3

Kosmorro can export the computation results to PDF files, but this feature requires first that you install some additional dependencies. Before you use this feature, please check these packages are installed:
import kosmorrolib
from datetime import date

- **A LaTeX distribution:**
- Linux: install TeXLive through your packages manager. Kosmorro just needs the minimal installation, you don't need any extension.
- macOS: install [MacTeX](https://www.tug.org/mactex/), the basic version will suffice:
- from the official website, choose the _smaller download_
- with Brew: `brew install basictex`
- **The `latex` Python library:**
- Arch Linux: the library is available [on the AUR](https://aur.archlinux.org/packages/python-latex)
- Any other systems: install it through PyPI: `pip install latex`
position = kosmorrolib.Position(50.5824, 3.0624)

These dependencies are not installed by default, because they take a lot of place and are not necessary if you are not interested in generating PDF files.
The first time you ask Kosmorro to create a PDF, it may be a little verbose. You can ignore its blahblah.
# Get the moon phase for today
moon_phase = kosmorrolib.get_moon_phase()

### Opening the GUI
# Get the moon phase for June 9th, 2021
moon_phase = kosmorrolib.get_moon_phase(date.fromisoformat('2021-06-09'))

![Screenshot](.github/assets/gui-screenshot.png)
# Get a list of objects representing the ephemerides of today.
ephemerides = kosmorrolib.get_ephemerides(position)

Kosmorro provides a graphical user interface that can be easily launched by invoking the `kosmorro --gui` command.
# Get a list of objects representing the ephemerides of June 9th, 2021.
ephemerides = kosmorrolib.get_ephemerides(position, date.fromisoformat('2021-06-09'))

To run it, you will have to install the `wxpython` package:
# Get a list of objects representing the events of today.
events = kosmorrolib.get_events()

- **On Linux**, wxPython is most likely provided by your packages manager.
- **On Mac**, install wxPython by invoking `pip3 install wxPython`.
# Get a list of objects representing the events on June 9th, 2021.
events = kosmorrolib.get_events(date.fromisoformat('2021-06-09'))

Alternatively, you may download the DMG file on the release page (note that you won't be able to use the command
line in this case).
# Note that each method provides an optional parameter for the timezone:
moon_phase = kosmorrolib.get_moon_phase(timezone=2)
ephemerides = kosmorrolib.get_ephemerides(position, timezone=2)
events = kosmorrolib.get_events(timezone=2)
```

Loading…
Cancel
Save