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

Add package stubs and structure #48

Merged
merged 3 commits into from
Nov 30, 2022
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
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: deploy

on:
push:
branches:
- main
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- main
workflow_dispatch:

jobs:

deploy:
# this will run when you have tagged a commit, starting with "v*"
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
if: ${{ github.repository == 'napari/packaging' && contains(github.ref, 'tags') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
run: |
git tag
cd constructor-manager
python -m build
twine check dist/*
twine upload dist/*
cd ..
cd constructor-manager-cli
python -m build
twine check dist/*
twine upload dist/*
cd ..
cd constructor-manager-ui
python -m build
twine check dist/*
twine upload dist/*
60 changes: 60 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: tests

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- 'constructor-manager/**'
- 'constructor-manager-cli/**'
workflow_dispatch:

jobs:
test:
name: ${{ matrix.platform }} py${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies constructor-manager-cli
run: |
python -m pip install --upgrade pip
python -m pip install setuptools tox tox-gh-actions
cd constructor-manager-cli
pip install -e .
pip list

- name: Test constructor-manager-cli
run: |
cd constructor-manager-cli
python -m tox
env:
PLATFORM: ${{ matrix.platform }}

- name: Install dependencies constructor-manager
run: |
cd constructor-manager-cli
pip install -e .
pip list
env:
PLATFORM: ${{ matrix.platform }}

- name: Test constructor-manager
run: |
cd constructor-manager
python -m tox
env:
PLATFORM: ${{ matrix.platform }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,6 @@ _work/

# OS stuff
.DS_store

# written by setuptools_scm
**/_version.py
goanpeca marked this conversation as resolved.
Show resolved Hide resolved
21 changes: 21 additions & 0 deletions constructor-manager-cli/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2022, Napari

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
5 changes: 5 additions & 0 deletions constructor-manager-cli/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include LICENSE
include README.md

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
3 changes: 3 additions & 0 deletions constructor-manager-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Constructor Manager Commnand line interface

Handle (conda) constructor based bundled applications from the command line.
6 changes: 6 additions & 0 deletions constructor-manager-cli/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = ["setuptools>=42.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 79
59 changes: 59 additions & 0 deletions constructor-manager-cli/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[metadata]
name = constructor-manager-cli
version = 0.0.1
description = Constructor environment and updates manager command line interface
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/napari/packaging/constructor-manager-cli
author = napari team
author_email = [email protected]
license = MIT
license_files = LICENSE
classifiers =
Development Status :: 2 - Pre-Alpha
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Scientific/Engineering :: Image Processing
project_urls =
Bug Tracker = https://github.com/napari/packaging/issues
Source Code = https://github.com/napari/packaging/constructor-manager-cli

[options]
packages = find:
install_requires =
packaging
requests
pyyaml
python_requires = >=3.8
include_package_data = True
package_dir =
=src
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a typo or intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended the foldert structure for the pakcages is

package-name/src/module_name

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @potating-potato was referring to the =src. The syntax in setup.cfg here is confusing (bad) but this is not a typo. This gets parsed into a dictionary and that line will have an empty key: https://setuptools.pypa.io/en/latest/userguide/declarative_config.html#specifying-values

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh got it, yes the syntax is weird. We can eventually migrate to a pyproject toml only and use hatch as the build system https://github.com/pypa/hatch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for confirming! I indeed never seen this syntax before


[options.packages.find]
where = src

[options.entry_points]
console_scripts =
constructor-manager = constructor_manager_cli.main:main

[options.extras_require]
testing =
pytest-cov
pytest>=7.0.0
mypy
typing-extensions
types-PyYAML
types-requests

[mypy]
exclude = venv|tests

[mypy-packaging.*]
ignore_missing_imports = True
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Constructor manager CLI."""

__version__ = "0.0.1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Constructor manager CLI."""

import constructor_manager_cli


def test_constructor_manager():
assert constructor_manager_cli
31 changes: 31 additions & 0 deletions constructor-manager-cli/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# For more information about tox, see https://tox.readthedocs.io/en/latest/
[tox]
envlist = py{38,39,310}-{linux,macos,windows}
isolated_build=true

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310

[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
macos-latest: macos
windows-latest: windows

[testenv]
platform =
macos: darwin
linux: linux
windows: win32
passenv =
CI
GITHUB_ACTIONS
DISPLAY XAUTHORITY
NUMPY_EXPERIMENTAL_ARRAY_FUNCTION
PYVISTA_OFF_SCREEN
extras =
testing
commands = pytest -v --color=yes --cov=constructor_manager_cli
21 changes: 21 additions & 0 deletions constructor-manager/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2022, Napari

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
5 changes: 5 additions & 0 deletions constructor-manager/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include LICENSE
include README.md

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
3 changes: 3 additions & 0 deletions constructor-manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Constructor manager

TODO
6 changes: 6 additions & 0 deletions constructor-manager/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = ["setuptools>=42.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 79
52 changes: 52 additions & 0 deletions constructor-manager/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[metadata]
name = constructor-manager
version = 0.0.1
description = Constructor environment and updates manager API
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/napari/packaging/constructor-manager
author = napari team
author_email = [email protected]
license = MIT
license_files = LICENSE
classifiers =
Development Status :: 2 - Pre-Alpha
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Scientific/Engineering :: Image Processing
project_urls =
Bug Tracker = https://github.com/napari/packaging/issues
Source Code = https://github.com/napari/packaging/constructor-manager

[options]
packages = find:
install_requires =
qtpy
goanpeca marked this conversation as resolved.
Show resolved Hide resolved
python_requires = >=3.8
include_package_data = True
package_dir =
=src

[options.packages.find]
where = src

[options.extras_require]
testing =
pytest-cov
pytest>=7.0.0
mypy
typing-extensions
types-requests

[mypy]
exclude = venv|tests

[mypy-packaging.*]
ignore_missing_imports = True
3 changes: 3 additions & 0 deletions constructor-manager/src/constructor_manager/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Constructor manager API."""

__version__ = "0.0.1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Constructor manager API."""

import constructor_manager


def test_constructor_manager():
assert constructor_manager
31 changes: 31 additions & 0 deletions constructor-manager/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# For more information about tox, see https://tox.readthedocs.io/en/latest/
[tox]
envlist = py{38,39,310}-{linux,macos,windows}
isolated_build=true

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310

[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
macos-latest: macos
windows-latest: windows

[testenv]
platform =
macos: darwin
linux: linux
windows: win32
passenv =
CI
GITHUB_ACTIONS
DISPLAY XAUTHORITY
NUMPY_EXPERIMENTAL_ARRAY_FUNCTION
PYVISTA_OFF_SCREEN
extras =
testing
commands = pytest -v --color=yes --cov=constructor_manager