Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • kwant kwant
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 142
    • Issues 142
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • kwant
  • kwantkwant
  • Issues
  • #364
Closed
Open
Created Mar 18, 2020 by Joseph Weston@jbwestonOwner

Consider switching to "src" package layout and using "tox" for test running

When hacking on Kwant it is recommended by the Kwant docs to use python setup.py build_ext --inplace && pytest for testing.

There are a couple of problems I have observed with this workflow:

  1. the build_ext --inplace step is kind of non-standard, and if done incorrectly (e.g. by omitting the --inplace) then python -c 'import kwant' complains about not importing Kwant from the correct place (this has confused me more times than I care to mention)
  2. placing the .c files next to the source an be problematic. Cython is not re-run if the associated .pyx file has not changed, but if we are using different versions of Cython, or targeting different CPython APIs (can happen when jumping around between stable/master) then the .c files are still not regenerated.
  3. locally testing against different environments becomes a pain (manually deactivating / reactivating different Conda environments / whoops I just wasted 10 minutes because I was in the wrong environment)

I believe that points 1 and 3 can be addressed by using the src layout (i.e. have the Kwant source code under src/kwant rather than directly in kwant) and by using an environment-aware test-runner such as tox (which also has support for Conda environments).

I am not sure if this will address 2, but 2/3 ain't bad.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking