npdatetime 0.1.1__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.
@@ -0,0 +1,13 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [4mritGiri] # Your GitHub Sponsors username
4
+ patreon: 4mritGiri # Your Patreon username
5
+ open_collective: # Add your Open Collective username if applicable
6
+ ko_fi: 4mritGiri # Your Ko-fi username
7
+ tidelift: # Add your Tidelift package information
8
+ community_bridge: # Add your Community Bridge project name
9
+ liberapay: # Add your Liberapay username
10
+ issuehunt: # Add your IssueHunt username
11
+ otechie: # Add your Otechie username
12
+ lfx_crowdfunding: # Add your LFX Crowdfunding project name
13
+ custom: ['https://your-custom-sponsorship-link.com'] # Replace with your custom funding links
@@ -0,0 +1,22 @@
1
+ **/__pycache__/**
2
+
3
+
4
+ **/.pytest_cache/**
5
+
6
+ **/.idea/**
7
+ **/.vscode/**
8
+ *.swp
9
+ *.env
10
+ *.log
11
+ *.pyc
12
+ *.pyo
13
+ *.pyd
14
+ *.venv
15
+
16
+ docs/source/_*
17
+
18
+ /build
19
+
20
+ /*.egg-info/
21
+
22
+ dist/
@@ -0,0 +1,37 @@
1
+ language: python
2
+ python:
3
+ - "3.5"
4
+ - "3.6"
5
+ - "3.7"
6
+ - "3.8"
7
+ os:
8
+ - linux
9
+ - osx # Adds macOS for cross-platform testing
10
+
11
+ env:
12
+ global:
13
+ - MAX_LINE_LENGTH=120 # Linting line length
14
+
15
+ cache:
16
+ pip: true # Caches pip packages to speed up builds
17
+
18
+ install:
19
+ - pip install flake8 pytest # Install necessary tools and testing framework
20
+ - pip install -r requirements.txt || true # Install project dependencies if `requirements.txt` exists
21
+
22
+ before_script:
23
+ - flake8 npdatetime --max-line-length=$MAX_LINE_LENGTH # Linting with dynamic line length configuration
24
+
25
+ script:
26
+ - pytest -v # Run tests with verbose output
27
+
28
+ jobs:
29
+ include:
30
+ - stage: "Linting Only"
31
+ python: "3.8"
32
+ script:
33
+ - flake8 npdatetime --max-line-length=$MAX_LINE_LENGTH
34
+
35
+ stages:
36
+ - "Test"
37
+ - "Linting Only"
@@ -0,0 +1,25 @@
1
+ # CONTRIBUTING
2
+
3
+ ## Guidelines
4
+ - fork the project
5
+ - clone the forked project
6
+ - pip install the npdatetime in editable mode. On the root directory of project do `$ pip install -e .`
7
+ - install `pytest` for running tests. ```$ pip install pytest```
8
+ - install `flake8` for code formatting check. ```$ pip install flake8```
9
+ - check if all tests are passed by ```$ pytest```
10
+ - start contributing
11
+ - before pushing the changes check again if the tests are passed ```$ pytest```
12
+ - also check code formatting has any issues `$ flake8 npdatetime --max-line-length=120`
13
+ - push your code and raise the PR to `develop` branch
14
+
15
+ **Note: If you're confused on what to contribute in for, you can search for *TODO's* in the code & pick up which ever
16
+ you're comfortable with.**
17
+
18
+
19
+ ## Preparing a new release
20
+ - Checkout out from the `master` branch with the name of branch of the version like `v1.0.8.3`.
21
+ - Update the release version in the `npdatetime/__init__.py` file name by updating the variable `__version__`.
22
+ - Update the documentation to reflect the release version by rebuilding the documentation inside `docs/` using the command `make html`. Make sure you install all the documentation dependencies before rebuilding it, which is in `docs/requirements.txt`.
23
+
24
+
25
+ #### *** HAPPY CONTRIBUTING ! ***
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+ Copyright © 2020 AMRIT GIRI
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the “Software”), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ include npdatetime/data/*
2
+ recursive-include npdatetime/data *
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.1
2
+ Name: npdatetime
3
+ Version: 0.1.1
4
+ Summary: A Python package that provides advanced functionality for handling Nepali dates and times, including support for the Bikram Sambat calendar system and Nepal Time (NPT). Ideal for developers working with Nepali date-related applications, offering seamless conversion, manipulation, and formatting of dates and times in the Nepali calendar.
5
+ Home-page: https://github.com/4mritGiri/npdatetime
6
+ Author: Amrit Giri
7
+ Author-email: Amrit Giri <amritgiri02595@gmail.com>
8
+ License: The MIT License (MIT)
9
+ Copyright © 2020 AMRIT GIRI
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the “Software”), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in
19
+ all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
+ THE SOFTWARE.
28
+ Project-URL: Homepage, https://github.com/4mritGiri/npdatetime#readme
29
+ Project-URL: Issues, https://github.com/4mritGiri/npdatetime/issues
30
+ Keywords: Nepali Date,Date Conversion,Datetime,Bikram Sambat,Bikram Samvat,nepali,B.S.,BS,bs,b.s,date,NpDateTime,datetime,time,timezone,nepal,bikram,sambat,samvat,nepali-date,nepali-datetime,nepal-time,npt,nepal-timezone,npdatetime,npdt
31
+ Classifier: Programming Language :: Python :: 3
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Operating System :: OS Independent
34
+ Requires-Python: >=3.5
35
+ Description-Content-Type: text/markdown
36
+ License-File: LICENSE
37
+
38
+ # **Nepali Datetime (Bikram Sambat Date & Nepal Time)**
39
+
40
+ A Python library inspired by the core `datetime` module, designed for operations based on the **Bikram Sambat (B.S.)** calendar and **Nepal Time (NPT)** timezone (`UTC+05:45`).
41
+
42
+ ### **Key Features**
43
+ - Supports Bikram Sambat (B.S.) date operations.
44
+ - Handles Nepal Time (NPT) timezone.
45
+ - Compatible with Python 3.5+.
46
+ - Seamless integration with Python's native `datetime` functionalities.
47
+ - Support for date formatting with Nepali Unicode.
48
+
49
+ ---
50
+
51
+ ## **Installation**
52
+
53
+ Install the package using `pip`:
54
+
55
+ ```bash
56
+ pip install npdatetime
57
+ ```
58
+
59
+ ---
60
+
61
+ ## **Basic Usage**
62
+
63
+ Here's how you can use `npdatetime` alongside Python's `datetime`:
64
+
65
+ ### **Importing**
66
+ ```python
67
+ import datetime
68
+ import npdatetime
69
+ ```
70
+
71
+ ### **Getting Today's Date**
72
+ ```python
73
+ # Gregorian date
74
+ datetime.date.today()
75
+
76
+ # Bikram Sambat date
77
+ npdatetime.date.today()
78
+ ```
79
+
80
+ ### **Current Date and Time**
81
+ ```python
82
+ # Gregorian datetime
83
+ datetime.datetime.now()
84
+
85
+ # Bikram Sambat datetime
86
+ npdatetime.datetime.now()
87
+ ```
88
+
89
+ ### **Creating Date and Datetime Objects**
90
+ ```python
91
+ # Gregorian date
92
+ datetime.date(2020, 9, 4)
93
+
94
+ # Bikram Sambat date
95
+ npdatetime.date(2077, 5, 19)
96
+
97
+ # Gregorian datetime
98
+ datetime.datetime(2020, 9, 4, 8, 26, 10, 123456)
99
+
100
+ # Bikram Sambat datetime
101
+ npdatetime.datetime(2077, 5, 19, 8, 26, 10, 123456)
102
+ ```
103
+
104
+ ### **Date/Datetime Formatting**
105
+ ```python
106
+ # Formatting Bikram Sambat date
107
+ npdatetime.datetime(2077, 5, 19, 8, 26, 10, 123456).strftime("%d %B %Y")
108
+ # Output: 19 Bhadau 2077
109
+
110
+ # Formatting with Nepali Unicode
111
+ npdatetime.date(1977, 10, 25).strftime('%K-%n-%D (%k %N %G)')
112
+ # Output: १९७७-१०-२५ (७७ माघ आइतबार)
113
+ ```
114
+
115
+ ### **Parsing from String**
116
+ ```python
117
+ npdatetime.datetime.strptime('2077-09-12', '%Y-%m-%d')
118
+ # Output: npdatetime.datetime(2077, 9, 12, 0, 0)
119
+ ```
120
+
121
+ ### **Timedelta Operations**
122
+ ```python
123
+ # Adding days to a date
124
+ npdatetime.date(1990, 5, 10) + datetime.timedelta(days=350)
125
+ # Output: npdatetime.date(1991, 4, 26)
126
+
127
+ # Adding hours and minutes to a datetime
128
+ npdatetime.datetime(1990, 5, 10, 5, 10, 20) + datetime.timedelta(hours=3, minutes=15)
129
+ # Output: npdatetime.datetime(1990, 5, 10, 8, 25, 20)
130
+ ```
131
+
132
+ ### **Bikram Sambat <-> Gregorian Conversion**
133
+ ```python
134
+ # Convert Bikram Sambat to Gregorian
135
+ npdatetime.date(1999, 7, 25).to_datetime_date()
136
+ # Output: datetime.date(1942, 11, 10)
137
+
138
+ # Convert Gregorian to Bikram Sambat
139
+ npdatetime.date.from_datetime_date(datetime.date(1942, 11, 10))
140
+ # Output: npdatetime.date(1999, 7, 25)
141
+ ```
142
+
143
+ ### **Bikram Sambat Monthly Calendar**
144
+ ```python
145
+ npdatetime.date(2078, 1, 1).calendar()
146
+
147
+ # Output:
148
+ Baishakh 2078
149
+ Sun Mon Tue Wed Thu Fri Sat
150
+ 1 2 3 4
151
+ 5 6 7 8 9 10 11
152
+ 12 13 14 15 16 17 18
153
+ 19 20 21 22 23 24 25
154
+ 26 27 28 29 30 31
155
+ ```
156
+
157
+ ---
158
+
159
+ ## **Documentation**
160
+
161
+ Comprehensive usage and examples can be found in the [official documentation](https://4mritGiri.github.io/npdatetime/).
162
+
163
+ ---
164
+
165
+ ## **Contribution**
166
+
167
+ Contributions are highly encouraged!
168
+ Refer to the [CONTRIBUTING.md](https://github.com/4mritGiri/npdatetime/blob/master/CONTRIBUTING.md) guide for details on how to get started.
169
+
170
+ ---
171
+
172
+ ## **License**
173
+
174
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
175
+
176
+ ---
177
+
178
+ ## **Feedback & Support**
179
+
180
+ For feature requests, bugs, or feedback, please raise an issue on [GitHub](https://github.com/4mritGiri/npdatetime/issues).
@@ -0,0 +1,143 @@
1
+ # **Nepali Datetime (Bikram Sambat Date & Nepal Time)**
2
+
3
+ A Python library inspired by the core `datetime` module, designed for operations based on the **Bikram Sambat (B.S.)** calendar and **Nepal Time (NPT)** timezone (`UTC+05:45`).
4
+
5
+ ### **Key Features**
6
+ - Supports Bikram Sambat (B.S.) date operations.
7
+ - Handles Nepal Time (NPT) timezone.
8
+ - Compatible with Python 3.5+.
9
+ - Seamless integration with Python's native `datetime` functionalities.
10
+ - Support for date formatting with Nepali Unicode.
11
+
12
+ ---
13
+
14
+ ## **Installation**
15
+
16
+ Install the package using `pip`:
17
+
18
+ ```bash
19
+ pip install npdatetime
20
+ ```
21
+
22
+ ---
23
+
24
+ ## **Basic Usage**
25
+
26
+ Here's how you can use `npdatetime` alongside Python's `datetime`:
27
+
28
+ ### **Importing**
29
+ ```python
30
+ import datetime
31
+ import npdatetime
32
+ ```
33
+
34
+ ### **Getting Today's Date**
35
+ ```python
36
+ # Gregorian date
37
+ datetime.date.today()
38
+
39
+ # Bikram Sambat date
40
+ npdatetime.date.today()
41
+ ```
42
+
43
+ ### **Current Date and Time**
44
+ ```python
45
+ # Gregorian datetime
46
+ datetime.datetime.now()
47
+
48
+ # Bikram Sambat datetime
49
+ npdatetime.datetime.now()
50
+ ```
51
+
52
+ ### **Creating Date and Datetime Objects**
53
+ ```python
54
+ # Gregorian date
55
+ datetime.date(2020, 9, 4)
56
+
57
+ # Bikram Sambat date
58
+ npdatetime.date(2077, 5, 19)
59
+
60
+ # Gregorian datetime
61
+ datetime.datetime(2020, 9, 4, 8, 26, 10, 123456)
62
+
63
+ # Bikram Sambat datetime
64
+ npdatetime.datetime(2077, 5, 19, 8, 26, 10, 123456)
65
+ ```
66
+
67
+ ### **Date/Datetime Formatting**
68
+ ```python
69
+ # Formatting Bikram Sambat date
70
+ npdatetime.datetime(2077, 5, 19, 8, 26, 10, 123456).strftime("%d %B %Y")
71
+ # Output: 19 Bhadau 2077
72
+
73
+ # Formatting with Nepali Unicode
74
+ npdatetime.date(1977, 10, 25).strftime('%K-%n-%D (%k %N %G)')
75
+ # Output: १९७७-१०-२५ (७७ माघ आइतबार)
76
+ ```
77
+
78
+ ### **Parsing from String**
79
+ ```python
80
+ npdatetime.datetime.strptime('2077-09-12', '%Y-%m-%d')
81
+ # Output: npdatetime.datetime(2077, 9, 12, 0, 0)
82
+ ```
83
+
84
+ ### **Timedelta Operations**
85
+ ```python
86
+ # Adding days to a date
87
+ npdatetime.date(1990, 5, 10) + datetime.timedelta(days=350)
88
+ # Output: npdatetime.date(1991, 4, 26)
89
+
90
+ # Adding hours and minutes to a datetime
91
+ npdatetime.datetime(1990, 5, 10, 5, 10, 20) + datetime.timedelta(hours=3, minutes=15)
92
+ # Output: npdatetime.datetime(1990, 5, 10, 8, 25, 20)
93
+ ```
94
+
95
+ ### **Bikram Sambat <-> Gregorian Conversion**
96
+ ```python
97
+ # Convert Bikram Sambat to Gregorian
98
+ npdatetime.date(1999, 7, 25).to_datetime_date()
99
+ # Output: datetime.date(1942, 11, 10)
100
+
101
+ # Convert Gregorian to Bikram Sambat
102
+ npdatetime.date.from_datetime_date(datetime.date(1942, 11, 10))
103
+ # Output: npdatetime.date(1999, 7, 25)
104
+ ```
105
+
106
+ ### **Bikram Sambat Monthly Calendar**
107
+ ```python
108
+ npdatetime.date(2078, 1, 1).calendar()
109
+
110
+ # Output:
111
+ Baishakh 2078
112
+ Sun Mon Tue Wed Thu Fri Sat
113
+ 1 2 3 4
114
+ 5 6 7 8 9 10 11
115
+ 12 13 14 15 16 17 18
116
+ 19 20 21 22 23 24 25
117
+ 26 27 28 29 30 31
118
+ ```
119
+
120
+ ---
121
+
122
+ ## **Documentation**
123
+
124
+ Comprehensive usage and examples can be found in the [official documentation](https://4mritGiri.github.io/npdatetime/).
125
+
126
+ ---
127
+
128
+ ## **Contribution**
129
+
130
+ Contributions are highly encouraged!
131
+ Refer to the [CONTRIBUTING.md](https://github.com/4mritGiri/npdatetime/blob/master/CONTRIBUTING.md) guide for details on how to get started.
132
+
133
+ ---
134
+
135
+ ## **License**
136
+
137
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
138
+
139
+ ---
140
+
141
+ ## **Feedback & Support**
142
+
143
+ For feature requests, bugs, or feedback, please raise an issue on [GitHub](https://github.com/4mritGiri/npdatetime/issues).