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

Switch to src/ layout #28

Closed
flying-sheep opened this issue May 3, 2022 · 11 comments · Fixed by #37
Closed

Switch to src/ layout #28

flying-sheep opened this issue May 3, 2022 · 11 comments · Fixed by #37
Assignees
Milestone

Comments

@flying-sheep
Copy link
Member

flying-sheep commented May 3, 2022

See here for places recommending it:

Furthermore I think:

  • The symmetry makes sense: ls *(/) will yield src tests docs, package specific names start appearing inside of those
  • adding {project}/src to PYTHONPATH or doing pip install -e . is safer than adding {project}

(Resolution: Try it out after all PRs touching the code got merged)

@flying-sheep
Copy link
Member Author

Since finding the discussion, I also found that both the Hypermodern Python package guide and Ionel’s blog (i.e. all places that I found that gives reasons for choosing a layout) picked this one.

@ivirshup
Copy link
Member

ivirshup commented May 4, 2022

It may not have been clear due to the hybrid meeting (which we definitely didn't prepare well for), but I think everyone else was against this. I think I'm going to revert this, though we can always add it if it gets some support.

@flying-sheep
Copy link
Member Author

flying-sheep commented May 4, 2022

You said “let’s try it”.

Also the only argument against it was “familiarity”. When weighing that against the arguments above, I don’t see how it can possibly win out.

@ivirshup
Copy link
Member

ivirshup commented May 4, 2022

Ah yeah, so what I had meant there (and I think was in response to others) was: "lets try it out for a project before making it a part of the template".

@flying-sheep
Copy link
Member Author

Aah, I see! How far did you get with the stats package yesterday?

@flying-sheep
Copy link
Member Author

flying-sheep commented May 4, 2022

The more I read about it the more convinced I become: Python adds an option to turn off adding the current directory to sys.path

@grst
Copy link
Collaborator

grst commented May 19, 2022

It seems unnecessary and reminded me of Java

That was exactly my feeling, but Hynek makes a few good points.

I think I'm slightly in favor of src now, but the question remains whether it's worth the effort changing something.

@flying-sheep
Copy link
Member Author

flying-sheep commented May 20, 2022

Glad you see it that way! I organized scanpy and anndata without it originally because I also had that initial thought and didn’t think further, but all substantial arguments point towards the src layout.

  • it being one level deeper doesn’t matter because we usually interact with code repos using editors, and those will collapse it just like GitHub:
    grafik
  • “looks like Java and I don’t like Java” isn’t even a real aesthetic argument, it’s guilt by association. And aesthetically, src, docs, tests is more symmetric than {{package_name}}, docs, test!

whether it's worth the effort changing something

I don’t think I understand what kind of change you’re referring to.

For the code changes it’s mkdir src; git mv '{{cookiecutter.package_name}}' src/

And what other kind of change is there?

@grst
Copy link
Collaborator

grst commented May 20, 2022 via email

@flying-sheep
Copy link
Member Author

idk, the disruption of breaking all PRs is high. We could just do all new ones that way and upgrade smaller ones

@grst grst added this to the v0.1.0 milestone Jun 21, 2022
@grst grst self-assigned this Jul 4, 2022
@grst
Copy link
Collaborator

grst commented Aug 9, 2022

Done in #79

@grst grst closed this as completed Aug 9, 2022
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

Successfully merging a pull request may close this issue.

3 participants