ics-query 0.1.dev8__tar.gz → 0.1.1a0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/.github/workflows/tests.yml +2 -15
  2. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/.gitignore +1 -0
  3. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/PKG-INFO +173 -13
  4. ics_query-0.1.1a0/README.md +249 -0
  5. ics_query-0.1.1a0/ics-query +1 -0
  6. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/ics_query/_version.py +2 -2
  7. ics_query-0.1.1a0/ics_query/cli.py +260 -0
  8. ics_query-0.1.1a0/ics_query/parse.py +50 -0
  9. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/ics_query/tests/conftest.py +24 -12
  10. ics_query-0.1.1a0/ics_query/tests/runs/at 2019-03-04 multiple-calendars.ics -.run +20 -0
  11. ics_query-0.1.1a0/ics_query/tests/runs/at 2019-03-04 one-event-twice.ics -.run +18 -0
  12. ics_query-0.1.1a0/ics_query/tests/runs/at 2019-03-07 multiple-calendars.ics -.run +11 -0
  13. ics_query-0.1.1a0/ics_query/tests/runs/calendars/multiple-calendars.ics +71 -0
  14. ics_query-0.1.1a0/ics_query/tests/runs/calendars/one-event-twice.ics +68 -0
  15. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/ics_query/tests/test_command_line.py +9 -0
  16. ics_query-0.1.1a0/ics_query/tests/test_parse_date.py +63 -0
  17. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/pyproject.toml +5 -2
  18. ics_query-0.1.dev8/README.md +0 -92
  19. ics_query-0.1.dev8/ics_query/cli.py +0 -92
  20. ics_query-0.1.dev8/ics_query/parse.py +0 -13
  21. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/.github/FUNDING.yml +0 -0
  22. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  23. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/.github/dependabot.yml +0 -0
  24. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/LICENSE +0 -0
  25. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/ics_query/__init__.py +0 -0
  26. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/ics_query/__main__.py +0 -0
  27. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/ics_query/tests/__init__.py +0 -0
  28. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/ics_query/tests/runs/at 2019-03-04 one-event.ics -.run +0 -0
  29. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/ics_query/tests/runs/calendars/one-event.ics +0 -0
  30. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/ics_query/version.py +0 -0
  31. {ics_query-0.1.dev8 → ics_query-0.1.1a0}/tox.ini +0 -0
@@ -56,7 +56,7 @@ jobs:
56
56
  # see https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
57
57
  environment:
58
58
  name: PyPI
59
- url: https://pypi.org/project/open-web-calendar/
59
+ url: https://pypi.org/project/ics-query/
60
60
  # after using the environment, we need to make the secrets available
61
61
  # see https://docs.github.com/en/actions/security-guides/encrypted-secrets#example-using-bash
62
62
  env:
@@ -72,18 +72,6 @@ jobs:
72
72
  run: |
73
73
  python -m pip install --upgrade pip
74
74
  pip install --upgrade wheel twine build
75
- # - name: Check the tag
76
- # run: |
77
- # PACKAGE_VERSION=`python setup.py --version`
78
- # TAG_NAME=v$PACKAGE_VERSION
79
- # echo "Package version $PACKAGE_VERSION with possible tag name $TAG_NAME on $GITHUB_REF_NAME"
80
- # # test that the tag represents the version
81
- # # see https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
82
- # # see https://docs.github.com/en/actions/learn-github-actions/environment-variables
83
- # if [ "$TAG_NAME" != "$GITHUB_REF_NAME" ]; then
84
- # echo "ERROR: This tag is for the wrong version. Got \"$GITHUB_REF_NAME\" expected \"$TAG_NAME\"."
85
- # exit 1
86
- # fi
87
75
  - name: remove old files
88
76
  run: rm -rf dist/*
89
77
  - name: build distribution files
@@ -113,7 +101,6 @@ jobs:
113
101
  if: ${{ startsWith(github.ref, 'refs/tags/v') }}
114
102
  needs:
115
103
  - run-tests
116
- - dockerhub
117
104
  - deploy-tag-to-pypi
118
105
  runs-on: ubuntu-latest
119
106
  steps:
@@ -122,5 +109,5 @@ jobs:
122
109
  uses: ncipollo/release-action@v1
123
110
  with:
124
111
  allowUpdates: true
125
- body: "For a list of changes, please refer to the [Changelog](https://open-web-calendar.quelltext.eu/changelog/)."
112
+ body: "For a list of changes, please refer to the [Changelog](https://github.com/niccokunzmann/ics-query#changelog)."
126
113
  generateReleaseNotes: false
@@ -160,3 +160,4 @@ cython_debug/
160
160
  # and can be added to the global gitignore or merged into this file. For a more nuclear
161
161
  # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
162
  #.idea/
163
+ ics_query/_version.py
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ics-query
3
- Version: 0.1.dev8
4
- Summary: Find out what happens in ICS calendar files - query and filter RFC 5545 compatible `.ics` files for events, journals, TODOs and more.
3
+ Version: 0.1.1a0
4
+ Summary: Find out what happens in ICS calendar files - query and filter RFC 5545 compatible .ics files for events, journals, TODOs and more.
5
5
  Project-URL: Homepage, https://github.com/niccokunzmann/ics-query/
6
6
  Project-URL: Repository, https://github.com/niccokunzmann/ics-query/
7
- Project-URL: source_archive, https://github.com/niccokunzmann/ics-query/archive/3f1c4acd60666416eb899f7a0c07a05999d443c3.zip
7
+ Project-URL: source_archive, https://github.com/niccokunzmann/ics-query/archive/fb12ef2822d23f693aa5f9faaa0cb97fa9f67516.zip
8
8
  Project-URL: Issues, https://github.com/niccokunzmann/ics-query/issues
9
9
  Project-URL: Documentation, https://github.com/niccokunzmann/ics-query/
10
10
  Project-URL: Changelog, https://github.com/niccokunzmann/ics-query/#changelog
@@ -690,7 +690,10 @@ Classifier: Development Status :: 3 - Alpha
690
690
  Classifier: Intended Audience :: Developers
691
691
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
692
692
  Classifier: Operating System :: OS Independent
693
- Classifier: Programming Language :: Python :: 3
693
+ Classifier: Programming Language :: Python :: 3.9
694
+ Classifier: Programming Language :: Python :: 3.10
695
+ Classifier: Programming Language :: Python :: 3.11
696
+ Classifier: Programming Language :: Python :: 3.12
694
697
  Classifier: Topic :: Office/Business :: Scheduling
695
698
  Requires-Python: >=3.8
696
699
  Requires-Dist: click
@@ -713,7 +716,79 @@ You can install this package from the [PyPI](https://pypi.org/project/ics-query/
713
716
  pip install ics-query
714
717
  ```
715
718
 
716
- ## `ics-query at` - occurrences at certain times
719
+ ## Usage
720
+
721
+ See how to use `ics-query`.
722
+
723
+ ### Examples
724
+
725
+ You can easily get a calendar from the web and see what is on.
726
+ In this example, we show which German National Holidays happen in August 2024:
727
+
728
+ ```shell
729
+ $ wget -qO- 'https://www.calendarlabs.com/ical-calendar/ics/46/Germany_Holidays.ics' | ./ics-query at 2024-08 - -
730
+ BEGIN:VEVENT
731
+ SUMMARY:Assumption Day (BY\, SL)
732
+ DTSTART;VALUE=DATE:20240815
733
+ DTEND;VALUE=DATE:20240815
734
+ DTSTAMP:20231013T092513Z
735
+ UID:65290cf9326601697189113@calendarlabs.com
736
+ SEQUENCE:0
737
+ DESCRIPTION:Visit https://calendarlabs.com/holidays/us/the-assumption-of-m
738
+ ary.php to know more about Assumption Day (BY\, SL). \n\n Like us on Faceb
739
+ ook: http://fb.com/calendarlabs to get updates
740
+ LOCATION:Germany
741
+ STATUS:CONFIRMED
742
+ TRANSP:TRANSPARENT
743
+ END:VEVENT
744
+ ```
745
+
746
+ In the following example, we query a calendar file and print the result.
747
+
748
+ ```shell
749
+ $ ics-query at 2019-03-04 one-event.ics -
750
+ BEGIN:VEVENT
751
+ SUMMARY:test1
752
+ DTSTART;TZID=Europe/Berlin:20190304T080000
753
+ DTEND;TZID=Europe/Berlin:20190304T083000
754
+ DTSTAMP:20190303T111937
755
+ UID:UYDQSG9TH4DE0WM3QFL2J
756
+ CREATED:20190303T111937
757
+ LAST-MODIFIED:20190303T111937
758
+ END:VEVENT
759
+ ```
760
+
761
+ We can concatenate calendars and pipe them into `ics-query`.
762
+ In the example below, we get all events that happen right now in two calendars.
763
+
764
+ ```shell
765
+ $ cat calendar1.ics calendar2.ics | ics-query at `date +%Y%m%d%H%M%S` - -
766
+ BEGIN:VEVENT
767
+ ...
768
+ ```
769
+
770
+ ### Events at Certain Times
771
+
772
+ You can query which events happen at certain times:
773
+
774
+ ```shell
775
+ ics-query at <date-time> calendar.ics -
776
+ ```
777
+
778
+ `<date-time>` can be built up: It can be a year, a month, a day, an hour, a minute or a second.
779
+
780
+ Please see the command documentation for more help:
781
+
782
+ ```shell
783
+ ics-query --help
784
+ ics-query at --help
785
+ ```
786
+
787
+ ## Vision
788
+
789
+ This section shows where we would like to get to.
790
+
791
+ ### `ics-query at` - occurrences at certain times
717
792
 
718
793
  You can get all **events** that happen at a certain **day**.
719
794
 
@@ -733,32 +808,32 @@ You can get all **TODO**s that happen at in certain **month**.
733
808
  ics-query --components VTODO at 2029-12-24 calendar.ics
734
809
  ```
735
810
 
736
- ## `ics-query at` - time ranges
811
+ ### `ics-query at` - time ranges
737
812
 
738
813
 
739
- ## `ics-query --output=count` - count occurrences
814
+ ### `ics-query --output=count` - count occurrences
740
815
 
741
816
 
742
- ## `ics-query --output=ics` - use ics as output (default)
817
+ ### `ics-query --output=ics` - use ics as output (default)
743
818
 
744
819
 
745
- ## `ics-query --select-index` - reduce output size
820
+ ### `ics-query --select-index` - reduce output size
746
821
 
747
822
  Examples: `0,2,4` `0-10`
748
823
 
749
- ## `ics-query all` - the whole calendar
824
+ ### `ics-query all` - the whole calendar
750
825
 
751
- ## `ics-query between` - time ranges
826
+ ### `ics-query between` - time ranges
752
827
 
753
828
  ```shell
754
829
  ics-query between dt dt
755
830
  ics-query between dt duration
756
831
  ```
757
832
 
758
- ## `ics-query --select-component` - filter for components
833
+ ### `ics-query --select-component` - filter for components
759
834
 
760
835
 
761
- ## `ics-query --select-uid` - filter by uid
836
+ ### `ics-query --select-uid` - filter by uid
762
837
 
763
838
 
764
839
  ## How to edit an event
@@ -787,8 +862,93 @@ Examples:
787
862
  - There are x events today
788
863
  - Please write a journal entry!
789
864
 
865
+ ## Version Fixing
866
+
867
+ If you use this library in your code, you may want to make sure that
868
+ updates can be received but they do not break your code.
869
+ The version numbers are handeled this way: `a.b.c` example: `0.1.12`
870
+
871
+ - `c` is changed for each minor bug fix.
872
+ - `b` is changed whenever new features are added.
873
+ - `a` is changed when the interface or major assumptions change that may break your code.
874
+
875
+ So, I recommend to version-fix this library to stay with the same `a`
876
+ while `b` and `c` can change.
877
+
878
+ ## Development
879
+
880
+ This section should set you up for development.
881
+
882
+ ### Testing
883
+
884
+ This project's development is driven by tests.
885
+ Tests assure a consistent interface and less knowledge lost over time.
886
+ If you like to change the code, tests help that nothing breaks in the future.
887
+ They are required in that sense.
888
+ Example code and ics files can be transferred into tests and speed up fixing bugs.
889
+
890
+ You can view the tests in the [test folder](https://github.com/niccokunzmann/ics-query/tree/main/ics_query/tests)
891
+ If you have a calendar ICS file for which this library does not
892
+ generate the desired output, you can add it to the ``test/calendars``
893
+ folder and write tests for what you expect.
894
+ If you like, [open an issue](https://github.com/niccokunzmann/ics-query/issues) first, e.g. to discuss the changes and
895
+ how to go about it.
896
+
897
+ To run the tests, we use `tox`.
898
+ `tox` tests all different Python versions which we want to be compatible to.
899
+
900
+ ```shell
901
+ pip3 install tox
902
+ ```
903
+
904
+ To run all the tests:
905
+
906
+ ```shell
907
+ tox
908
+ ```
909
+
910
+ To run the tests in a specific Python version:
911
+
912
+ ```shell
913
+ tox -e py39
914
+ ```
915
+
916
+ We use ``ruff`` to format the code.
917
+ Run this to format the code and show problems:
918
+
919
+ ```shell
920
+ tox -e ruff
921
+ ```
922
+
923
+ ## New Release
924
+
925
+ To release new versions,
926
+
927
+ 1. edit the Changelog Section
928
+ 2. create a commit and push it
929
+ 3. wait for [GitHub Actions](https://github.com/niccokunzmann/ics-query/actions) to finish the build
930
+ 4. create a tag and push it
931
+
932
+ ```shell
933
+ git tag v0.1.0a
934
+ git push origin v0.1.0a
935
+ ```
936
+
937
+ 5. Notify the issues about their release
938
+
790
939
  ## Changelog
791
940
 
941
+ - v0.1.1a
942
+
943
+ - Add `--version`
944
+ - Add `ics-query at <date>`
945
+ - Add support for multiple calendars in one input
946
+
947
+ - v0.1.0a
948
+
949
+ - Update Python version compatibility
950
+ - Add development documentation
951
+
792
952
  - v0.0.1a
793
953
 
794
954
  - first version
@@ -0,0 +1,249 @@
1
+ # ics-query
2
+
3
+ <!-- Change description also in pyproject.toml -->
4
+ Find out what happens in ICS calendar files - query and filter RFC 5545 compatible `.ics` files for events, journals, TODOs and more.
5
+
6
+ ## Installation
7
+
8
+ You can install this package from the [PyPI](https://pypi.org/project/ics-query/).
9
+
10
+ ```shell
11
+ pip install ics-query
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ See how to use `ics-query`.
17
+
18
+ ### Examples
19
+
20
+ You can easily get a calendar from the web and see what is on.
21
+ In this example, we show which German National Holidays happen in August 2024:
22
+
23
+ ```shell
24
+ $ wget -qO- 'https://www.calendarlabs.com/ical-calendar/ics/46/Germany_Holidays.ics' | ./ics-query at 2024-08 - -
25
+ BEGIN:VEVENT
26
+ SUMMARY:Assumption Day (BY\, SL)
27
+ DTSTART;VALUE=DATE:20240815
28
+ DTEND;VALUE=DATE:20240815
29
+ DTSTAMP:20231013T092513Z
30
+ UID:65290cf9326601697189113@calendarlabs.com
31
+ SEQUENCE:0
32
+ DESCRIPTION:Visit https://calendarlabs.com/holidays/us/the-assumption-of-m
33
+ ary.php to know more about Assumption Day (BY\, SL). \n\n Like us on Faceb
34
+ ook: http://fb.com/calendarlabs to get updates
35
+ LOCATION:Germany
36
+ STATUS:CONFIRMED
37
+ TRANSP:TRANSPARENT
38
+ END:VEVENT
39
+ ```
40
+
41
+ In the following example, we query a calendar file and print the result.
42
+
43
+ ```shell
44
+ $ ics-query at 2019-03-04 one-event.ics -
45
+ BEGIN:VEVENT
46
+ SUMMARY:test1
47
+ DTSTART;TZID=Europe/Berlin:20190304T080000
48
+ DTEND;TZID=Europe/Berlin:20190304T083000
49
+ DTSTAMP:20190303T111937
50
+ UID:UYDQSG9TH4DE0WM3QFL2J
51
+ CREATED:20190303T111937
52
+ LAST-MODIFIED:20190303T111937
53
+ END:VEVENT
54
+ ```
55
+
56
+ We can concatenate calendars and pipe them into `ics-query`.
57
+ In the example below, we get all events that happen right now in two calendars.
58
+
59
+ ```shell
60
+ $ cat calendar1.ics calendar2.ics | ics-query at `date +%Y%m%d%H%M%S` - -
61
+ BEGIN:VEVENT
62
+ ...
63
+ ```
64
+
65
+ ### Events at Certain Times
66
+
67
+ You can query which events happen at certain times:
68
+
69
+ ```shell
70
+ ics-query at <date-time> calendar.ics -
71
+ ```
72
+
73
+ `<date-time>` can be built up: It can be a year, a month, a day, an hour, a minute or a second.
74
+
75
+ Please see the command documentation for more help:
76
+
77
+ ```shell
78
+ ics-query --help
79
+ ics-query at --help
80
+ ```
81
+
82
+ ## Vision
83
+
84
+ This section shows where we would like to get to.
85
+
86
+ ### `ics-query at` - occurrences at certain times
87
+
88
+ You can get all **events** that happen at a certain **day**.
89
+
90
+ ```shell
91
+ ics-query --components VEVENT at 2029-12-24 calendar.ics
92
+ ```
93
+
94
+ You can get all **events** that happen **today**.
95
+
96
+ ```shell
97
+ ics-query --components VEVENT at `date +%Y-%m-%d` calendar.ics
98
+ ```
99
+
100
+ You can get all **TODO**s that happen at in certain **month**.
101
+
102
+ ```shell
103
+ ics-query --components VTODO at 2029-12-24 calendar.ics
104
+ ```
105
+
106
+ ### `ics-query at` - time ranges
107
+
108
+
109
+ ### `ics-query --output=count` - count occurrences
110
+
111
+
112
+ ### `ics-query --output=ics` - use ics as output (default)
113
+
114
+
115
+ ### `ics-query --select-index` - reduce output size
116
+
117
+ Examples: `0,2,4` `0-10`
118
+
119
+ ### `ics-query all` - the whole calendar
120
+
121
+ ### `ics-query between` - time ranges
122
+
123
+ ```shell
124
+ ics-query between dt dt
125
+ ics-query between dt duration
126
+ ```
127
+
128
+ ### `ics-query --select-component` - filter for components
129
+
130
+
131
+ ### `ics-query --select-uid` - filter by uid
132
+
133
+
134
+ ## How to edit an event
135
+
136
+ To edit a component like an event, you can append it to the calendar and increase the sequence number.
137
+
138
+ Example:
139
+
140
+ 1. get the first event `--select-index=0` TODO: recurring-ical-events: set recurrence-id, sequence number
141
+ 2. change the summary
142
+ 3. increase sequence number
143
+ 4. add the event to the end of the calendar file
144
+ 5. show that the occurrence has changed
145
+
146
+ ## Piping calendars
147
+
148
+ ```shell
149
+ cat calendar.ics | ics-query --output=count --filter-component=VEVENT all > calendar-event-count.int
150
+ ```
151
+
152
+ ## Notifications
153
+
154
+ Examples:
155
+
156
+ - There are x todos in the next hour
157
+ - There are x events today
158
+ - Please write a journal entry!
159
+
160
+ ## Version Fixing
161
+
162
+ If you use this library in your code, you may want to make sure that
163
+ updates can be received but they do not break your code.
164
+ The version numbers are handeled this way: `a.b.c` example: `0.1.12`
165
+
166
+ - `c` is changed for each minor bug fix.
167
+ - `b` is changed whenever new features are added.
168
+ - `a` is changed when the interface or major assumptions change that may break your code.
169
+
170
+ So, I recommend to version-fix this library to stay with the same `a`
171
+ while `b` and `c` can change.
172
+
173
+ ## Development
174
+
175
+ This section should set you up for development.
176
+
177
+ ### Testing
178
+
179
+ This project's development is driven by tests.
180
+ Tests assure a consistent interface and less knowledge lost over time.
181
+ If you like to change the code, tests help that nothing breaks in the future.
182
+ They are required in that sense.
183
+ Example code and ics files can be transferred into tests and speed up fixing bugs.
184
+
185
+ You can view the tests in the [test folder](https://github.com/niccokunzmann/ics-query/tree/main/ics_query/tests)
186
+ If you have a calendar ICS file for which this library does not
187
+ generate the desired output, you can add it to the ``test/calendars``
188
+ folder and write tests for what you expect.
189
+ If you like, [open an issue](https://github.com/niccokunzmann/ics-query/issues) first, e.g. to discuss the changes and
190
+ how to go about it.
191
+
192
+ To run the tests, we use `tox`.
193
+ `tox` tests all different Python versions which we want to be compatible to.
194
+
195
+ ```shell
196
+ pip3 install tox
197
+ ```
198
+
199
+ To run all the tests:
200
+
201
+ ```shell
202
+ tox
203
+ ```
204
+
205
+ To run the tests in a specific Python version:
206
+
207
+ ```shell
208
+ tox -e py39
209
+ ```
210
+
211
+ We use ``ruff`` to format the code.
212
+ Run this to format the code and show problems:
213
+
214
+ ```shell
215
+ tox -e ruff
216
+ ```
217
+
218
+ ## New Release
219
+
220
+ To release new versions,
221
+
222
+ 1. edit the Changelog Section
223
+ 2. create a commit and push it
224
+ 3. wait for [GitHub Actions](https://github.com/niccokunzmann/ics-query/actions) to finish the build
225
+ 4. create a tag and push it
226
+
227
+ ```shell
228
+ git tag v0.1.0a
229
+ git push origin v0.1.0a
230
+ ```
231
+
232
+ 5. Notify the issues about their release
233
+
234
+ ## Changelog
235
+
236
+ - v0.1.1a
237
+
238
+ - Add `--version`
239
+ - Add `ics-query at <date>`
240
+ - Add support for multiple calendars in one input
241
+
242
+ - v0.1.0a
243
+
244
+ - Update Python version compatibility
245
+ - Add development documentation
246
+
247
+ - v0.0.1a
248
+
249
+ - first version
@@ -0,0 +1 @@
1
+ .venv/bin/ics-query
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.1.dev8'
16
- __version_tuple__ = version_tuple = (0, 1, 'dev8')
15
+ __version__ = version = '0.1.1a0'
16
+ __version_tuple__ = version_tuple = (0, 1, 1)