Skip to content

Commit

Permalink
camply 0.1.8 (#33)
Browse files Browse the repository at this point in the history
* docker-compose.yml example

* feature/booking nights (#25)

* feature progress

* campsite compilation

* silent notification dash

* flaking

* polish

* README.md tidy

* test update

* bugfix: filter dates before compiling nights

* consecutive booking nights

* Date Update on CHANGELOG.md

* typo fix
  • Loading branch information
juftin authored Jul 20, 2021
1 parent 41ecad7 commit 7abd143
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 46 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ jobs:
camply recreation-areas --search "Yosemite National Park"
camply campgrounds --rec-area 2991
camply campgrounds --search "Fire Tower Lookout" --state CA
camply campsites --rec-area 2991 --start-date 2021-09-15 --end-date 2021-09-16
camply campsites --campground 252037 --start-date 2021-09-15 --end-date 2021-09-16
camply campsites --rec-area 2991 --start-date 2021-09-15 --end-date 2021-09-17
camply campsites --campground 252037 --start-date 2021-09-15 --end-date 2021-09-17
camply campsites --yml-config tests/yml/example_search.yml
camply campsites --campground 232045 --start-date 2021-07-15 --end-date 2021-09-30 --nights 5
camply campsites --provider yellowstone --start-date 2021-10-10 --end-date 2021-10-15 --nights 2
camply campsites --campground 232045 --start-date 2021-07-15 --end-date 2021-10-01 --nights 5
camply campsites --provider yellowstone --start-date 2021-10-10 --end-date 2021-10-16
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ To request new features or bugfixes the
[Camply Feedback for v1.0.0 Discussion](https://github.com/juftin/camply/discussions/12) is the best
place to go.

## [0.1.8] - 2021-07-20

### Added

- Converted `End Date` to be the checkout date instead of the final camping date.

## [0.1.7] - 2021-06-24

### Fixed
Expand Down Expand Up @@ -88,6 +94,8 @@ place to go.

[unreleased]: https://github.com/juftin/camply/compare/main...integration

[0.1.8]: https://github.com/juftin/camply/compare/v0.1.7...v0.1.8

[0.1.7]: https://github.com/juftin/camply/compare/v0.1.6...v0.1.7

[0.1.6]: https://github.com/juftin/camply/compare/v0.1.5...v0.1.6
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:3.8-slim

MAINTAINER Justin Flannery <juftin@juftin.com>
LABEL version="0.1.7"
LABEL version="0.1.8"
LABEL description="camply, the campsite finder"

COPY . /tmp/camply
Expand Down
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ and a link to make the booking. Required parameters include `--start-date`, `--e
+ `YYYY-MM-DD`: Start of Search window. You will be arriving this day.
[**_example_](#searching-for-a-campsite)
* `--end-date`: `END_DATE`
+ `YYYY-MM-DD`: End of Search window. You will be leaving the following day.
+ `YYYY-MM-DD`: End of Search window. You will be checking out this day..
[**_example_](#searching-for-a-campsite)
* `--weekends`
+ Only search for weekend bookings (Fri/Sat nights).
Expand Down Expand Up @@ -180,7 +180,7 @@ and a link to make the booking. Required parameters include `--start-date`, `--e
camply campsites \
--rec-area 2725 \
--start-date 2021-07-10 \
--end-date 2021-07-17
--end-date 2021-07-18
```

### `recreation-areas`
Expand Down Expand Up @@ -257,7 +257,7 @@ after `--end-date`.
camply campsites \
--rec-area 2725 \
--start-date 2021-07-10 \
--end-date 2021-07-17
--end-date 2021-07-18
```

#### Searching for a Campsite by Campground ID
Expand All @@ -272,7 +272,7 @@ camply campsites \
--campground 251869 \
--campground 232492 \
--start-date 2021-07-10 \
--end-date 2021-07-17
--end-date 2021-07-18
```

#### Continuously Searching for A Campsite
Expand All @@ -292,7 +292,7 @@ this behavior and send all notifications, pass the `--notify-first-try` argument
camply campsites \
--rec-area 2725 \
--start-date 2021-07-12 \
--end-date 2021-07-12 \
--end-date 2021-07-13 \
--continuous \
--notifications pushover \
--notify-first-try
Expand All @@ -310,7 +310,7 @@ problematic when certain campsites become available more than once.
camply campsites \
--rec-area 2725 \
--start-date 2021-07-01 \
--end-date 2021-07-31 \
--end-date 2021-08-01 \
--continuous \
--notifications pushover \
--search-forever
Expand All @@ -330,7 +330,7 @@ command) or though environment variables (`PUSHBULLET_API_TOKEN`).
camply campsites \
--rec-area 2991 \
--start-date 2021-09-10 \
--end-date 2021-09-20 \
--end-date 2021-09-21 \
--continuous \
--notifications pushbullet
```
Expand All @@ -345,7 +345,7 @@ checks every 5 minutes instead of the default 10 minutes.
camply campsites \
--rec-area 2991 \
--start-date 2021-05-01 \
--end-date 2021-07-31 \
--end-date 2021-08-01 \
--weekends \
--continuous \
--notifications email \
Expand All @@ -366,7 +366,7 @@ more than this your `--nights` parameter will be overwritten to 2.
camply campsites \
--rec-area 2991 \
--start-date 2021-05-01 \
--end-date 2021-07-31 \
--end-date 2021-08-01 \
--nights 4
```

Expand All @@ -383,7 +383,7 @@ this [discussion](https://github.com/juftin/camply/discussions/15#discussioncomm
camply campsites \
--provider yellowstone \
--start-date 2021-07-09 \
--end-date 2021-07-16 \
--end-date 2021-07-17 \
--continuous
```

Expand All @@ -398,7 +398,7 @@ camply campsites \
--rec-area 2991 \
--rec-area 1074 \
--start-date 2021-07-09 \
--end-date 2021-07-16 \
--end-date 2021-07-17 \
--nights 5
```

Expand All @@ -414,7 +414,7 @@ recreation_area: # (LIST OR SINGLE ENTRY)
- 1074 # Sierra National Forest, CA (All Campgrounds)
campgrounds: null # ENTIRE FIELD CAN BE OMITTED IF NOT USED. # (LIST OR SINGLE ENTRY)
start_date: 2021-09-12 # YYYY-MM-DD
end_date: 2021-09-12 # YYYY-MM-DD
end_date: 2021-09-13 # YYYY-MM-DD
weekends: False # FALSE BY DEFAULT
nights: 1 # 1 BY DEFAULT
continuous: True # DEFAULTS TO TRUE
Expand Down Expand Up @@ -565,7 +565,7 @@ docker run -d \
camply campsites \
--rec-area 2991 \
--start-date 2021-08-01 \
--end-date 2021-08-31 \
--end-date 2021-09-01 \
--continuous \
--notifications pushover
```
Expand Down Expand Up @@ -602,7 +602,7 @@ docker run \
camply campsites \
--provider yellowstone \
--start-date 2021-07-22 \
--end-date 2021-07-26 \
--end-date 2021-07-27 \
--continuous \
--notifications email
```
Expand Down Expand Up @@ -646,6 +646,10 @@ dependencies:
- [PyYAML](https://pyyaml.org/)
- PyYAML is a YAML parsing library - this helps with the YAML file campsite searches.

<br/>

Recreation data provided by [**Recreation.gov**](https://ridb.recreation.gov/)

___________
___________

Expand Down
2 changes: 1 addition & 1 deletion camply/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
camply __init__ file
"""

__version__ = "0.1.7"
__version__ = "0.1.8"
2 changes: 1 addition & 1 deletion camply/config/cli_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CommandLineArguments:

END_DATE_ARGUMENT: str = "--end-date"
END_DATE_DESTINATION: str = "end_date"
END_DATE_HELP: str = "(YYYY-MM-DD) End of Search window. You will be leaving the following day."
END_DATE_HELP: str = "(YYYY-MM-DD) End of Search window. You will be checking out this day."

WEEKENDS_ARGUMENT: str = "--weekends"
WEEKENDS_DESTINATION: str = "weekends"
Expand Down
12 changes: 6 additions & 6 deletions camply/search/base_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def _get_search_days(self) -> List[datetime]:
search_days = set()
for window in self.search_window:
generated_dates = set()
for index in range(0, (window.end_date - window.start_date).days + 1):
for index in range(0, (window.end_date - window.start_date).days):
search_day = window.start_date
search_day = search_day.replace(hour=0, minute=0, second=0,
microsecond=0) + timedelta(days=index)
Expand All @@ -383,7 +383,7 @@ def _get_search_days(self) -> List[datetime]:
search_days.remove(search_date)
number_searches = len(search_days)
if number_searches > 0:
logger.info(f"{len(search_days)} dates selected for search, "
logger.info(f"{len(search_days)} booking nights selected for search, "
f"ranging from {min(search_days).strftime('%Y-%m-%d')} to "
f"{max(search_days).strftime('%Y-%m-%d')}")
else:
Expand Down Expand Up @@ -426,7 +426,7 @@ def _consolidate_campsites(cls, campsite_df: DataFrame,
Returns
-------
DataFrame
List[AvailableCampsite]
"""
composed_groupings = list()
for _, campsite_slice in campsite_df.groupby(
Expand Down Expand Up @@ -508,7 +508,7 @@ def _find_consecutive_nights(cls, dataframe: DataFrame, nights: int) -> DataFram
concatted_data = [DataFrame()]
return concat(concatted_data, ignore_index=True)

def _validate_consecutive_nights(self, nights: int) -> None:
def _validate_consecutive_nights(self, nights: int) -> int:
"""
Validate the number of consecutive nights to search
Expand Down Expand Up @@ -594,7 +594,7 @@ def assemble_availabilities(cls, matching_data: List[AvailableCampsite], log: bo
return availability_df

@classmethod
def _log_availabilities(cls, availability_df: DataFrame, verbose: bool) -> None:
def _log_availabilities(cls, availability_df: DataFrame, verbose: bool) -> DataFrame:
"""
Log the Availabilities
Expand All @@ -605,7 +605,7 @@ def _log_availabilities(cls, availability_df: DataFrame, verbose: bool) -> None:
Returns
-------
None
DataFrame
"""
booking_date: datetime
for booking_date, available_sites in availability_df.groupby("booking_date"):
Expand Down
28 changes: 14 additions & 14 deletions docs/README.docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ docker run -d \
camply campsites \
--rec-area 2991 \
--start-date 2021-08-01 \
--end-date 2021-08-31 \
--end-date 2021-09-01 \
--continuous \
--notifications pushover
```
Expand Down Expand Up @@ -96,7 +96,7 @@ docker run \
camply campsites \
--provider yellowstone \
--start-date 2021-07-22 \
--end-date 2021-07-26 \
--end-date 2021-07-27 \
--continuous \
--notifications email
```
Expand Down Expand Up @@ -179,7 +179,7 @@ and a link to make the booking. Required parameters include `--start-date`, `--e
+ `YYYY-MM-DD`: Start of Search window. You will be arriving this day.
[**_example_](#searching-for-a-campsite)
* `--end-date`: `END_DATE`
+ `YYYY-MM-DD`: End of Search window. You will be leaving the following day.
+ `YYYY-MM-DD`: End of Search window. You will be checking out this day.
[**_example_](#searching-for-a-campsite)
* `--weekends`
+ Only search for weekend bookings (Fri/Sat nights).
Expand Down Expand Up @@ -224,7 +224,7 @@ and a link to make the booking. Required parameters include `--start-date`, `--e
camply campsites \
--rec-area 2725 \
--start-date 2021-07-10 \
--end-date 2021-07-17
--end-date 2021-07-18
```

### `recreation-areas`
Expand Down Expand Up @@ -301,7 +301,7 @@ after `--end-date`.
camply campsites \
--rec-area 2725 \
--start-date 2021-07-10 \
--end-date 2021-07-17
--end-date 2021-07-18
```

#### Searching for a Campsite by Campground ID
Expand All @@ -316,7 +316,7 @@ camply campsites \
--campground 251869 \
--campground 232492 \
--start-date 2021-07-10 \
--end-date 2021-07-17
--end-date 2021-07-18
```

#### Continuously Searching for A Campsite
Expand All @@ -336,7 +336,7 @@ this behavior and send all notifications, pass the `--notify-first-try` argument
camply campsites \
--rec-area 2725 \
--start-date 2021-07-12 \
--end-date 2021-07-12 \
--end-date 2021-07-13 \
--continuous \
--notifications pushover \
--notify-first-try
Expand All @@ -354,7 +354,7 @@ problematic when certain campsites become available more than once.
camply campsites \
--rec-area 2725 \
--start-date 2021-07-01 \
--end-date 2021-07-31 \
--end-date 2021-08-01 \
--continuous \
--notifications pushover \
--search-forever
Expand All @@ -374,7 +374,7 @@ command) or though environment variables (`PUSHBULLET_API_TOKEN`).
camply campsites \
--rec-area 2991 \
--start-date 2021-09-10 \
--end-date 2021-09-20 \
--end-date 2021-09-21 \
--continuous \
--notifications pushbullet
```
Expand All @@ -389,7 +389,7 @@ checks every 5 minutes instead of the default 10 minutes.
camply campsites \
--rec-area 2991 \
--start-date 2021-05-01 \
--end-date 2021-07-31 \
--end-date 2021-08-01 \
--weekends \
--continuous \
--notifications email \
Expand All @@ -410,7 +410,7 @@ more than this your `--nights` parameter will be overwritten to 2.
camply campsites \
--rec-area 2991 \
--start-date 2021-05-01 \
--end-date 2021-07-31 \
--end-date 2021-08-01 \
--nights 4
```

Expand All @@ -427,7 +427,7 @@ this [discussion](https://github.com/juftin/camply/discussions/15#discussioncomm
camply campsites \
--provider yellowstone \
--start-date 2021-07-09 \
--end-date 2021-07-16 \
--end-date 2021-07-17 \
--continuous
```

Expand All @@ -442,7 +442,7 @@ camply campsites \
--rec-area 2991 \
--rec-area 1074 \
--start-date 2021-07-09 \
--end-date 2021-07-16 \
--end-date 2021-07-17 \
--nights 5
```

Expand All @@ -458,7 +458,7 @@ recreation_area: # (LIST OR SINGLE ENTRY)
- 1074 # Sierra National Forest, CA (All Campgrounds)
campgrounds: null # ENTIRE FIELD CAN BE OMITTED IF NOT USED. # (LIST OR SINGLE ENTRY)
start_date: 2021-09-12 # YYYY-MM-DD
end_date: 2021-09-12 # YYYY-MM-DD
end_date: 2021-09-13 # YYYY-MM-DD
weekends: False # FALSE BY DEFAULT
nights: 1 # 1 BY DEFAULT
continuous: True # DEFAULTS TO TRUE
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/example_search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ recreation_area: # (LIST OR SINGLE ENTRY)
- 1074 # Sierra National Forest, CA (All Campgrounds)
campgrounds: null # OVERRIDES RECREATION AREA (LIST OR SINGLE ENTRY)
start_date: 2021-09-12 # YYYY-MM-DD
end_date: 2021-09-12 # YYYY-MM-DD
end_date: 2021-09-13 # YYYY-MM-DD
weekends: False # FALSE BY DEFAULT
nights: 1 # 1 BY DEFAULT
continuous: False # DEFAULTS TO TRUE
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "camply"
version = "0.1.7"
version = "0.1.8"
description = "camply, the campsite finder ⛺️"
authors = ["Justin Flannery <juftin@juftin.com>"]
maintainers = ["Justin Flannery <juftin@juftin.com>"]
Expand Down
Loading

0 comments on commit 7abd143

Please sign in to comment.