|
1 | 1 | # Python Project Template |
2 | 2 |
|
3 | | -This project follows the Python Standards declared in [PEP 621](https://peps.python.org/pep-0621/). |
4 | | -This uses a pyproject.yaml to configuration the project. In this example, [flit](https://pypi.org/project/flit/) is used to simplify the build process, and publish to pypi. |
| 3 | +This project is a template for creating Python projects that follows the Python Standards declared in [PEP 621](https://peps.python.org/pep-0621/). |
| 4 | +It uses a `pyproject.yaml` file to configure the project and [Flit](https://pypi.org/project/flit/) to simplify the build process and publish to PyPI. |
| 5 | +One advantage of using Flit is that you do not need a `setup.py` or `setup.cfg` file. Instead, you only need to include the relevant information in your `pyproject.toml` file. |
5 | 6 |
|
6 | 7 | ## Project Organization |
7 | 8 |
|
8 | | -- .devcontainer - This directory contains required files for creating a [Codespace](https://github.com/features/codespaces). |
9 | | -- .github |
10 | | - - workflows - Contains GitHub Actions used for building, testing and publishing. |
11 | | - - publish-test.yml - Publish wheels to [https://test.pypi.org/](https://test.pypi.org/) |
12 | | - - publish.yml - Publish wheels to [https://pypi.org/](https://pypi.org/) |
13 | | - - pull-request.yml - Build and Test pull requests before commiting to main. |
14 | | - - template-sync.yml - Update GitHub Repo with enhancments to base template |
15 | | -- docs - collect documents (default format .md) |
16 | | -- src - place new source code here |
17 | | - - python_package - sample package (this can be deleted when creating a new repository) |
18 | | -- tests - contains Python based test cases to validate src code |
19 | | -- .pre-commit-config.yaml - Contains various pre-check fixes for Python |
20 | | -- .templateversionrc - used to track template version usage. |
21 | | -- MANIFEST.in - Declares additional files to include in Python whl |
22 | | -- pyproject.toml - Python Project Declaration |
23 | | -- ws.code-workspace - Recommended configurations for [Visual Studio Code](https://code.visualstudio.com/) |
| 9 | +- `.github/workflows`: Contains GitHub Actions used for building, testing, and publishing. |
| 10 | +- `src`: Place new source code here. |
| 11 | +- `tests`: Contains Python-based test cases to validate source code. |
| 12 | +- `pyproject.toml`: Python Project Declaration. |
24 | 13 |
|
25 | | -## pyproject.toml |
| 14 | +### `pyproject.toml` |
26 | 15 |
|
27 | | -The following sections are defined in the configuration toml. |
| 16 | +The `pyproject.toml` file contains the following sections: |
28 | 17 |
|
29 | | -- build-system |
30 | | -- project |
31 | | - - optional-dependencies |
32 | | - - urls |
33 | | -- tool |
34 | | - - bandit |
35 | | - - coverage |
36 | | - - run |
37 | | - - report |
38 | | - - pyright |
39 | | - - pytest |
40 | | - - tox |
41 | | - - pylint |
42 | | - - MESSAGES CONTROL |
43 | | - - REPORTS |
44 | | - - REFACTORING |
45 | | - - BASIC |
46 | | - - FORMAT |
47 | | - - LOGGING |
48 | | - - MISCELLANEOUS |
49 | | - - SIMILARITIES |
50 | | - - SPELLING |
51 | | - - STRING |
52 | | - - TYPECHECK |
53 | | - - VARIABLES |
54 | | - - CLASSES |
55 | | - - DESIGN |
56 | | - - IMPORTS |
57 | | - - EXCEPTIONS |
| 18 | +- `project`: Defines the project metadata, which may have been previously contained in a `setup.py` file. |
| 19 | +- `tool`: Defines the configurations for additional tools used to format, lint, type-check, and analyze Python code. |
58 | 20 |
|
59 | | -### build-system |
60 | | -TODO: add info on flit configuration |
| 21 | +#### `tool` sections |
61 | 22 |
|
62 | | -### project |
63 | | -This section defines the project metadata, which may have been previously contained in a setup.py file. |
| 23 | +- `black`: Auto-formats code. |
| 24 | +- `coverage`: Configures code coverage reports generated during testing. |
| 25 | +- `pytest`: Configures various test markers used during testing. |
| 26 | +- `pylint`: Performs linting and static analysis. Any modifications made by the auto-formatter (`black`) are always considered correct. |
64 | 27 |
|
65 | | -#### optional-dependencies |
66 | | -This are otpimal dependancey groups that can be installed via 'pip install .[tests]'. |
67 | | -One group is included for dependancies required for testing. A second group is included for PySpark based dependancies. |
68 | | - |
69 | | -### tool |
70 | | -This section defines the configurations for additional tools used to format, lint, type-check, and analysis Python code. |
71 | | - |
72 | | -#### bandit |
73 | | -Performs Security Static Analysis checks on code base. |
74 | | - |
75 | | -#### black |
76 | | -Auto-formats code |
77 | | - |
78 | | -#### coverage |
79 | | -Configures code coverage reports generatated during testing. |
80 | | - |
81 | | -#### pyright |
82 | | -Performs static type checking on Python. |
83 | | - |
84 | | -#### pytest |
85 | | -Configures various test markers used during testing. |
86 | | - |
87 | | -#### pylint |
88 | | -Performs Linting and Static Analysis. Any modifictions made by the auto-formater (black) are always considered correct. |
89 | | - |
90 | | -## Publish to PyPi from GitHub |
91 | | -In order to publish to PyPi, a repostirory secret must be created, "PYPI_PASSWORD". In order to publish to the Test PyPi, a second secret must be added, "TEST_PYPI_PASSWORD". |
| 28 | +## Getting Started |
92 | 29 |
|
| 30 | +To get started with this template, simply clone this repository and start building your project within the `src` directory. |
93 | 31 |
|
94 | 32 | ## Contributing |
95 | 33 |
|
96 | | -This project welcomes contributions and suggestions. Most contributions require you to agree to a |
97 | | -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us |
98 | | -the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. |
99 | | - |
100 | | -When you submit a pull request, a CLA bot will automatically determine whether you need to provide |
101 | | -a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions |
102 | | -provided by the bot. You will only need to do this once across all repos using our CLA. |
103 | | - |
104 | | -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). |
105 | | -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or |
106 | | -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
107 | | - |
108 | | -## Trademarks |
109 | | - |
110 | | -This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft |
111 | | -trademarks or logos is subject to and must follow |
112 | | -[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). |
113 | | -Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. |
114 | | -Any use of third-party trademarks or logos are subject to those third-party's policies. |
| 34 | +This project welcomes contributions and suggestions. |
| 35 | +For details, visit the repository's [Contributor License Agreement (CLA)](https://cla.opensource.microsoft.com) and [Code of Conduct](https://opensource.microsoft.com/codeofconduct/) pages. |
0 commit comments