Skip to content

Commit 7b0c09b

Browse files
committed
refactor: Rename Python module and crate, scope JavaScript package, add today_today_conversion test, and introduce .gitignore files for various bindings.
1 parent e040f59 commit 7b0c09b

9 files changed

Lines changed: 55 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ jobs:
163163
164164
- name: Publish to NPM
165165
run: |
166-
cd bindings/javascript/pkg
166+
cd bindings/javascript
167167
npm publish --access public || echo "Publish failed, might already exist or auth issue"
168168
env:
169169
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

bindings/java/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
target/
2+
*.class
3+
.idea/
4+
*.iml
5+
.settings/
6+
.classpath
7+
.project

bindings/javascript/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
dist/
3+
pkg/
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*

bindings/javascript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "npdatetime",
2+
"name": "@4mritgiri/npdatetime",
33
"version": "0.2.0",
44
"description": "Modern, production-ready Nepali Date Picker (Bikram Sambat) and Gregorian calendar library.",
55
"type": "module",

bindings/php/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
composer.lock
3+
.phpunit.cache

bindings/python/.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
__pycache__/
2+
*.py[cod]
3+
*$py.class
4+
*.so
5+
.Python
6+
build/
7+
develop-eggs/
8+
dist/
9+
downloads/
10+
eggs/
11+
.eggs/
12+
lib/
13+
lib64/
14+
parts/
15+
sdist/
16+
var/
17+
wheels/
18+
*.egg-info/
19+
.installed.cfg
20+
*.egg
21+
venv/
22+
.env

bindings/python/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.2.0"
44
edition = "2021"
55

66
[lib]
7-
name = "npdatetime_py"
7+
name = "npdatetime"
88
crate-type = ["cdylib"]
99

1010
[dependencies]

bindings/python/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl NepaliDate {
198198

199199
/// NPDateTime - Fast Nepali (Bikram Sambat) datetime library
200200
#[pymodule]
201-
fn npdatetime_py(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
201+
fn npdatetime(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
202202
m.add_class::<NepaliDate>()?;
203203
m.add("__version__", env!("CARGO_PKG_VERSION"))?;
204204
Ok(())

bindings/python/test_npdatetime.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,24 @@ def test_comparison():
4242
assert date2 > date1
4343
assert date1 == NepaliDate(2077, 5, 19)
4444

45+
def test_today_conversion():
46+
from npdatetime import NepaliDate
47+
from datetime import date
48+
49+
today_ad = date.today()
50+
nepali_date = NepaliDate.from_gregorian(today_ad.year, today_ad.month, today_ad.day)
51+
52+
# Also verify matches .today()
53+
assert nepali_date == NepaliDate.today()
54+
print(f"Today: AD {today_ad} = BS {nepali_date}")
55+
4556
if __name__ == "__main__":
4657
test_create_date()
4758
test_to_gregorian()
4859
test_from_gregorian()
4960
test_format()
5061
test_add_days()
5162
test_comparison()
63+
test_comparison()
64+
test_today_conversion()
5265
print("All Python tests passed!")

0 commit comments

Comments
 (0)