usethis 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- usethis-0.1.0/.github/ISSUE_TEMPLATE/documentation-task.md +23 -0
- usethis-0.1.0/.github/ISSUE_TEMPLATE/feature-development-task.md +29 -0
- usethis-0.1.0/.github/ISSUE_TEMPLATE/feature-idea.md +14 -0
- usethis-0.1.0/.github/workflows/ci.yml +47 -0
- usethis-0.1.0/.github/workflows/release.yml +30 -0
- usethis-0.1.0/.gitignore +162 -0
- usethis-0.1.0/.pre-commit-config.yaml +30 -0
- usethis-0.1.0/.python-version +1 -0
- usethis-0.1.0/LICENSE +21 -0
- usethis-0.1.0/PKG-INFO +134 -0
- usethis-0.1.0/README.md +81 -0
- usethis-0.1.0/doc/philosophy/introspection.md +67 -0
- usethis-0.1.0/pyproject.toml +103 -0
- usethis-0.1.0/src/usethis/__init__.py +0 -0
- usethis-0.1.0/src/usethis/__main__.py +18 -0
- usethis-0.1.0/src/usethis/_console.py +6 -0
- usethis-0.1.0/src/usethis/_integrations/__init__.py +0 -0
- usethis-0.1.0/src/usethis/_integrations/bitbucket/__init__.py +0 -0
- usethis-0.1.0/src/usethis/_integrations/bitbucket/cache.py +56 -0
- usethis-0.1.0/src/usethis/_integrations/bitbucket/config.py +42 -0
- usethis-0.1.0/src/usethis/_integrations/bitbucket/steps.py +98 -0
- usethis-0.1.0/src/usethis/_integrations/github/__init__.py +0 -0
- usethis-0.1.0/src/usethis/_integrations/github/tags.py +43 -0
- usethis-0.1.0/src/usethis/_integrations/pre_commit/__init__.py +0 -0
- usethis-0.1.0/src/usethis/_integrations/pre_commit/config.py +19 -0
- usethis-0.1.0/src/usethis/_integrations/pre_commit/core.py +59 -0
- usethis-0.1.0/src/usethis/_integrations/pre_commit/hooks.py +91 -0
- usethis-0.1.0/src/usethis/_integrations/pyproject/__init__.py +0 -0
- usethis-0.1.0/src/usethis/_integrations/pyproject/config.py +8 -0
- usethis-0.1.0/src/usethis/_integrations/pyproject/core.py +141 -0
- usethis-0.1.0/src/usethis/_integrations/pyproject/io.py +20 -0
- usethis-0.1.0/src/usethis/_integrations/pyproject/requires_python.py +34 -0
- usethis-0.1.0/src/usethis/_integrations/pytest/__init__.py +0 -0
- usethis-0.1.0/src/usethis/_integrations/pytest/core.py +39 -0
- usethis-0.1.0/src/usethis/_integrations/ruff/__init__.py +0 -0
- usethis-0.1.0/src/usethis/_integrations/ruff/rules.py +52 -0
- usethis-0.1.0/src/usethis/_integrations/uv/__init__.py +0 -0
- usethis-0.1.0/src/usethis/_integrations/uv/deps.py +109 -0
- usethis-0.1.0/src/usethis/_interface/__init__.py +3 -0
- usethis-0.1.0/src/usethis/_interface/browse.py +24 -0
- usethis-0.1.0/src/usethis/_interface/ci.py +84 -0
- usethis-0.1.0/src/usethis/_interface/tool.py +153 -0
- usethis-0.1.0/src/usethis/_tool.py +331 -0
- usethis-0.1.0/src/usethis/_utils/__init__.py +0 -0
- usethis-0.1.0/src/usethis/_utils/_test.py +26 -0
- usethis-0.1.0/src/usethis/_utils/_yaml.py +31 -0
- usethis-0.1.0/src/usethis/py.typed +0 -0
- usethis-0.1.0/tests/conftest.py +18 -0
- usethis-0.1.0/tests/usethis/_integrations/bitbucket/test_cache.py +17 -0
- usethis-0.1.0/tests/usethis/_integrations/bitbucket/test_config.py +44 -0
- usethis-0.1.0/tests/usethis/_integrations/bitbucket/test_steps.py +46 -0
- usethis-0.1.0/tests/usethis/_integrations/github/test_tags.py +54 -0
- usethis-0.1.0/tests/usethis/_integrations/pre_commit/test_core.py +126 -0
- usethis-0.1.0/tests/usethis/_integrations/pre_commit/test_hooks.py +139 -0
- usethis-0.1.0/tests/usethis/_integrations/pyproject/test_core.py +243 -0
- usethis-0.1.0/tests/usethis/_integrations/pyproject/test_requires_python.py +104 -0
- usethis-0.1.0/tests/usethis/_integrations/pytest/test_core.py +85 -0
- usethis-0.1.0/tests/usethis/_integrations/ruff/test_rules.py +114 -0
- usethis-0.1.0/tests/usethis/_integrations/uv/deps.py +62 -0
- usethis-0.1.0/tests/usethis/_interface/test_browse.py +33 -0
- usethis-0.1.0/tests/usethis/_interface/test_ci.py +47 -0
- usethis-0.1.0/tests/usethis/_interface/test_tool.py +454 -0
- usethis-0.1.0/uv.lock +725 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Documentation Task
|
|
3
|
+
about: A tightly scoped task for adding or updating documentation.
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: nathanjmcdougall
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Motivation**
|
|
11
|
+
A clear and concise description of what benefit you would get from this documentation update or addition.
|
|
12
|
+
|
|
13
|
+
**Key Area**
|
|
14
|
+
Specify the key area of the project that requires documentation, e.g. the function, the workflow, the developer experience, etc.
|
|
15
|
+
|
|
16
|
+
**Objectives & Target Audience**
|
|
17
|
+
Outline the objectives of the documentation task and describe the target audience. Specify the type of documentation (e.g., API documentation, user guide, tutorial) and what aspect you are specifically trying to communicate.
|
|
18
|
+
|
|
19
|
+
**Steps**
|
|
20
|
+
An outline of the steps required to create or update the documentation. Include details such as:
|
|
21
|
+
|
|
22
|
+
- The specific content (e.g. text, code snippets, diagrams) to be added or updated.
|
|
23
|
+
- The specific affected files
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Development Task
|
|
3
|
+
about: A tightly scoped task for a developer.
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: nathanjmcdougall
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Motivation**
|
|
11
|
+
A clear and concise description of what benefit you would get from this feature.
|
|
12
|
+
|
|
13
|
+
**Summary of desired feature**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Design**
|
|
17
|
+
An explanation of the general approach and philosophy of the proposed design.
|
|
18
|
+
|
|
19
|
+
**Describe alternatives you've considered**
|
|
20
|
+
A clear and concise description of any alternative solutions or feature, or designs you've considered.
|
|
21
|
+
|
|
22
|
+
**Testing Strategy**
|
|
23
|
+
What sort of tests will be written?
|
|
24
|
+
|
|
25
|
+
**Steps**
|
|
26
|
+
An outline of steps required to implement this feature.
|
|
27
|
+
|
|
28
|
+
**Acceptance Criteria**
|
|
29
|
+
When would enough be done to consider this task completed?
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Idea
|
|
3
|
+
about: A high-level description of a feature you'd like.
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: nathanjmcdougall
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Motivation**
|
|
11
|
+
A clear and concise description of what benefit you would get from this feature.
|
|
12
|
+
|
|
13
|
+
**Summary of desired feature**
|
|
14
|
+
A clear and concise description of what you want to happen, at a high level.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
workflow_dispatch:
|
|
4
|
+
push:
|
|
5
|
+
branches: ['main']
|
|
6
|
+
pull_request:
|
|
7
|
+
jobs:
|
|
8
|
+
tests:
|
|
9
|
+
runs-on: ${{ matrix.os }}
|
|
10
|
+
env:
|
|
11
|
+
PYTHONIOENCODING: utf-8
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout code
|
|
14
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
15
|
+
|
|
16
|
+
- name: Setup git user config
|
|
17
|
+
run: |
|
|
18
|
+
git config --global user.name placeholder
|
|
19
|
+
git config --global user.email placeholder@example.com
|
|
20
|
+
|
|
21
|
+
- name: Set up uv
|
|
22
|
+
uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v3.2.0
|
|
23
|
+
with:
|
|
24
|
+
version: "latest"
|
|
25
|
+
|
|
26
|
+
- name: "Set up Python"
|
|
27
|
+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
|
|
28
|
+
with:
|
|
29
|
+
python-version: ${{ matrix.python-version }}
|
|
30
|
+
|
|
31
|
+
- name: Setup dependencies
|
|
32
|
+
run: |
|
|
33
|
+
uv export --resolution ${{ matrix.resolution }} > requirements.txt
|
|
34
|
+
uv pip install --system --break-system-packages -r requirements.txt
|
|
35
|
+
|
|
36
|
+
- name: Run pre-commit
|
|
37
|
+
run: |
|
|
38
|
+
uv run --frozen pre-commit run --all-files
|
|
39
|
+
|
|
40
|
+
- name: Run pytest
|
|
41
|
+
uses: pavelzw/pytest-action@510c5e90c360a185039bea56ce8b3e7e51a16507 # v2.2.0
|
|
42
|
+
|
|
43
|
+
strategy:
|
|
44
|
+
matrix:
|
|
45
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
46
|
+
python-version: [3.12, 3.13]
|
|
47
|
+
resolution: [highest, lowest-direct]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
name: Release to PyPI
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
jobs:
|
|
8
|
+
deploy:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment: release
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
16
|
+
|
|
17
|
+
- name: Set up uv
|
|
18
|
+
uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v3.2.0
|
|
19
|
+
with:
|
|
20
|
+
version: "latest"
|
|
21
|
+
|
|
22
|
+
- name: "Set up Python"
|
|
23
|
+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
|
|
24
|
+
with:
|
|
25
|
+
python-version: 3.12
|
|
26
|
+
|
|
27
|
+
- name: Release
|
|
28
|
+
run: |
|
|
29
|
+
uv build
|
|
30
|
+
uv publish --trusted-publishing always
|
usethis-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
110
|
+
.pdm.toml
|
|
111
|
+
.pdm-python
|
|
112
|
+
.pdm-build/
|
|
113
|
+
|
|
114
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
115
|
+
__pypackages__/
|
|
116
|
+
|
|
117
|
+
# Celery stuff
|
|
118
|
+
celerybeat-schedule
|
|
119
|
+
celerybeat.pid
|
|
120
|
+
|
|
121
|
+
# SageMath parsed files
|
|
122
|
+
*.sage.py
|
|
123
|
+
|
|
124
|
+
# Environments
|
|
125
|
+
.env
|
|
126
|
+
.venv
|
|
127
|
+
env/
|
|
128
|
+
venv/
|
|
129
|
+
ENV/
|
|
130
|
+
env.bak/
|
|
131
|
+
venv.bak/
|
|
132
|
+
|
|
133
|
+
# Spyder project settings
|
|
134
|
+
.spyderproject
|
|
135
|
+
.spyproject
|
|
136
|
+
|
|
137
|
+
# Rope project settings
|
|
138
|
+
.ropeproject
|
|
139
|
+
|
|
140
|
+
# mkdocs documentation
|
|
141
|
+
/site
|
|
142
|
+
|
|
143
|
+
# mypy
|
|
144
|
+
.mypy_cache/
|
|
145
|
+
.dmypy.json
|
|
146
|
+
dmypy.json
|
|
147
|
+
|
|
148
|
+
# Pyre type checker
|
|
149
|
+
.pyre/
|
|
150
|
+
|
|
151
|
+
# pytype static type analyzer
|
|
152
|
+
.pytype/
|
|
153
|
+
|
|
154
|
+
# Cython debug symbols
|
|
155
|
+
cython_debug/
|
|
156
|
+
|
|
157
|
+
# PyCharm
|
|
158
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
159
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
160
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
161
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
162
|
+
#.idea/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/abravalheri/validate-pyproject
|
|
3
|
+
rev: "v0.22"
|
|
4
|
+
hooks:
|
|
5
|
+
- id: validate-pyproject
|
|
6
|
+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
|
|
7
|
+
- repo: local
|
|
8
|
+
hooks:
|
|
9
|
+
- id: ruff-format
|
|
10
|
+
name: ruff-format
|
|
11
|
+
entry: uv run --frozen ruff format
|
|
12
|
+
language: system
|
|
13
|
+
always_run: true
|
|
14
|
+
pass_filenames: false
|
|
15
|
+
- repo: local
|
|
16
|
+
hooks:
|
|
17
|
+
- id: ruff-check
|
|
18
|
+
name: ruff-check
|
|
19
|
+
entry: uv run --frozen ruff check --fix
|
|
20
|
+
language: system
|
|
21
|
+
always_run: true
|
|
22
|
+
pass_filenames: false
|
|
23
|
+
- repo: local
|
|
24
|
+
hooks:
|
|
25
|
+
- id: deptry
|
|
26
|
+
name: deptry
|
|
27
|
+
entry: uv run --frozen deptry src
|
|
28
|
+
language: system
|
|
29
|
+
always_run: true
|
|
30
|
+
pass_filenames: false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12.4
|
usethis-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Nathan McDougall
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
usethis-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: usethis
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Automate Python package and project setup tasks that are otherwise performed manually.
|
|
5
|
+
Project-URL: Source Code, https://github.com/nathanjmcdougall/usethis-python
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/nathanjmcdougall/usethis-python/issues
|
|
7
|
+
Project-URL: source_archive, https://github.com/nathanjmcdougall/usethis-python/archive/f27d232986de7e36dbfed46afa106c0d839e7942.zip
|
|
8
|
+
Author-email: Nathan McDougall <nathan.j.mcdougall@gmail.com>
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2024 Nathan McDougall
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Keywords: init,project,setup,start,usethis
|
|
32
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
33
|
+
Classifier: Environment :: Console
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
37
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
+
Classifier: Topic :: Software Development
|
|
41
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
42
|
+
Classifier: Topic :: Software Development :: Testing
|
|
43
|
+
Requires-Python: >=3.12
|
|
44
|
+
Requires-Dist: mergedeep>=1.3.4
|
|
45
|
+
Requires-Dist: packaging>=24.1
|
|
46
|
+
Requires-Dist: pydantic>=2.9.2
|
|
47
|
+
Requires-Dist: requests>=2.32.3
|
|
48
|
+
Requires-Dist: rich>=13.8.1
|
|
49
|
+
Requires-Dist: ruamel-yaml>=0.18.6
|
|
50
|
+
Requires-Dist: tomlkit>=0.13.2
|
|
51
|
+
Requires-Dist: typer>=0.12.5
|
|
52
|
+
Description-Content-Type: text/markdown
|
|
53
|
+
|
|
54
|
+
# usethis
|
|
55
|
+
|
|
56
|
+
Automate Python package and project setup tasks that are otherwise performed manually.
|
|
57
|
+
|
|
58
|
+
## Commands
|
|
59
|
+
|
|
60
|
+
### `usethis tool`
|
|
61
|
+
|
|
62
|
+
Add a new tool to a Python project, including:
|
|
63
|
+
|
|
64
|
+
- declared & installed dependencies with `uv add`,
|
|
65
|
+
- relevant `pyproject.toml` configuration,
|
|
66
|
+
- any other relevant directories or tool-bespoke configuration files, and
|
|
67
|
+
- `.pre-commit-config.yaml` configuration if using `pre-commit`.
|
|
68
|
+
|
|
69
|
+
Currently supported tools:
|
|
70
|
+
|
|
71
|
+
- ruff
|
|
72
|
+
- pytest
|
|
73
|
+
- deptry
|
|
74
|
+
- pre-commit
|
|
75
|
+
|
|
76
|
+
Example:
|
|
77
|
+
|
|
78
|
+
`usethis tool ruff`
|
|
79
|
+
|
|
80
|
+
Supported arguments:
|
|
81
|
+
|
|
82
|
+
- `--remove` to remove the tool instead of adding it
|
|
83
|
+
- `--offline` to disable network access and rely on caches
|
|
84
|
+
|
|
85
|
+
### `usethis ci`
|
|
86
|
+
|
|
87
|
+
Add Continuous Integration pipelines to the project.
|
|
88
|
+
|
|
89
|
+
Currently supported platforms:
|
|
90
|
+
|
|
91
|
+
- Bitbucket
|
|
92
|
+
|
|
93
|
+
Example:
|
|
94
|
+
|
|
95
|
+
`usethis ci bitbucket`.
|
|
96
|
+
|
|
97
|
+
### `usethis browse pypi`
|
|
98
|
+
|
|
99
|
+
Dispaly or open the PyPI landing page associated with another project.
|
|
100
|
+
|
|
101
|
+
Example:
|
|
102
|
+
|
|
103
|
+
`usethis browse pypi numpy`
|
|
104
|
+
|
|
105
|
+
Supported arguments:
|
|
106
|
+
|
|
107
|
+
- `--browser` to open the link in the browser automatically.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
[](https://github.com/astral-sh/uv)
|
|
112
|
+
|
|
113
|
+
### Hypothetical Interface
|
|
114
|
+
|
|
115
|
+
The current interfaces are being considered:
|
|
116
|
+
|
|
117
|
+
- `usethis tool` to configure a tool, e.g. `usethis tool ruff`. Adding a tool will install it, as well as add relevant files and/or configuration to use the tool. Tools can interact, for example if you run `usethis tool pytest` it will install `pytest`, add it as a testing dependency, etc. but if you then run `usethis tool ruff` then `usethis` will strategically configure `pytest` with `pytest`-specific linter rules. Also vice-versa - if you already have ruff configured but then run `usethis tool pytest`, then `usethis` will strategically add new ruff configuration to reflect the fact you are now using `pytest`. In this way, `usethis` calls are order-invariant.
|
|
118
|
+
- `usethis badge` to add various badges. Note that you can often get the badge with `usethis tool ... --badge` when available for a tool.
|
|
119
|
+
- `usethis browse` to browse something, e.g. `usethis browse pypi ruff` would open the URL to the PyPI page for `ruff` in the browser.
|
|
120
|
+
- `usethis license` to choose a license, e.g. `usethis license mit` to use the MIT license.
|
|
121
|
+
- `usethis file` to create a python file at the specifified location. Add the `--test` flag to create a corresponding test file in the `tests` directory.
|
|
122
|
+
- `usethis package` to configure the packages distributed by your project.
|
|
123
|
+
|
|
124
|
+
### Keeping Config Sections Synchronized
|
|
125
|
+
|
|
126
|
+
Tools are not configured independently from one another. For example, if we are using pytest, we might want to enable the PTD rules in ruff, whereas if we are not using pytest, it really doesn't make sense to do this. Another example would be shared config, e.g. if two tools both need to know that the source code is in the `src` folder. One last example is a tool that cannot be used at all without another, e.g. `setuptools_scm` requires that we have setuptools in the first place.
|
|
127
|
+
|
|
128
|
+
Each usethis function is potentially the dependent for another, and itself might have dependents. Both directions need to be considered when the function is designed and tested. In general, functions need to be able to read configuration to determine which actions to take, and then they need robust write functionality to extend existing config and append to existing files.
|
|
129
|
+
|
|
130
|
+
Generally, information for tool configuration should be in `pyproject.toml` in the appropriate section. In rare cases, it might be necessary to store information in a `[tool.usethis]` section, although this is not yet clear.
|
|
131
|
+
|
|
132
|
+
#### Worked Example
|
|
133
|
+
|
|
134
|
+
We might run `usethis package` to make a distribution package associated with the project. This will be stored in the `packages` list in `[tool.setuptools]` in `pyproject.toml`. Then `usethis tool deptry` to set up deptry. This will add config to `pyproject.toml` for deptry, including ignoring the rule code DEP001 specifically for the packages listed by `usethis package`. If we added a new package with `usethis package --name other_package` then the deptry configuration would be extended to include this new package.
|
usethis-0.1.0/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# usethis
|
|
2
|
+
|
|
3
|
+
Automate Python package and project setup tasks that are otherwise performed manually.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### `usethis tool`
|
|
8
|
+
|
|
9
|
+
Add a new tool to a Python project, including:
|
|
10
|
+
|
|
11
|
+
- declared & installed dependencies with `uv add`,
|
|
12
|
+
- relevant `pyproject.toml` configuration,
|
|
13
|
+
- any other relevant directories or tool-bespoke configuration files, and
|
|
14
|
+
- `.pre-commit-config.yaml` configuration if using `pre-commit`.
|
|
15
|
+
|
|
16
|
+
Currently supported tools:
|
|
17
|
+
|
|
18
|
+
- ruff
|
|
19
|
+
- pytest
|
|
20
|
+
- deptry
|
|
21
|
+
- pre-commit
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
|
|
25
|
+
`usethis tool ruff`
|
|
26
|
+
|
|
27
|
+
Supported arguments:
|
|
28
|
+
|
|
29
|
+
- `--remove` to remove the tool instead of adding it
|
|
30
|
+
- `--offline` to disable network access and rely on caches
|
|
31
|
+
|
|
32
|
+
### `usethis ci`
|
|
33
|
+
|
|
34
|
+
Add Continuous Integration pipelines to the project.
|
|
35
|
+
|
|
36
|
+
Currently supported platforms:
|
|
37
|
+
|
|
38
|
+
- Bitbucket
|
|
39
|
+
|
|
40
|
+
Example:
|
|
41
|
+
|
|
42
|
+
`usethis ci bitbucket`.
|
|
43
|
+
|
|
44
|
+
### `usethis browse pypi`
|
|
45
|
+
|
|
46
|
+
Dispaly or open the PyPI landing page associated with another project.
|
|
47
|
+
|
|
48
|
+
Example:
|
|
49
|
+
|
|
50
|
+
`usethis browse pypi numpy`
|
|
51
|
+
|
|
52
|
+
Supported arguments:
|
|
53
|
+
|
|
54
|
+
- `--browser` to open the link in the browser automatically.
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
[](https://github.com/astral-sh/uv)
|
|
59
|
+
|
|
60
|
+
### Hypothetical Interface
|
|
61
|
+
|
|
62
|
+
The current interfaces are being considered:
|
|
63
|
+
|
|
64
|
+
- `usethis tool` to configure a tool, e.g. `usethis tool ruff`. Adding a tool will install it, as well as add relevant files and/or configuration to use the tool. Tools can interact, for example if you run `usethis tool pytest` it will install `pytest`, add it as a testing dependency, etc. but if you then run `usethis tool ruff` then `usethis` will strategically configure `pytest` with `pytest`-specific linter rules. Also vice-versa - if you already have ruff configured but then run `usethis tool pytest`, then `usethis` will strategically add new ruff configuration to reflect the fact you are now using `pytest`. In this way, `usethis` calls are order-invariant.
|
|
65
|
+
- `usethis badge` to add various badges. Note that you can often get the badge with `usethis tool ... --badge` when available for a tool.
|
|
66
|
+
- `usethis browse` to browse something, e.g. `usethis browse pypi ruff` would open the URL to the PyPI page for `ruff` in the browser.
|
|
67
|
+
- `usethis license` to choose a license, e.g. `usethis license mit` to use the MIT license.
|
|
68
|
+
- `usethis file` to create a python file at the specifified location. Add the `--test` flag to create a corresponding test file in the `tests` directory.
|
|
69
|
+
- `usethis package` to configure the packages distributed by your project.
|
|
70
|
+
|
|
71
|
+
### Keeping Config Sections Synchronized
|
|
72
|
+
|
|
73
|
+
Tools are not configured independently from one another. For example, if we are using pytest, we might want to enable the PTD rules in ruff, whereas if we are not using pytest, it really doesn't make sense to do this. Another example would be shared config, e.g. if two tools both need to know that the source code is in the `src` folder. One last example is a tool that cannot be used at all without another, e.g. `setuptools_scm` requires that we have setuptools in the first place.
|
|
74
|
+
|
|
75
|
+
Each usethis function is potentially the dependent for another, and itself might have dependents. Both directions need to be considered when the function is designed and tested. In general, functions need to be able to read configuration to determine which actions to take, and then they need robust write functionality to extend existing config and append to existing files.
|
|
76
|
+
|
|
77
|
+
Generally, information for tool configuration should be in `pyproject.toml` in the appropriate section. In rare cases, it might be necessary to store information in a `[tool.usethis]` section, although this is not yet clear.
|
|
78
|
+
|
|
79
|
+
#### Worked Example
|
|
80
|
+
|
|
81
|
+
We might run `usethis package` to make a distribution package associated with the project. This will be stored in the `packages` list in `[tool.setuptools]` in `pyproject.toml`. Then `usethis tool deptry` to set up deptry. This will add config to `pyproject.toml` for deptry, including ignoring the rule code DEP001 specifically for the packages listed by `usethis package`. If we added a new package with `usethis package --name other_package` then the deptry configuration would be extended to include this new package.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Introspection when developing
|
|
2
|
+
|
|
3
|
+
Nathan McDougall, August 2024.
|
|
4
|
+
|
|
5
|
+
When developing, so many of our actions are reflexive. If you are interesting in
|
|
6
|
+
developing usethis, then it is very valuable to slow down, and consider thoroughly
|
|
7
|
+
which actions you are undertaking. Some of them might be running off-the-shelf automated
|
|
8
|
+
tools. Sometimes you might be setting up bespoke configuration for those tools.
|
|
9
|
+
Other times, you might have to do something manually.
|
|
10
|
+
|
|
11
|
+
These are all useful points to note down and can provide a lot of insight into potential
|
|
12
|
+
features for usethis (besides just being useful documentation).
|
|
13
|
+
|
|
14
|
+
For example, when developing usethis, here are a list of actions that I undertook (not
|
|
15
|
+
necessarily listed chronologically):
|
|
16
|
+
|
|
17
|
+
## Toolset decisions
|
|
18
|
+
|
|
19
|
+
- Use GitHub Actions for CI.
|
|
20
|
+
- Always use the hash to pin the version of a GitHub action `uses:`
|
|
21
|
+
- Use uv for package management.
|
|
22
|
+
|
|
23
|
+
## Repo configuration
|
|
24
|
+
|
|
25
|
+
- Created a repo on GitHub wih template .gitignore, MIT license and README.
|
|
26
|
+
- Created a develop branch.
|
|
27
|
+
- Set up sensible rulesets for branches.
|
|
28
|
+
- Created a template for GitHub issues that are development tasks.
|
|
29
|
+
- Ran `uv init --name usethis`.
|
|
30
|
+
- Ran `uv python pin 3.12.4`.
|
|
31
|
+
|
|
32
|
+
## Add GitHub Actions CI
|
|
33
|
+
|
|
34
|
+
- Create a GitHub workflow file for CI manually in `.github/workflows/ci.yml`.
|
|
35
|
+
- Use the following configuration to support GitFlow-style branch management:
|
|
36
|
+
|
|
37
|
+
```yml
|
|
38
|
+
name: CI
|
|
39
|
+
on:
|
|
40
|
+
workflow_dispatch:
|
|
41
|
+
push:
|
|
42
|
+
branches: ['main', 'develop']
|
|
43
|
+
pull_request:
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- Add <https://github.com/hynek/setup-cached-uv>.
|
|
47
|
+
- Add <https://github.com/actions/checkout>.
|
|
48
|
+
- Set up the GitHub actions matrix to use Ubuntu, Windows and MacOS.
|
|
49
|
+
- Set up the GitHub actions to use different Python versions.
|
|
50
|
+
- Set up logic to use uv in GitHub actions.
|
|
51
|
+
|
|
52
|
+
## Local development configuration
|
|
53
|
+
|
|
54
|
+
- Cloned the repo from GitHub.
|
|
55
|
+
- Ran `uv sync`.
|
|
56
|
+
- Set up git username, email, and signing key.
|
|
57
|
+
|
|
58
|
+
## Set up tests
|
|
59
|
+
|
|
60
|
+
- Ran `uv add --dev pytest`.
|
|
61
|
+
- Created a tests folder.
|
|
62
|
+
- Added a trivial test module `test_nothing.py`.
|
|
63
|
+
- Add a trivial test `test_pass` to the test module.
|
|
64
|
+
- Add pytest, pytest-md and pytest-emoji as dev deependencies.
|
|
65
|
+
- Confirm pytest is working with `pytest tests` in the CLI.
|
|
66
|
+
- Add <https://github.com/pavelzw/pytest-action> to set up pytest in CI, using the
|
|
67
|
+
correct CLI args to pytest.
|