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

Rework project structure: form a proper Python package #270

Open
atemate opened this issue Dec 19, 2019 · 0 comments
Open

Rework project structure: form a proper Python package #270

atemate opened this issue Dec 19, 2019 · 0 comments

Comments

@atemate
Copy link
Contributor

atemate commented Dec 19, 2019

TL;DR
Let's modify template so that relative imports work:

<project-slug>
│   └── main.py
│    │    └── sub_package
│    │    │     └── train.py
from .main import *
from .sub_package.train import *

--
Problem:
We have over-complicated rules of naming (only dashes allowed for slug, only underscores allowed for code dir. At the same time, we don't allow users to address Python code as from a local package. Instead, we use hacks as -e PYTHONPATH=<project-dir> or sys.path.append('<project-dir>').

  • Pros of using the hacks: code directory name can be fixed to src to simplify the template considerably
  • Cons of using the hacks: to develop locally, i.e. to set up your local IDE, you'd need to use the same hacks, different across IDEs. Plus, hard to understand as it's not a stnadard way.

In turn, we should use a standard way of forming a Python package via setup.py. Note, in this case code dir still can be named with dashes.

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

1 participant