Git Product home page Git Product logo

py-fi-tree's Introduction

$src-template1

A template for the src-layout of a Python project.

There is a lot of content in the template for reminder or examples purposes.

Usage

clean.py will remove the excess template content, and replace project-name place holders.

  1. Set the name of your project
# clean.py
...
# content ommitted
# Set the name of your project here
DEFAULT_PACKAGE_NAME = 'my_package'
...
  1. Run clean.py
python -m clean.py
  1. Run init_venv.bat to create a virtual environment and install the project in editable mode.
init_venv.bat

Github Settings

Pre-receive hooks

  • Reject ipynb output cells

src-layout

The containg folder of this readme is a template for the 'src-layout', a popular layout for python projects and can be detected by setuptools for automatic package discovery.

Read about package discovery in the setuptools docs here, including the advantages and disadvantages of src-layout.

Quick Description

From the setuptools docs:

The project should contain a src directory under the project root and all modules and packages meant for distribution are placed inside this directory:

project_root_directory 
├── pyproject.toml  # AND/OR setup.cfg, setup.py 
├── ... 
└── src/ 
    └── mypkg/ 
        ├── __init__.py 
        ├── ... 
        ├── module.py 
        ├── subpkg1/ 
        │   ├── __init__.py 
        │   ├── ... 
        │   └── module1.py 
        └── subpkg2/ 
            ├── __init__.py 
            ├── ... 
            └── module2.py 

This layout is very handy when you wish to use automatic discovery, since you don’t have to worry about other Python files or folders in your project root being distributed by mistake. In some circumstances it can be also less error-prone for testing or when using PEP 420-style packages. On the other hand you cannot rely on the implicit PYTHONPATH=. to fire up the Python REPL and play with your package (you will need an editable install to be able to do that)

py-fi-tree's People

Contributors

oakla avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.