Skip to content

Commit

Permalink
adding project skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
travishathaway committed Oct 15, 2024
1 parent fa22fb9 commit da37dcf
Show file tree
Hide file tree
Showing 14 changed files with 331 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: anaconda-conda-telemetry tests

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

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies (conda)
run: |
conda env update --file environment.yml --name base
conda install --file requirements.dev.txt
- name: Install conda-basic-auth
run: |
pip install -e .
- name: Test with pytest
run: |
pytest --doctest-modules
165 changes: 165 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# conda development environment
./env
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
exclude: "(mkdocs.yml|recipe/meta.yaml)"
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.12.0' # Use the sha / tag you want to point at
hooks:
- id: mypy
additional_dependencies: ['types-requests']
- repo: https://github.com/asottile/pyupgrade
rev: v3.18.0
hooks:
- id: pyupgrade
args: ["--py310-plus"]
- repo: https://github.com/akaihola/darker
rev: v2.1.1
hooks:
- id: darker
additional_dependencies: [black==22.10.0]
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
TODO: Please consider submitting a PR to the [conda-incubator/plugins] repo with a link to your new plugin!

# anaconda-conda-telemetry

A placeholder to work on the Anaconda conda telemetry plugin
Conda telemetry for Anaconda

## Development

To begin developing for this project, source the `develop.sh` script (macOS and Linux only).
Run the following command from the root of your project directory.

```bash
source develop.sh
```

This will create a new environment in the `./env` folder of your project and modifies
`CONDA_EXE` to point to an isolated version of conda within this environment.

To update this environment when new dependencies are added to `environment.yml`, you
can run the same `source develop.sh` command as above.
Empty file.
18 changes: 18 additions & 0 deletions anaconda_conda_telemetry/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Insert your plugin hook definitions
We have illustrated how this is done by defining a simple "hello conda"
subcommand for you.
"""

from conda.plugins import hookimpl, CondaSubcommand


@hookimpl
def conda_subcommands():
def hello_conda(args):
print("Hello conda!")

yield CondaSubcommand(
name="hello", action=hello_conda, summary='Command that prints "Hello conda!"'
)
Empty file.
15 changes: 15 additions & 0 deletions develop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Used to switch CONDA_EXE to the one located in development environment
# To use this script, run `source develop.sh`

if ! (return 0 2> /dev/null); then
echo "ERROR: Source this script: source '$0'." >&2
exit 1
fi

CONDA_ENV_DIR="./env"

conda env $(test -d "$CONDA_ENV_DIR" && echo update || echo create) -p "$CONDA_ENV_DIR" --file environment.yml
conda activate "$CONDA_ENV_DIR"
pip install --no-deps --no-index --no-build-isolation -e .

CONDA_EXE="$CONDA_PREFIX/condabin/conda"
5 changes: 5 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- defaults
dependencies:
- python>=3.8
- conda-canary/label/dev::conda
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[mypy]
warn_no_return = False
exclude = "stubs/*"
29 changes: 29 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[build-system]
requires = ["setuptools>=61.0", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "anaconda-conda-telemetry"
version = "0.1.0"
description = "Conda telemetry for Anaconda"
requires-python = ">=3.8"
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy"
]
dependencies = [
"conda",
]

[project.entry-points.conda]
anaconda-conda-telemetry = "anaconda_conda_telemetry.hooks"

[tool.setuptools]
packages = ["anaconda_conda_telemetry"]
8 changes: 8 additions & 0 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
conda-forge::darker
conda-forge::flake8
conda-forge::mypy
conda-forge::pyupgrade
conda-forge::pytest
conda-forge::pytest-cov
conda-forge::pytest-mock
conda-forge::pre-commit
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 99
ignore = E126,E133,E226,E241,E242,E302,E704,E731,E722,W503,E402,W504,F821,E203
2 changes: 2 additions & 0 deletions tests/test_placeholder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_placeholder():
assert 1 + 1 == 2

0 comments on commit da37dcf

Please sign in to comment.