Skip to content
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
33 changes: 0 additions & 33 deletions .circleci/config.yml

This file was deleted.

15 changes: 12 additions & 3 deletions .copier-answers-py.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v0.20240517.2-1-g40ca1f0
# Changes here will be overwritten by Copier
#
# Updating `_src` could be helpful, see notes at:
# https://github.com/level12/coppy/wiki#creating-a-project
#
# Otherwise, NEVER EDIT MANUALLY
_commit: v1.20250622.1
_src_path: gh:level12/copier-py-package
author_email: randy.syring@level12.io
author_name: Randy Syring
gh_org: level12
gh_repo: env-config
hatch_version_tag_sign: true
project_name: env-config-cli
py_module: env_config
python_version: '3.12'
script_name: env-config
use_pipx: true
use_circleci: false
use_gh_nox: true
17 changes: 6 additions & 11 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# .coveragerc to control coverage.py
[run]
branch = True
omit =
src/env_config/version.py

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
source =
src/env_config
src/env_config_tests

# testing assertions usually used with exceptions
assert False

# patterns for running cli
cli_entry()

[html]
directory = ci/coverage-html
directory = tmp/coverage-html
38 changes: 38 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is the "top-most" .editorconfig for this project.
# Like a `.gitignore` file, you can place additional
# .editorconfig files in specific directories, if you need
# local settings. However, this directive specifies that
# no "global" settings will be used (settings from higher-
# up in the directory hierarchy, wherever that may be)
root = true

# Set the default whitespace settings for all files
[*]

# Use UNIX-style line endings
end_of_line = lf

# 4-space indents
indent_size = 4
indent_style = space

# end all files with a newline
insert_final_newline = true

# trim whitespace from the ends of lines
trim_trailing_whitespace = true


[*.py]
# ensure Python source files are utf-8
charset = utf-8


[*.{yml,yaml}]
# Set two-space indents for YAML files
indent_size = 2


[Makefile]
# Makefiles *must* use tabs!
indent_style = tab
36 changes: 36 additions & 0 deletions .github/workflows/nox.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Nox

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

# Limit this workflow to a single run at a time per-branch to avoid wasting worker resources
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
nox:
runs-on: ubuntu-latest

# Runs all steps inside this container
container:
image: ghcr.io/level12/ubuntu-mive:24-3.12
options: --user root

env:
UV_LINK_MODE: copy

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Mark repo as safe for Git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Run Tests
run: |
uv run --only-group nox -- nox
39 changes: 27 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
# Python
*.pyc
*.egg-info
*.coverage
/.tox
.venv

# Tox/Nox/Tests/Coverage
/.nox
/.tox
/ci/coverage-html
*.coverage
/coverage.xml
/.pytests.xml
/htmlcov
*.pytests.xml
.pytest_cache

# .env file for Flask development server
.flaskenv

# Visual Studio Code clutter
# Editor Clutter
.vscode

# Pycharm / JetBrains clutter
.idea

# Project builds

# Build related
dist
/build
npm-debug.log
.*-cache
node_modules


# Local dev files
/mise.local.toml
/tmp

# Terraform
*.tfstate*
tf.plan
.terraform


# Rust
target/
# Project specific
10 changes: 7 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: check-ast
Expand All @@ -13,7 +13,7 @@ repos:
- id: check-added-large-files
- id: check-yaml
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.4
rev: v0.12.0
hooks:
# i.e. `ruff check`
- id: ruff
Expand All @@ -25,6 +25,10 @@ repos:
# the linting check above would always catch a problem created by the formatter.
args: [ --check ]
- repo: https://github.com/level12/pre-commit-hooks
rev: v0.20240516.2
rev: v0.20250226.1
hooks:
- id: check-ruff-versions
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.15
hooks:
- id: uv-lock
12 changes: 0 additions & 12 deletions ci/pytest.ini

This file was deleted.

2 changes: 1 addition & 1 deletion env-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
profile:
pypi:
HATCH_INDEX_USER: '__TOKEN__'
HATCH_INDEX_USER: '__token__'
HATCH_INDEX_AUTH: 'op://my/private/pypi.python.org/api-token'
23 changes: 1 addition & 22 deletions hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,9 @@ dev-mode-dirs = ['src']
packages = ['src/env_config']


## Dependencies
[metadata.hooks.requirements_txt]
files = ['requirements/base.txt']

[metadata.hooks.requirements_txt.optional-dependencies]
dev = ['requirements/dev.txt']


## Env: default
[envs.default]



## Env: copier
[envs.copier]
detached = true
dependencies = [
'copier',
'copier-py-package @ https://github.com/level12/copier-py-package/archive/main.tar.gz',
]

[envs.copier.scripts]
update = 'copier update --answers-file .copier-answers-py.yaml --trust --skip-answered'
update-head = 'update --vcs-ref HEAD'
installer = "uv"


## Version
Expand Down
1 change: 0 additions & 1 deletion mise-tasks/bump
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Consider updating the source file in that repo with enhancements or bug fixes ne
import datetime as dt

import click

from tasks_lib import sub_run


Expand Down
28 changes: 24 additions & 4 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
[tools]
python = "3.12"

[env]
_.python.venv.path = "{{env.WORKON_HOME}}/env-config-cli"
PROJECT_SLUG = '{{ config_root | basename | slugify }}'

_.python.venv.path = '{% if env.UV_PROJECT_ENVIRONMENT %}{{ env.UV_PROJECT_ENVIRONMENT }}{% else %}.venv{% endif %}'
_.python.venv.create = true


[task_config]
includes = [
'tasks',
]


################ TASKS #################
[tasks.pytest-cov]
description = 'Full pytest run with html coverage report'
# .coveragerc sets directory to ./tmp/coverage-html
run = 'pytest --cov --cov-report=html --no-cov-on-fail'


[tasks.upgrade-deps]
description = "Upgrade uv and pre-commit dependencies"
run = [
'uv sync --upgrade',
'pre-commit autoupdate',
]
26 changes: 15 additions & 11 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@


package_path = Path.cwd()

# NOTE: uv is much faster at creating venvs and generally compatible with pip.
# Pip compat: https://github.com/astral-sh/uv/blob/main/PIP_COMPATIBILITY.md
nox.options.default_venv_backend = 'uv'


@nox.session
def tests(session: nox.Session):
session.install('-r', 'requirements/base.txt')
session.install('-e', '.')
session.run('uv', 'sync', '--active', '--no-dev', '--group', 'tests')
session.run(
'pytest',
# use our pytest.ini for warning management
'-c=ci/pytest.ini',
'-ra',
'--tb=native',
'--strict-markers',
Expand All @@ -26,17 +20,27 @@ def tests(session: nox.Session):
'--cov-report=xml',
'--no-cov-on-fail',
f'--junit-xml={package_path}/ci/test-reports/{session.name}.pytests.xml',
'src',
'src/env_config_tests',
*session.posargs,
)


@nox.session
def standards(session: nox.Session):
session.install('-c', 'requirements/dev.txt', 'pre-commit')
def precommit(session: nox.Session):
session.run('uv', 'sync', '--active', '--no-dev', '--group', 'pre-commit')
session.run(
'pre-commit',
'run',
'--show-diff-on-failure',
'--all-files',
)


@nox.session
def audit(session: nox.Session):
# Much faster to install the deps first and have pip-audit run against the venv
session.run('uv', 'sync', '--active', '--no-dev', '--group', 'audit')
session.run(
'pip-audit',
'--desc',
'--skip-editable',
)
Loading