razorpay / ifsc

:bank: IFSC Codes Repository
https://ifsc.razorpay.com
MIT License
338 stars 131 forks source link

Project restructure required #68

Open himanshub16 opened 6 years ago

himanshub16 commented 6 years ago

I have been trying to implement Python version and Golang version for the same.

Here are some of the problems I faced:

A proposed solution would be to have following directory structure:

.
├── data
├── golang
│   ├── ifsc.go
│   └── ifsc_test.go
├── nodejs
│   ├── index.js
│   ├── package.json
│   └── tests
├── php
│   └── tests
├── python
│   ├── ifsc.py
│   ├── setup.py
│   └── tests
│       └── validator_test.py
└── scraper

9 directories, 7 files

This would bring more segregation among language-specific modules where the language enforces a specific construct on the directory structure.

Solution for IFSC.json

Provide IFSC.json as a symlink to each language's directory. This will avoid duplicates and help language specific files local to a directory while building.

captn3m0 commented 6 years ago

How do you handle the common validator_asserts.json file?

I think I can work with a symlink approach. Will cause issues with Windows probably, though, but I don't think any contributor so far is using that.

himanshub16 commented 6 years ago

Another solution could be not having data files in git. The respective module (in any language) would download the database on the first run and use that copy for subsequent calls. There can be separate releases for ifsc.json and validator_asserts.json (i.e. data files) avoiding need of any symlinks or cross-package dependency in codebase or rebuilding release packages on json update.

Don't know if this is a perfect solution or if this is actually an issue (if someone else is facing it)!

captn3m0 commented 6 years ago

I don't know how go manages dependency releases. For npm, rubygems, PHP, hex - it either downloads the final release (compressed) or just the tag from GitHub (which means no previous files).

Does go download the entire git history if you are using a specific tag?

validator.json is just a common tests file. We can keep validator_asserts.json in the data directory and then symlink it to the right lang/tests directories.

Apologies about the issues, but one of my goals for the repo was to see how far I could take the one-repo-for-all-packages concept (reduces maintenance burden on all contributors and everything remains updated).

@himanshub16 I can try pushing out this directory refactor this weekeend if that helps.

Thanks for contributing :+1:

himanshub16 commented 6 years ago

go get (analogous to npm install) actually gets the git repo when fetching remote packages. > documentation