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

Set git origin when creating a project #10

Merged
merged 4 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: check-ast
- id: check-json
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
args: ['--unsafe'] # needed for !! tags in mkdocs.yml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Version 0.7

- Add: Let `git` set remote to the project repository during setup
- Fix: Setting `pymdownx.magiclink` in `mkdocs` correctly.
- Upd: Updated dependencies of environemnts

## Version 0.6

- Fix: `PIP_COMPILE_UPGRADE_PACKAGE` instead of `PIP_COMPILE_UPGRADE` in `upgrade-pkg` hatch command
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The Hatchlor integrates the following features:
* [pyproject.toml]: all package, build and tool configuration in one file,
* [pytest]: full-featured Python testing tool that helps you write better programs,
* [coverage]: tool for measuring code coverage of Python programs with pytest integration,
* [GitHub Actions]: workflows with [dependabot], [release-drafter], [labeler], build docs, test & publish to PYPI,
* [GitHub Actions]: workflows with [dependabot], [release-drafter], [labeler], build docs, test & publish to PyPI,
* [ruff]: extremely fast Python linter/formatter, which replaces [isort], [flake8], [black], etc.,
* [mypy]: optional static type checker for Python,
* [mkdocs]: a fast, simple and downright gorgeous static site generator,
Expand Down
1 change: 1 addition & 0 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
subprocess.call(['git', 'init'])
subprocess.call(['git', 'add', '*'])
subprocess.call(['git', 'commit', '-m', 'Initial commit'])
subprocess.call(['git', 'remote', 'add', 'origin', '{{ cookiecutter.project_repo }}'])
except Exception as e:
print(f"An error occurred during initializing the git repo: {e}")
print("Makre sure to manually set up a git repository which is necessary for `hatch-vcs`")
6 changes: 3 additions & 3 deletions {{cookiecutter.project_slug}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
Expand All @@ -20,14 +20,14 @@ repos:

# Ruff replaces black, flake8, autoflake, isort and more
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.4.4' # make sure this is always consistent with hatch configs
rev: 'v0.5.7' # make sure this is always consistent with hatch configs
hooks:
- id: ruff
- id: ruff-format
args: [--check, --config, ./pyproject.toml]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.9.0' # make sure this is always consistent with hatch configs
rev: 'v1.11.1' # make sure this is always consistent with hatch configs
hooks:
- id: mypy
args: ["--install-types", "--non-interactive"]
Expand Down
8 changes: 5 additions & 3 deletions {{cookiecutter.project_slug}}/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ markdown_extensions:
social_url_shortener: true
social_url_shorthand: true
normalize_issue_symbols: true
provider: github
user: pypa
repo: hatch
{% set parts = cookiecutter.project_repo.split('/') -%}
{% set domain_parts = parts[-3].split('.') if parts|length > 2 else [] -%}
provider: {{ domain_parts[-2] if domain_parts|length > 2 else 'github' }}
user: {{ parts[-2] if parts|length > 2 else cookiecutter.github_username }}
repo: {{ parts[-1] if parts|length > 2 else cookiecutter.project_slug }}
- pymdownx.mark:
- pymdownx.progressbar:
- pymdownx.saneheaders:
Expand Down
22 changes: 11 additions & 11 deletions {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ ban-relative-imports = "all"
{%- if cookiecutter.lock_file_support %}

[tool.hatch.env]
requires = ["hatch-pip-compile~=1.11.1"]
requires = ["hatch-pip-compile~=1.11.2"]
{%- endif %}

# Default environment with production dependencies
Expand Down Expand Up @@ -263,25 +263,25 @@ debug = "cov --no-cov -s --pdb --pdbcls=IPython.core.debugger:Pdb {args}"
# Docs environment
[tool.hatch.envs.docs]
dependencies = [
"mkdocs~=1.5",
"mkdocs~=1.6",
"mkdocs-material[imaging]~=9.4",
# Plugins
"mkdocs-include-markdown-plugin",
"mkdocs-gen-files",
"mkdocs-literate-nav",
"mkdocs-minify-plugin~=0.5",
"mkdocs-minify-plugin~=0.8",
"mkdocs-section-index",
"mkdocs-git-revision-date-localized-plugin~=1.1",
"mkdocs-git-revision-date-localized-plugin~=1.2",
"mkdocstrings[python]",
"mkdocs-redirects~=1.2",
"mkdocs-glightbox~=0.3.0",
"mike~=2.0.0",
"mkdocs-glightbox~=0.4.0",
"mike~=2.1",
# Extensions
"pymdown-extensions~=10.5",
"pymdown-extensions~=10.9",
# Necessary for syntax highlighting in code blocks
"pygments~=2.13",
"pygments~=2.18",
# Validation
"linkchecker~=10.3",
"linkchecker~=10.4",
]
[tool.hatch.envs.docs.env-vars]
SOURCE_DATE_EPOCH = "1580601600"
Expand All @@ -303,8 +303,8 @@ build-check = [
[tool.hatch.envs.lint]
template = "lint" # don't inherit from default!
dependencies = [
"mypy==1.10.0",
"ruff==0.4.4",
"mypy==1.11.1",
"ruff==0.5.7",
]
[tool.hatch.envs.lint.scripts]
typing = [
Expand Down
Loading