hrishikeshrt / PyCDSL

Python Interface to Cologne Digital Sanskrit Lexicon (CDSL)
https://pypi.org/project/PyCDSL/
Other
12 stars 1 forks source link

Python 3.6 Compatibility #10

Closed hrishikeshrt closed 2 years ago

hrishikeshrt commented 2 years ago

Issues #3 and #5 are related to Python 3.7+ dependence. Needs more investigation, however, the primary cause seems to be some changes re and cmd modules.

hrishikeshrt commented 2 years ago

@drdhaval2785

If you still have an environment with python 3.6, can you check now? I think the changes to the backend have fixed some of the incompatibility issues. I tested with 3.6.13 and didn't encounter any errors.

drdhaval2785 commented 2 years ago

I still have python3.6. Will test and revert

drdhaval2785 commented 2 years ago

Yes. The version 0.2.1 does work on python3.6.9 without errors.

$ python3.6 -i
Python 3.6.9 (default, Dec  8 2021, 21:08:43) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycdsl
>>> CDSL = pycdsl.CDSLCorpus()
>>> CDSL.setup()
True
>>> results = CDSL.MW.search("राम")
>>> print(results)
[<MWEntry: 177264: राम = राम mf(आ/)n. (prob. ‘causing rest’, and in most meanings fr. √ रम्) dark, dark-coloured, black (cf. रात्रि), AV.; TĀr. (रामः शकुनिः. a black bird, crow, KāṭhGṛ.; Viṣṇ.)>, <MWEntry: 177265: राम = white (?), L.>, <MWEntry: 177266: राम = pleasing, pleasant, charming, lovely, beautiful, MBh.; Kāv. &c.>, <MWEntry: 177267: राम = राम m. a kind of deer, Car.>, <MWEntry: 177268: राम = a horse, L.>, <MWEntry: 177269: राम = a lover, VarBṛS.>, <MWEntry: 177270: राम = pleasure, joy, delight, BhP.>, <MWEntry: 177271: राम = N. of Varuṇa, L.>, <MWEntry: 177272: राम = N. of various mythical personages (in Veda two Rāmas are mentioned with the patr. Mārgaveya and Aupatasvini; another R°s with the patr. Jāmadagnya [cf. below] is the supposed author of RV. x, 110; in later times three R°s are celebrated, viz. 1. Paraśu-rāma [q.v.], who forms the 6th Avatāra of Viṣṇu and is sometimes called Jāmadagnya, as son of the sage Jamad-agni by Reṇukā, and sometimes Bhārgava, as descended from Bhṛgu; 2. Rāma-candra [see below]; 3. Bala-rāma [q.v.], ‘the strong Rāma’, also called Halâyudha and regarded as elder brother of Kṛṣṇa [RTL. 112] accord. to Jainas a Rāma is enumerated among the 9 white Balas; and in VP. a R°s is mentioned among the 7 Ṛṣis of the 8th Manv-antara), RV. &c. &c. N. of a king of Malla-pura, Cat.>, <MWEntry: 177273: राम = of a king of Śṛṅga-vera and patron of Nāgêśa, ib.>, <MWEntry: 177274: राम = of various authors and teachers (also with आचार्य, उपाध्याय, कवि, चक्र-वर्तिन्, ज्योतिर्-विद्, ज्यौतिषक, तर्क-वाग्-ईश, दीक्षित, दैव-ज्ञ, पण्डित, भट्ट, भट्टाचार्य, वाजपेयिन्, शर्मन्, शास्त्रिन्, संयमिन्, सूरि &c.), Cat.>, <MWEntry: 177275: राम = N. of the number ‘three’ (on account of the 3 Rāmas), Hcat. (रामस्य इषुः, a kind of cane = रामकण्ड, L.)>, <MWEntry: 177276: राम = pl. N. of a people, VP.>, <MWEntry: 177289: राम = राम n. id., ib.>, <MWEntry: 177290: राम = the leaf of Laurus Cassia, L.>, <MWEntry: 177291: राम = Chenopodium Album, L.>, <MWEntry: 177292: राम = = कुष्ठ, L.>]
>>> exit()
drdhaval2785 commented 2 years ago

There is another problem though. Pip does not find any pycdsl version above 0.1.9. It may be because you need to specify that the code from 0.2.1 onwards is compatible with python3.6. Then only a wheel / egg would be generated and pypi would be able to distribute it. Then we can close this issue. Thanks for the help.

$ python3.6 -m pip install pycdsl==0.2.1
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement pycdsl==0.2.1 (from versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9)                                        
ERROR: No matching distribution found for pycdsl==0.2.1

Note - I tested the above one by copy-pasting version 0.2.1 pycdsl directory from python3.9 site-packages to python3.6 sitepackages.

hrishikeshrt commented 2 years ago

Commit c9f45e4c224ea23954a427125b01920fda64e816 will fix this problem in the next release by adding that tag in PyPI. Will close this post the release.

drdhaval2785 commented 2 years ago

python_requires='>=3.7'

This would also require change I guess.

hrishikeshrt commented 2 years ago

Able to find through pip and install it now on 3.6.