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

Style, chore, refactor #22

Merged
merged 22 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11']
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ __pycache__
.mypy_cache
.tox
.coverage
env
.env
build
*.egg-info
dist
.ruff*
.python-version
41 changes: 12 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: double-quote-string-fixer
- id: no-commit-to-branch
args: [--branch, master]

- repo: local
hooks:
- id: unittests
Expand All @@ -17,38 +20,18 @@ repos:
args: [
'discover',
]
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: flake8
args: [
'src',
'tests',
'docs',
]
- repo: https://github.com/PyCQA/pylint
rev: v3.0.1
hooks:
- id: pylint
pass_filenames: false
args: [
'src',
'tests',
'docs',
]
- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args: [
'src',
'tests',
'docs',
]
- id: ruff
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
rev: v1.9.0
hooks:
- id: mypy

- repo: https://github.com/terrencepreilly/darglint
rev: v1.8.1
hooks:
Expand Down
42 changes: 19 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ python --version
```

To install multiple Python versions, use [pyenv](https://github.com/pyenv/pyenv).

To activate:
```sh
pyenv local 3.10 3.11
pyenv local 3.10 3.11 3.12
```

### pip and setuptools
### Project code
```sh
python -m pip install --upgrade pip setuptools
cd && git clone # path-to-this-repository.git
```

### Project code
### Virtual environment
```sh
cd
git clone # path-to-this-repository.git
cd # path-to-downloaded-repository
python -m venv .env
source .env/bin/activate
```

### Virtual environment
### pip and setuptools
```sh
cd # path-to-downloaded-reposity
python -m venv env
source env/bin/activate
python -m pip install --upgrade pip setuptools
```

### Dependencies
Expand All @@ -38,30 +38,26 @@ pip install -e .[dev]
### Pre-commit
```sh
pre-commit install
pre-commit run --all-files
pre-commit autoupdate
pre-commit run --all-files
```

https://pre-commit.com/

## Develop
### Lint
See [tox](pyproject.toml) for all linters.
### Tox
See [tox](pyproject.toml) for all test environments.

To run a specific linter:
To run all:
```sh
tox -e flake8
tox
```

### Test
To run a specific environment:
```sh
tox -e py311
```

### Document
To generate documentation:
```sh
cd docs
make clean html
tox -e docs
```

The HTML pages are in build/html.
The HTML pages are in docs/build/html.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ prune .github
prune docs
exclude .readthedocs.yaml
exclude MANIFEST.in
include LICENSE
212 changes: 31 additions & 181 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,190 +29,40 @@ Convert Gregorian to Jewish dates and get Shabbos / Yom Tov details for Diaspora



.. include_content_start
.. include_quickstart_start

Installation
============
Quickstart
----------

Install with pip:

.. code-block:: bash

pip install jewcal

Usage
=====

Diaspora
--------

.. code-block:: python

>>> from datetime import date
>>> from jewcal import JewCal

>>> jewcal = JewCal(date(2022, 4, 17))
>>> print(jewcal)
16 Nisan 5782
>>> print(repr(jewcal))
JewCal(year=5782, month=1, day=16, gregorian_date=datetime.date(2022, 4, 17),
shabbos=None, yomtov='Pesach 2', category='Havdalah', diaspora=True)


Israel
------

.. code-block:: python

>>> from datetime import date
>>> from jewcal import JewCal

>>> jewcal = JewCal(date(2022, 4, 17), diaspora=False)
>>> print(jewcal)
16 Nisan 5782
>>> print(repr(jewcal))
JewCal(year=5782, month=1, day=16, gregorian_date=datetime.date(2022, 4, 17),
shabbos=None, yomtov='Chol HaMoed 1 (Pesach 2)', category=None, diaspora=False)



Possible values
===============

Shabbos
-------

+---------------------+----------------------+
| ``jewcal.shabbos`` | ``jewcal.category`` |
+=====================+======================+
| ``None`` | ``None`` |
+---------------------+----------------------+
| Erev Shabbos | Candles |
+---------------------+----------------------+
| Shabbos | Havdalah |
+---------------------+----------------------+


Yom Tov
-------

Diaspora
~~~~~~~~

+---------------------------+----------------------+
|``jewcal.yomtov`` | ``jewcal.category`` |
+===========================+======================+
| ``None`` | ``None`` |
+---------------------------+----------------------+
| Erev Rosh Hashana | Candles |
+---------------------------+----------------------+
| Rosh Hashana 1 | Candles |
+---------------------------+----------------------+
| Rosh Hashana 2 | Havdalah |
+---------------------------+----------------------+
| Erev Yom Kippur | Candles |
+---------------------------+----------------------+
| Yom Kippur | Havdalah |
+---------------------------+----------------------+
| Erev Sukkos | Candles |
+---------------------------+----------------------+
| Sukkos 1 | Candles |
+---------------------------+----------------------+
| Sukkos 2 | Havdalah |
+---------------------------+----------------------+
| Chol HaMoed 1 (Sukkos 3) | ``None`` |
+---------------------------+----------------------+
| Chol HaMoed 2 (Sukkos 4) | ``None`` |
+---------------------------+----------------------+
| Chol HaMoed 3 (Sukkos 5) | ``None`` |
+---------------------------+----------------------+
| Chol HaMoed 4 (Sukkos 6) | ``None`` |
+---------------------------+----------------------+
| Hoshana Rabba (Sukkos 7) | Candles |
+---------------------------+----------------------+
| Shmini Atzeres (Sukkos 8) | Candles |
+---------------------------+----------------------+
| Simchas Tora | Havdalah |
+---------------------------+----------------------+
| Erev Pesach | Candles |
+---------------------------+----------------------+
| Pesach 1 | Candles |
+---------------------------+----------------------+
| Pesach 2 | Havdalah |
+---------------------------+----------------------+
| Chol HaMoed 1 (Pesach 3) | ``None`` |
+---------------------------+----------------------+
| Chol HaMoed 2 (Pesach 4) | ``None`` |
+---------------------------+----------------------+
| Chol HaMoed 3 (Pesach 5) | ``None`` |
+---------------------------+----------------------+
| Chol HaMoed 4 (Pesach 6) | Candles |
+---------------------------+----------------------+
| Pesach 7 | Candles |
+---------------------------+----------------------+
| Pesach 8 | Havdalah |
+---------------------------+----------------------+
| Erev Shavuos | Candles |
+---------------------------+----------------------+
| Shavuos 1 | Candles |
+---------------------------+----------------------+
| Shavuos 2 | Havdalah |
+---------------------------+----------------------+


Israel
~~~~~~

+-------------------------------+----------------------+
|``jewcal.yomtov`` |``jewcal.category`` |
+===============================+======================+
| ``None`` | ``None`` |
+-------------------------------+----------------------+
| Erev Rosh Hashana | Candles |
+-------------------------------+----------------------+
| Rosh Hashana 1 | Candles |
+-------------------------------+----------------------+
| Rosh Hashana 2 | Havdalah |
+-------------------------------+----------------------+
| Erev Yom Kippur | Candles |
+-------------------------------+----------------------+
| Yom Kippur | Havdalah |
+-------------------------------+----------------------+
| Erev Sukkot | Candles |
+-------------------------------+----------------------+
| Sukkot 1 | Havdalah |
+-------------------------------+----------------------+
| Chol HaMoed 1 (Sukkot 2) | ``None`` |
+-------------------------------+----------------------+
| Chol HaMoed 2 (Sukkot 3) | ``None`` |
+-------------------------------+----------------------+
| Chol HaMoed 3 (Sukkot 4) | ``None`` |
+-------------------------------+----------------------+
| Chol HaMoed 4 (Sukkot 5) | ``None`` |
+-------------------------------+----------------------+
| Chol HaMoed 5 (Sukkot 6) | ``None`` |
+-------------------------------+----------------------+
| Hoshana Rabba (Sukkot 7) | Candles |
+-------------------------------+----------------------+
| Shmini Atzeret / Simchat Tora | Havdalah |
+-------------------------------+----------------------+
| Erev Pesach | Candles |
+-------------------------------+----------------------+
| Pesach 1 | Havdalah |
+-------------------------------+----------------------+
| Chol HaMoed 1 (Pesach 2) | ``None`` |
+-------------------------------+----------------------+
| Chol HaMoed 2 (Pesach 3) | ``None`` |
+-------------------------------+----------------------+
| Chol HaMoed 3 (Pesach 4) | ``None`` |
+-------------------------------+----------------------+
| Chol HaMoed 4 (Pesach 5) | ``None`` |
+-------------------------------+----------------------+
| Chol HaMoed 5 (Pesach 6) | Candles |
+-------------------------------+----------------------+
| Pesach 7 | Havdalah |
+-------------------------------+----------------------+
| Erev Shavuot | Candles |
+-------------------------------+----------------------+
| Shavuot | Havdalah |
+-------------------------------+----------------------+

.. include_content_end

Run in the console:

.. code-block:: bash

jewcal


The output:

.. code-block:: console

Today is 18 Cheshvan 5784

JewCal(year=5784, month=8, day=18, gregorian_date=datetime.date(2023, 11, 2),
shabbos=None, yomtov=None, category=None, diaspora=True)


.. include_quickstart_end


Resources
---------

- `JewCal @ PyPI <https://pypi.org/project/jewcal/>`_
- `JewCal @ Read the Docs <https://jewcal.readthedocs.io/>`_
1 change: 0 additions & 1 deletion docs/source/README.rst

This file was deleted.

Loading
Loading