Code Monkey home page Code Monkey logo

cookiecutter-modern-pypackage's Introduction

๐Ÿ‘‹ Hi, I'm Federico from Argentina ๐Ÿ‡ฆ๐Ÿ‡ท, currently based in Hamburg, DE ๐Ÿ‡ฉ๐Ÿ‡ช. Before this, I called Wageningen, NL ๐Ÿ‡ณ๐Ÿ‡ฑ home, and who knows where the next adventure will take me! ๐ŸŒ.

โค๏ธ I'm deeply passionate about open source and spend my coding hours on Python projects, automation, and data-related stuff.

๐Ÿš€ One of my key projects is cookiecutter-modern-pypackage, aimed at simplifying the creation of modern Python packages.

๐Ÿ™ Join me on this journey, and let's contribute to the open source community together.

cookiecutter-modern-pypackage's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cookiecutter-modern-pypackage's Issues

Fix Read The Docs config file.

Expected Behavior

The read the docs build process should work correctly with the provided config file.

Actual Behavior

The read the docs build process is broken due to improper configuration in the config file.

Fix .readthedocs.yml:

version: 2

build:
  os: ubuntu-22.04
  tools:
    python: "3.8"

formats: all

sphinx:
  configuration: docs/conf.py

python:
  install:
    - requirements: docs/requirements.txt
    - method: pip
      path: .

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

Broken project when `project_name` != `project_slug`

Expected Behavior

If a new project is created with project_name distinct from project_slug it should be possible to run the project tests.

Actual Behavior

If a new project is created with project_name distinct from project_slug the tests are broken.

Steps to Reproduce the Problem

  1. Create a new project:
$ cookiecutter gh:fedejaure/cookiecutter-modern-pypackage --checkout v2.0.0
full_name [Federico Jaureguialzo]: 
email [[email protected]]: 
github_username [fedejaure]: 
project_name [modern-python-boilerplate]: 
project_slug [modern_python_boilerplate]: modern_python
project_title [Modern Python Boilerplate]: 
project_short_description [Python Boilerplate contains all the boilerplate you need to create a modern Python package.]: 
version [0.1.0]: 
Select open_source_license:
1 - MIT
2 - BSD
3 - ISC
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 [1]: 
Select command_line_interface:
1 - Click
2 - No command-line interface
Choose from 1, 2 [1]: 
add_code_of_conduct [y]: 
add_contributing_file [y]: 
add_security_file [y]: 
contact_method:
  1. Go to the new project dir and install the deps:
$ cd modern-python-boilerplate
modern-python-boilerplate $ poetry install
  1. Run the tests:
modern-python-boilerplate $ poetry run inv tests 
============================================================================================================ test session starts =============================================================================================================
platform darwin -- Python 3.9.1, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /modern-python-boilerplate
plugins: cov-2.12.1, xdoctest-0.15.5
collected 0 items / 2 errors                                                                                                                                                                                                                 
Coverage.py warning: Module modern_python was never imported. (module-not-imported)
Coverage.py warning: No data was collected. (no-data-collected)
WARNING: Failed to generate report: No data to report.

/Caches/pypoetry/virtualenvs/modern-python-boilerplate-E8bi7dWk-py3.9/lib/python3.9/site-packages/pytest_cov/plugin.py:271: PytestWarning: Failed to generate report: No data to report.

  self.cov_controller.finish()

=================================================================================================================== ERRORS ===================================================================================================================
_____________________________________________________________________________________________________ ERROR collecting tests/test_cli.py _____________________________________________________________________________________________________
ImportError while importing test module '/modern-python-boilerplate/tests/test_cli.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_cli.py:7: in <module>
    import modern_python
E   ModuleNotFoundError: No module named 'modern_python'
________________________________________________________________________________________________ ERROR collecting tests/test_modern_python.py ________________________________________________________________________________________________
ImportError while importing test module '/modern-python-boilerplate/tests/test_modern_python.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/Cellar/[email protected]/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_modern_python.py:6: in <module>
    import modern_python
E   ModuleNotFoundError: No module named 'modern_python'


========================================================================================================== short test summary info ===========================================================================================================
ERROR tests/test_cli.py
ERROR tests/test_modern_python.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================================================= 2 errors in 0.19s ==============================================================================================================

Specifications

  • Version: v2.0.0

Broken docs symbolic links

Expected Behavior

docs/readme.md and docs/changelog.md should be symbolic links to README.md and CHAGELOG.md

Actual Behavior

Now are copies.

Steps to Reproduce the Problem

  1. inv bake

Fix nox coverage sessions

Expected Behavior

โฏ nox --force-color -s tests-3.11
nox > Running session tests-3.11
...
nox > inv tests
...
nox > Session tests-3.11 was successful.
nox > Running session coverage
...
nox > inv coverage

Current Python version (3.12.2) is not allowed by the project (<3.12,>=3.11).
Please change python executable via the "env use" command.
nox > Command inv coverage failed with exit code 1
nox > Session coverage failed.
nox > Ran multiple sessions:
nox > * tests-3.11: success
nox > * coverage: failed

Actual Behavior

โฏ nox --force-color -s tests-3.11
nox > Running session tests-3.11
...
nox > inv tests
...
nox > Session tests-3.11 was successful.
nox > Running session coverage-3.11
...
nox > Session coverage-3.11 was successful.
nox > Ran multiple sessions:
nox > * tests-3.11: success
nox > * coverage-3.11: success

Template is broken

Is your feature request related to a problem? Please describe.
The template is currently broken regarding GitHub Actions (and maybe something else as well I've forgotten since fixing it).

Describe the solution you'd like
See puttehi/slacktube#12 for what it took to fix. I have also locked to Python 3.10 everywhere in an earlier commit to main. Untested with older versions. Might require more finagling with dependencies.

In short:

  • Use nox-poetry as pip doesn't support poetry export format for --constraint anymore.
  • Use flakeheaven instead of flakehell as flakehell doesn't support newer flake8 versions and is an unmaintained, deprecated project replaced by the community fork.

Describe alternatives you've considered

  1. Version lock pip to an older version
  2. Remove poetry

Additional context
Original action after initial commit

Linting job logs
Run pip install pre-commit
  pip install pre-commit
  pre-commit run --all-files
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.7.15/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.15/x64/lib
Collecting pre-commit
  Downloading pre_commit-[2](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:2).20.0-py2.py[3](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:3)-none-any.whl (199 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 199.5/199.5 kB 11.3 MB/s eta 0:00:00
Collecting cfgv>=2.0.0
  Downloading cfgv-3.3.1-py2.py3-none-any.whl (7.3 kB)
Collecting pyyaml>=5.1
  Downloading PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_6[4](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:4).manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl ([5](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:5)9[6](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:6) kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 596.3/596.3 kB 5[7](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:7).7 MB/s eta 0:00:00
Collecting toml
  Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting importlib-metadata
  Downloading importlib_metadata-5.0.0-py3-none-any.whl (21 kB)
Collecting nodeenv>=0.11.1
  Downloading nodeenv-1.7.0-py2.py3-none-any.whl (21 kB)
Collecting identify>=1.0.0
  Downloading identify-2.5.9-py2.py3-none-any.whl (9[8](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:9) kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” [9](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:10)8.8/98.8 kB 32.4 MB/s eta 0:00:00
Collecting virtualenv>=20.0.8
  Downloading virtualenv-20.16.7-py3-none-any.whl (8.8 MB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 8.8/8.8 MB 98.1 MB/s eta 0:00:00
Requirement already satisfied: setuptools in /opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages (from nodeenv>=0.11.1->pre-commit) (47.1.0)
Collecting distlib<1,>=0.3.6
  Downloading distlib-0.3.6-py2.py3-none-any.whl (468 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 468.5/468.5 kB 79.6 MB/s eta 0:00:00
Collecting platformdirs<3,>=2.4
  Downloading platformdirs-2.5.4-py3-none-any.whl (14 kB)
Collecting filelock<4,>=3.4.1
  Downloading filelock-3.8.0-py3-none-any.whl ([10](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:11) kB)
Collecting typing-extensions>=3.6.4
  Downloading typing_extensions-4.4.0-py3-none-any.whl (26 kB)
Collecting zipp>=0.5
  Downloading zipp-3.10.0-py3-none-any.whl (6.2 kB)
Installing collected packages: distlib, zipp, typing-extensions, toml, pyyaml, platformdirs, nodeenv, identify, filelock, cfgv, importlib-metadata, virtualenv, pre-commit
Successfully installed cfgv-3.3.1 distlib-0.3.6 filelock-3.8.0 identify-2.5.9 importlib-metadata-5.0.0 nodeenv-1.7.0 platformdirs-2.5.4 pre-commit-2.20.0 pyyaml-6.0 toml-0.10.2 typing-extensions-4.4.0 virtualenv-20.16.7 zipp-3.10.0

Notice:  A new release of pip available: 22.3 -> 22.3.1
Notice:  To update, run: pip install --upgrade pip
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/timothycrosley/isort.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for local:darglint~=1.8.0,flake8-annotations~=2.6.2,flake8-bandit~=2.1.2,flake8-blind-except~=0.2.0,flake8-bugbear~=21.9.2,flake8-builtins~=1.5.3,flake8-docstrings~=1.6.0,flake8-logging-format~=0.6.0,flake8~=3.9.2,flakehell~=0.9.0.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/timothycrosley/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Check Toml...............................................................Passed
Check Yaml...............................................................Passed
Debug Statements (Python)................................................Passed
Check for merge conflicts................................................Passed
Check JSON...........................................(no files to check)Skipped
Fix End of Files.........................................................Passed
isort....................................................................Passed
black....................................................................Failed
- hook id: black
- exit code: 1

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repo4vif_n5t/py_env-python3.7/bin/black", line 8, in <module>
    sys.exit(patched_main())
  File "/home/runner/.cache/pre-commit/repo4vif_n5t/py_env-python3.7/lib/python3.7/site-packages/black/__init__.py", line [12](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:13)82, in patched_main
    patch_click()
  File "/home/runner/.cache/pre-commit/repo4vif_n5t/py_env-python3.7/lib/python3.7/site-packages/black/__init__.py", line 1268, in patch_click
    from click import _unicodefun  # type: ignore
ImportError: cannot import name '_unicodefun' from 'click' (/home/runner/.cache/pre-commit/repo4vif_n5t/py_env-python3.7/lib/python3.7/site-packages/click/__init__.py)

flakehell................................................................Failed
- hook id: flakehell
- exit code: 1

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repoh_hmq108/py_env-python3.7/bin/flakehell", line 8, in <module>
    sys.exit(entrypoint())
  File "/home/runner/.cache/pre-commit/repoh_hmq108/py_env-python3.7/lib/python3.7/site-packages/flakehell/_cli.py", line 40, in entrypoint
    exit_code, msg = main(argv)
  File "/home/runner/.cache/pre-commit/repoh_hmq108/py_env-python3.7/lib/python3.7/site-packages/flakehell/_cli.py", line 32, in main
    return COMMANDS[command_name](argv=argv[1:])
  File "/home/runner/.cache/pre-commit/repoh_hmq108/py_env-python3.7/lib/python3.7/site-packages/flakehell/commands/_lint.py", line 12, in lint_command
    app.run(argv)
  File "/home/runner/.cache/pre-commit/repoh_hmq108/py_env-python3.7/lib/python3.7/site-packages/flake8/main/application.py", line 363, in run
    self._run(argv)
  File "/home/runner/.cache/pre-commit/repoh_hmq108/py_env-python3.7/lib/python3.7/site-packages/flake8/main/application.py", line 350, in _run
    self.initialize(argv)
  File "/home/runner/.cache/pre-commit/repoh_hmq108/py_env-python3.7/lib/python3.7/site-packages/flake8/main/application.py", line 330, in initialize
    self.find_plugins(config_finder)
  File "/home/runner/.cache/pre-commit/repoh_hmq108/py_env-python3.7/lib/python3.7/site-packages/flakehell/_patched/_app.py", line [16](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:17)3, in find_plugins
    self.check_plugins = FlakeHellCheckers(local_plugins.extension)  # this line is changed
  File "/home/runner/.cache/pre-commit/repoh_hmq108/py_env-python3.7/lib/python3.7/site-packages/flakehell/_patched/_plugins.py", line 67, in __init__
    local_plugins=local_plugins,
  File "/home/runner/.cache/pre-commit/repoh_hmq108/py_env-python3.7/lib/python3.7/site-packages/flakehell/_patched/_plugins.py", line 47, in __init__
    self._load_entrypoint_plugins()
  File "/home/runner/.cache/pre-commit/repoh_hmq108/py_env-python3.7/lib/python3.7/site-packages/flake8/plugins/manager.py", line [25](https://github.com/puttehi/slacktube/actions/runs/3532141950/jobs/5926133006#step:4:26)4, in _load_entrypoint_plugins
    eps = importlib_metadata.entry_points().get(self.namespace, ())
AttributeError: 'EntryPoints' object has no attribute 'get'

Error: Process completed with exit code 1.

Thanks for the template though. It was fun fiddling with CI/CD things for a change :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.