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

Multiple Issues #51

Open
asms opened this issue Oct 3, 2017 · 2 comments
Open

Multiple Issues #51

asms opened this issue Oct 3, 2017 · 2 comments

Comments

@asms
Copy link

asms commented Oct 3, 2017

I'm adding multiple issues here based on my experience of the project, and I'll leave it up to the maintainers to close this issue and subdivide these into smaller tasks.

README (example)

  • Set up environment
    Install pyenv
    python setup.py install
  • Basic Usage
    FLASK_APP=kwitter flask run
  • Contributing/testing
    Include any style guides.
    python -m unittest

setup.py

I've already seen an issue for this, but this would be fairly straightforward:

from setuptools import setup

setup(
    name='kwitter',
    packages=['kwitter'],
    include_package_data=True,
    install_requires=[
        'flask',
    ],
)

However, this would require that you put kwitter into a module and you might have update the import statements within your files.

requirements.txt

If you keep this file, it should at least have:

Flask==0.12

Refactoring/Circular dependencies

There are a lot of circular dependencies in the code. e.g. tag_management.py imports tag.py, and tag.py imports tag_management.py.
This was the biggest issue for me, and prevented me from being able to run the app. This might be specific to my dev environment, and if so a proper README will be all that is required.

Testing

Add tests for every model and controller. These should already exist. Backfill them before adding any additional functionality. I would suggest refactoring first, since that will break break a lot of the tests.
It seems like you are using unittest as your testing framework. python -m unittest doesn't run any of your tests. I think there is a specific pattern for file names for them to be discovered automatically i.e. test_*.py`.

@keithstellyes
Copy link
Owner

keithstellyes commented Oct 3, 2017

Thanks for the input. You're mentioning that you're using python but this is project targets Python 3, and python on most systems is Python 2.

RE: Circular dependencies / not being able to run code
Filed: #52
Can you explain how you tried to run the code? What version of Python did you use, which files did you run, etc?

I was worried the *_management.py files would get feature envy issues, and it seems like that has arisen. I'm not seeing any reason for keeping them as separate files, so it'd probably be reasonable to move their functions elsewhere and get rid of the files.

RE: Tests
The model is simple enough at the current stage that it's implicitly tested via the pre-existing tests. However, the api-server's tests are not as-of-yet done.

RE: Readme
Filed: #53
This is a pretty obvious thing that still needs to be done.

requirements.txt: #54

@asms
Copy link
Author

asms commented Oct 3, 2017

Flask version: 0.12
Python version: 3.4.2
I'm using pyenv to manage multiple versions of python, so python is just an alias for whichever version of python I have set.
According to the flask 0.12: python support docs, python 3.3 or higher is required.

I have tried running:
FLASK_APP=api_server.py flask run
AND
python api_server.py

They both encounter the same error :

Stack Trace ``` Traceback (most recent call last): File "api_server.py", line 7, in from server.api import user_stream, tag_stream, user_feed, follower_relations File "/home/asms/src/uwt/kwitter/server/api/user_stream.py", line 1, in from logic.shared import get_all File "/home/asms/src/uwt/kwitter/logic/shared/get_all.py", line 7, in from logic.tweets import tweet File "/home/asms/src/uwt/kwitter/logic/tweets/tweet.py", line 1, in from logic.tweets import tweet_management File "/home/asms/src/uwt/kwitter/logic/tweets/tweet_management.py", line 3, in from logic.tags import tag as tag_module File "/home/asms/src/uwt/kwitter/logic/tags/tag.py", line 1, in from logic.tags import tag_management File "/home/asms/src/uwt/kwitter/logic/tags/tag_management.py", line 1, in from logic.tags import tag as tag_module ImportError: cannot import name 'tag' ```

After fixing that, it encounters another. I don't know how many there are, but there were too many to do a quick PR for. It would require some larger design decisions.

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