Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project restructure required #68

Open
himanshub16 opened this issue Apr 8, 2018 · 4 comments
Open

Project restructure required #68

himanshub16 opened this issue Apr 8, 2018 · 4 comments

Comments

@himanshub16
Copy link

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

Here are some of the problems I faced:

  • While creating setup.py for Python, a lot of time was consumed to handle relative paths for IFSC.json.
  • Another problem caused by having setup.py in the root is that the resulting build/egg after python setup.py build has the source file at src/python/ifsc.py instead of just ifsc.py.
  • tests being in /tests requires importing source files using the relative path. This works for languages like JavaScript but causes problems when writing tests for python and golang.
  • Current structure requires all sources to be built every time IFSC.json is updated.

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
Copy link
Contributor

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
Copy link
Author

himanshub16 commented Apr 18, 2018

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
Copy link
Contributor

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 👍

@himanshub16
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants